[php-src] master: Merge branch 'PHP-8.6'
| From: | ndossche | Date: | Tue, 29 Sep 2026 19:40:28 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141728@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-09-29T21:40:19+02:00
Commit: https://github.com/php/php-src/commit/0e9abc171b88e2806c77d8f3adcb613f216e2904
Raw diff: https://github.com/php/php-src/commit/0e9abc171b88e2806c77d8f3adcb613f216e2904.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Fix GH-23842: skipLazyInitialization() copies unresolved constant defaults
Changed paths:
A Zend/tests/lazy_objects/gh23842.phpt
M ext/reflection/php_reflection.c
Diff:
diff --git a/Zend/tests/lazy_objects/gh23842.phpt b/Zend/tests/lazy_objects/gh23842.phpt
new file mode 100644
index 000000000000..fe791dde685b
--- /dev/null
+++ b/Zend/tests/lazy_objects/gh23842.phpt
@@ -0,0 +1,32 @@
+--TEST--
+GH-23842: skipLazyInitialization() copies an unresolved constant default with opcache
+--CREDITS--
+DirkTrunkstar
+--EXTENSIONS--
+opcache
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_cache_only=0
+--FILE--
+<?php
+
+class Currency {
+ public const string EUR = 'EUR';
+}
+
+class Product {
+ public string $currency = Currency::EUR;
+}
+
+$reflector = new ReflectionClass(Product::class);
+$product = $reflector->newLazyGhost(function () {
+ throw new \Exception('initializer');
+});
+$reflector->getProperty('currency')->skipLazyInitialization($product);
+
+var_dump($product->currency);
+
+?>
+--EXPECT--
+string(3) "EUR"
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 8466cbcd27da..7552b00c1151 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -6223,7 +6223,7 @@ ZEND_METHOD(ReflectionProperty, skipLazyInitialization)
RETURN_THROWS();
}
- const zval *src =
&object->ce->default_properties_table[OBJ_PROP_TO_NUM(prop->offset)];
+ const zval *src =
&CE_DEFAULT_PROPERTIES_TABLE(object->ce)[OBJ_PROP_TO_NUM(prop->offset)];
zval *dst = OBJ_PROP(object, prop->offset);
if (!(Z_PROP_FLAG_P(dst) & IS_PROP_LAZY)) {