[php-src] master: Merge branch 'PHP-8.5'
Tim Düsterhus <[email protected]>
| Newsgroups | gmane.comp.php.cvs.general |
|---|---|
| Message-ID | <[email protected]> |
Author: Tim Düsterhus (TimWolla)
Date: 2026-07-04T20:08:51+02:00
Commit: https://github.com/php/php-src/commit/dcfa40cccf20f8011694b3f1635c08b73b579e58
Raw diff: https://github.com/php/php-src/commit/dcfa40cccf20f8011694b3f1635c08b73b579e58.diff
Merge branch 'PHP-8.5'
* PHP-8.5:
phpdbg: Fix off-by-one in phpdbg_safe_class_lookup() signal-safe class lookup (#22593)
Changed paths:
M NEWS
M sapi/phpdbg/phpdbg_utils.c
Diff:
diff --git a/NEWS b/NEWS
index 3ed4f27a6ac1..370095987ea7 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,8 @@ PHP NEWS
- PHPDBG:
. Fixed fleaked lowercased lookup keys in phpdbg_resolve_opline_break.
(jorgsowa)
+ . Fixed off-by-one in phpdbg_safe_class_lookup() causing class lookups to
+ always fail during phpdbg's signal-safe interruption path. (jorgsowa)
- Session:
. Fixed bug GH-21314 (Different session garbage collector behavior between
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 758f75766c81..831595939f64 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -395,29 +395,20 @@ PHPDBG_API void phpdbg_set_async_io(int fd) {
int phpdbg_safe_class_lookup(const char *name, int name_length, zend_class_entry **ce) {
if (PHPDBG_G(flags) & PHPDBG_IN_SIGNAL_HANDLER) {
- char *lc_name, *lc_free;
- int lc_length;
-
if (name == NULL || !name_length) {
return FAILURE;
}
- lc_free = lc_name = emalloc(name_length + 1);
- zend_str_tolower_copy(lc_name, name, name_length);
- lc_length = name_length + 1;
-
- if (lc_name[0] == '\\') {
- lc_name += 1;
- lc_length -= 1;
+ if (name[0] == '\\') {
+ name += 1;
+ name_length -= 1;
}
phpdbg_try_access {
- *ce = zend_hash_str_find_ptr(EG(class_table), lc_name, lc_length);
+ *ce = zend_hash_str_find_ptr_lc(EG(class_table), name, name_length);
} phpdbg_catch_access {
phpdbg_error("Could not fetch class %.*s, invalid data source", name_length, name);
} phpdbg_end_try_access();
-
- efree(lc_free);
} else {
zend_string *str_name = zend_string_init(name, name_length, 0);
*ce = zend_lookup_class(str_name);