Commit a2052f318ab for php

commit a2052f318ab4c7d4fb2e03d576e51488ad7aa097
Author: lazerg <lazerg2@gmail.com>
Date:   Mon Oct 26 20:43:22 2026 +0500

    Fix GH-24745: File cache loses attributes on constants on 32-bit builds

    Closes GH-24750.

    Co-authored-by: Yannick Decat <17177411+mho22@users.noreply.github.com>

diff --git a/NEWS b/NEWS
index 6254d1807c3..5bb01a160a2 100644
--- a/NEWS
+++ b/NEWS
@@ -104,6 +104,8 @@ PHP                                                                        NEWS
     into a hash. (jorgsowa)
   . Fixed bug GH-24436 (Tracing JIT: keep the SEND_VAL type guard after
     assigning to a reference). (waroad)
+  . Fixed bug GH-24745 (File cache loses attributes on constants on 32-bit
+    builds). (Yannick Decat, Lazizbek Ergashev)

 - PDO:
   . Fixed invalid ATTR_ORACLE_NULLS values being accepted and truncated.
diff --git a/ext/opcache/tests/gh24745.inc b/ext/opcache/tests/gh24745.inc
new file mode 100644
index 00000000000..d51e96835b2
--- /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 00000000000..b35b0e45827
--- /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 d1d49890f51..0f9b48feccf 100644
--- a/ext/opcache/zend_file_cache.c
+++ b/ext/opcache/zend_file_cache.c
@@ -561,6 +561,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));
 			}