[php-src] master: Merge branch 'PHP-8.6'
| From: | ndossche | Date: | Mon, 09 Nov 2026 17:45:18 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143495@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-11-09T18:45:04+01:00
Commit: https://github.com/php/php-src/commit/32117fca70a9995f1fb77433d52c4da64473c881
Raw diff: https://github.com/php/php-src/commit/32117fca70a9995f1fb77433d52c4da64473c881.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Reflection: Fix ReflectionProperty::isReadable() not working for indirect slots
Reflection: Fix trampoline leak when object construction fails for lazy object
Changed paths:
A ext/reflection/tests/ReflectionClass_makeLazyGhost_no_trampoline_leak.phpt
A ext/reflection/tests/ReflectionProperty_isReadable_indirect.phpt
M ext/reflection/php_reflection.c
Diff:
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index df801768de32..85229e868edc 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -5149,6 +5149,7 @@ static void reflection_class_new_lazy(INTERNAL_FUNCTION_PARAMETERS,
strategy | options);
if (!obj) {
+ zend_release_fcall_info_cache(&fcc);
RETURN_THROWS();
}
@@ -6769,6 +6770,7 @@ retry_declared:;
zend_class_init_statics(ce);
}
zval *prop_val = CE_STATIC_MEMBERS(ce) + prop->offset;
+ ZVAL_DEINDIRECT(prop_val);
RETURN_BOOL(!Z_ISUNDEF_P(prop_val));
}
diff --git a/ext/reflection/tests/ReflectionClass_makeLazyGhost_no_trampoline_leak.phpt
b/ext/reflection/tests/ReflectionClass_makeLazyGhost_no_trampoline_leak.phpt
new file mode 100644
index 000000000000..dee9b56e5cdd
--- /dev/null
+++ b/ext/reflection/tests/ReflectionClass_makeLazyGhost_no_trampoline_leak.phpt
@@ -0,0 +1,16 @@
+--TEST--
+ReflectionClass::makeLazyGhost() no trampoline leak
+--FILE--
+<?php
+class Helper {
+ public function __call($name, $args) {}
+}
+
+try {
+ (new ReflectionClass('ReflectionClass'))->newLazyGhost([new Helper,
'foo']);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+Cannot make instance of internal class lazy: ReflectionClass is internal
diff --git a/ext/reflection/tests/ReflectionProperty_isReadable_indirect.phpt
b/ext/reflection/tests/ReflectionProperty_isReadable_indirect.phpt
new file mode 100644
index 000000000000..78f2eb8c33f4
--- /dev/null
+++ b/ext/reflection/tests/ReflectionProperty_isReadable_indirect.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test ReflectionProperty::isReadable() indirect
+--FILE--
+<?php
+
+class ParentClass {
+ public static int $prop;
+}
+
+class ChildClass extends ParentClass {}
+
+var_dump((new ReflectionProperty('ParentClass', 'prop'))->isReadable(null));
+var_dump((new ReflectionProperty('ChildClass', 'prop'))->isReadable(null));
+
+ChildClass::$prop = 1;
+
+var_dump((new ReflectionProperty('ParentClass', 'prop'))->isReadable(null));
+var_dump((new ReflectionProperty('ChildClass', 'prop'))->isReadable(null));
+
+?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(true)
+bool(true)