Skip to content

Commit 092de40

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: phpdbg: fix leaked lowercased lookup keys in phpdbg_resolve_opline_break
2 parents 39b66ba + 00aa0e3 commit 092de40

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ PHP NEWS
2222
. Fixed bug GH-20726 (Crash with ODBC connection pooling when the DSN
2323
carries no credentials). (iliaal)
2424

25+
- PHPDBG:
26+
. Fixed fleaked lowercased lookup keys in phpdbg_resolve_opline_break.
27+
(jorgsowa)
28+
2529
- Session:
2630
. Fixed bug GH-21314 (Different session garbage collector behavior between
2731
PHP 8.3 and PHP 8.5). (jorgsowa)

sapi/phpdbg/phpdbg_bp.c

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

603603
if (new_break->class_name != NULL) {
604604
zend_class_entry *ce;
605-
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))) {
605+
if (!(ce = zend_hash_str_find_ptr_lc(EG(class_table), new_break->class_name, new_break->class_len))) {
606606
return FAILURE;
607607
}
608608
func_table = &ce->function_table;
609609
}
610610

611-
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))) {
611+
if (!(func = zend_hash_str_find_ptr_lc(func_table, new_break->func_name, new_break->func_len))) {
612612
if (new_break->class_name != NULL && new_break->func_name != NULL) {
613613
phpdbg_error("Method %s doesn't exist in class %s", new_break->func_name, new_break->class_name);
614614
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)