[php-src] master: Merge branch 'PHP-8.6'
| From: | ndossche | Date: | Mon, 26 Oct 2026 17:37:06 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142745@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-10-26T18:36:46+01:00
Commit: https://github.com/php/php-src/commit/b7567e52437f74d1dd0e1878c63928a53f573470
Raw diff: https://github.com/php/php-src/commit/b7567e52437f74d1dd0e1878c63928a53f573470.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Fix GH-24745: File cache loses attributes on constants on 32-bit builds
Changed paths:
A ext/opcache/tests/gh24745.inc
A ext/opcache/tests/gh24745.phpt
M ext/opcache/zend_file_cache.c
Diff:
diff --git a/ext/opcache/tests/gh24745.inc b/ext/opcache/tests/gh24745.inc
new file mode 100644
index 000000000000..d51e96835b2b
--- /dev/null
+++ b/ext/opcache/tests/gh24745.inc
@@ -0,0 +1,4 @@
+<?php
+
+#[Deprecated(message: 'bar')]
+const FOO = 1;
diff --git a/ext/opcache/tests/gh24745.phpt b/ext/opcache/tests/gh24745.phpt
new file mode 100644
index 000000000000..b35b0e45827d
--- /dev/null
+++ b/ext/opcache/tests/gh24745.phpt
@@ -0,0 +1,20 @@
+--TEST--
+GH-24745: File cache loses attributes on constants on 32-bit builds
+--EXTENSIONS--
+opcache
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_cache="{TMP}"
+opcache.file_cache_only=1
+--FILE--
+<?php
+require __DIR__ . '/gh24745.inc';
+
+var_dump((new ReflectionConstant('FOO'))->getAttributes()[0]->getArguments());
+?>
+--EXPECT--
+array(1) {
+ ["message"]=>
+ string(3) "bar"
+}
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c
index 7465cd7d01d0..004053cc59ff 100644
--- a/ext/opcache/zend_file_cache.c
+++ b/ext/opcache/zend_file_cache.c
@@ -570,6 +570,10 @@ static void zend_file_cache_serialize_op_array(zend_op_array
*op_arra
&& (opline-1)->opcode == ZEND_DECLARE_ATTRIBUTED_CONST
) {
zval *literal = RT_CONSTANT(opline, opline->op1);
+#if ZEND_USE_ABS_CONST_ADDR
+ SERIALIZE_PTR(literal);
+ UNSERIALIZE_PTR(literal);
+#endif
SERIALIZE_ATTRIBUTES(Z_PTR_P(literal));
}