[php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5
Gina Peter Banyard <[email protected]>
| Newsgroups | gmane.comp.php.cvs.general |
|---|---|
| Message-ID | <[email protected]> |
Author: Gina Peter Banyard (Girgias)
Date: 2026-07-03T01:17:06+01:00
Commit: https://github.com/php/php-src/commit/00aa0e39c3a056ff75c6d9bedfcf8d1fe4884242
Raw diff: https://github.com/php/php-src/commit/00aa0e39c3a056ff75c6d9bedfcf8d1fe4884242.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
phpdbg: fix leaked lowercased lookup keys in phpdbg_resolve_opline_break
Changed paths:
A sapi/phpdbg/tests/phpdbg_resolve_opline_break_leak.phpt
M NEWS
M sapi/phpdbg/phpdbg_bp.c
Diff:
diff --git a/NEWS b/NEWS
index 40cbc17db654..3bd77e450600 100644
--- a/NEWS
+++ b/NEWS
@@ -55,6 +55,8 @@ PHP NEWS
- PHPDBG:
. Fixed bug GH-17387 (Trivial crash in phpdbg lexer). (iliaal)
+ . Fixed fleaked lowercased lookup keys in phpdbg_resolve_opline_break.
+ (jorgsowa)
- Reflection:
. Fixed bug GH-22324 (Ignore leading namespace separator in
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index ccbccc32f711..c4979ab402d3 100644
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.c
@@ -604,13 +604,13 @@ PHPDBG_API int phpdbg_resolve_opline_break(phpdbg_breakopline_t *new_break) /* {
if (new_break->class_name != NULL) {
zend_class_entry *ce;
- 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))) {
+ if (!(ce = zend_hash_str_find_ptr_lc(EG(class_table), new_break->class_name, new_break->class_len))) {
return FAILURE;
}
func_table = &ce->function_table;
}
- 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))) {
+ if (!(func = zend_hash_str_find_ptr_lc(func_table, new_break->func_name, new_break->func_len))) {
if (new_break->class_name != NULL && new_break->func_name != NULL) {
phpdbg_error("Method %s doesn't exist in class %s", new_break->func_name, new_break->class_name);
return 2;
diff --git a/sapi/phpdbg/tests/phpdbg_resolve_opline_break_leak.phpt b/sapi/phpdbg/tests/phpdbg_resolve_opline_break_leak.phpt
new file mode 100644
index 000000000000..411697cee021
--- /dev/null
+++ b/sapi/phpdbg/tests/phpdbg_resolve_opline_break_leak.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Resolving method/function opline breakpoints must not leak the lookup keys
+--PHPDBG--
+b Foo::bar#0
+b baz#0
+b Foo::nope#0
+b Nope::bar#0
+q
+--EXPECTF--
+[Successful compilation of %s]
+prompt> [Breakpoint #0 added at Foo::bar#0]
+prompt> [Breakpoint #1 added at baz#0]
+prompt> [Method nope doesn't exist in class Foo]
+prompt> [Pending breakpoint #3 at Nope::bar#0]
+prompt>
+--FILE--
+<?php
+class Foo {
+ public function bar($x) {
+ return $x + 1;
+ }
+}
+
+function baz($y) {
+ return $y * 2;
+}