Skip to content

Commit 00aa0e3

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: phpdbg: fix leaked lowercased lookup keys in phpdbg_resolve_opline_break
2 parents 76dad06 + b6938a2 commit 00aa0e3

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ PHP NEWS
5555

5656
- PHPDBG:
5757
. Fixed bug GH-17387 (Trivial crash in phpdbg lexer). (iliaal)
58+
. Fixed fleaked lowercased lookup keys in phpdbg_resolve_opline_break.
59+
(jorgsowa)
5860

5961
- Reflection:
6062
. Fixed bug GH-22324 (Ignore leading namespace separator in

sapi/phpdbg/phpdbg_bp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,13 +604,13 @@ PHPDBG_API int phpdbg_resolve_opline_break(phpdbg_breakopline_t *new_break) /* {
604604

605605
if (new_break->class_name != NULL) {
606606
zend_class_entry *ce;
607-
if (!(ce = zend_hash_str_find_ptr(EG(class_table), zend_str_tolower_dup(new_break->class_name, new_break->class_len), new_break->class_len))) {
607+
if (!(ce = zend_hash_str_find_ptr_lc(EG(class_table), new_break->class_name, new_break->class_len))) {
608608
return FAILURE;
609609
}
610610
func_table = &ce->function_table;
611611
}
612612

613-
if (!(func = zend_hash_str_find_ptr(func_table, zend_str_tolower_dup(new_break->func_name, new_break->func_len), new_break->func_len))) {
613+
if (!(func = zend_hash_str_find_ptr_lc(func_table, new_break->func_name, new_break->func_len))) {
614614
if (new_break->class_name != NULL && new_break->func_name != NULL) {
615615
phpdbg_error("Method %s doesn't exist in class %s", new_break->func_name, new_break->class_name);
616616
return 2;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Resolving method/function opline breakpoints must not leak the lookup keys
3+
--PHPDBG--
4+
b Foo::bar#0
5+
b baz#0
6+
b Foo::nope#0
7+
b Nope::bar#0
8+
q
9+
--EXPECTF--
10+
[Successful compilation of %s]
11+
prompt> [Breakpoint #0 added at Foo::bar#0]
12+
prompt> [Breakpoint #1 added at baz#0]
13+
prompt> [Method nope doesn't exist in class Foo]
14+
prompt> [Pending breakpoint #3 at Nope::bar#0]
15+
prompt>
16+
--FILE--
17+
<?php
18+
class Foo {
19+
public function bar($x) {
20+
return $x + 1;
21+
}
22+
}
23+
24+
function baz($y) {
25+
return $y * 2;
26+
}

0 commit comments

Comments
 (0)