Commit 74a1f21ebdf for php.net
commit 74a1f21ebdfb7458943527813db8a72e878d9dea
Merge: 8ec60b1ec15 1c491e67c01
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date: Mon Aug 3 10:22:50 2026 -0700
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
NEWS for PHP 8.4
GH-22905: avoid truncation on null bytes in reflection exceptions
Reflection: Add regression tests for error messages with null bytes
diff --cc ext/reflection/php_reflection.c
index 9780a0368cf,c7b15c63a0c..9aa6a908627
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@@ -4306,13 -4399,11 +4341,16 @@@ ZEND_METHOD(ReflectionClass, getStaticP
RETURN_COPY(def_value);
}
- // %S is used for zend_string pointers by smart str printing, but normally
- // is for wide character strings and so compilers complain if this is inline
- const char *format = "Property %S::$%S does not exist";
- zend_throw_exception_ex(reflection_exception_ptr, 0,
- format, ce->name, name);
+ if (prop) {
+ zend_throw_error(NULL,
+ "Typed property %s::$%s must not be accessed before initialization", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ } else {
++ // %S is used for zend_string pointers by smart str printing, but normally
++ // is for wide character strings and so compilers complain if this is inline
++ const char *format = "Property %S::$%S does not exist";
+ zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Property %s::$%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(name));
++ format, ce->name, name);
+ }
}
/* }}} */