From b062410d329d98385d68336dd2b11858d690fb18 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Thu, 30 Oct 2025 13:06:55 +0100 Subject: [PATCH 1/3] Remove CE cache from non-interned file cache strings Strings loaded from the file cache can not have a CE cache, because their cache slot is invalid. Remove the IS_STR_CLASS_NAME_MAP_PTR flag from these strings. We can also avoid updating the str flags in SERIALIZE_STR(), since the same updates must also be done in UNSERIALIZE_STR(). This was already done for interned strings, but not for non-interned ones. Fixes GH-20329 Closes GH-20337 --- NEWS | 4 ++++ ext/opcache/zend_file_cache.c | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 7cf9b1dde34a..af4ff2a54435 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.3.29 +- Opcache: + . Fixed bug GH-20329 (opcache.file_cache broken with full interned string + buffer). (Arnaud) + - Tidy: . Fixed bug GH-20374 (PHP with tidy and custom-tags). (ndossche) diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index edcaf689ab7f..defc3b9942ae 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -134,17 +134,13 @@ static int zend_file_cache_flock(int fd, int type) (ptr) = (void*)((char*)buf + (size_t)(ptr)); \ } \ } while (0) + #define SERIALIZE_STR(ptr) do { \ if (ptr) { \ if (IS_ACCEL_INTERNED(ptr)) { \ (ptr) = zend_file_cache_serialize_interned((zend_string*)(ptr), info); \ } else { \ ZEND_ASSERT(IS_UNSERIALIZED(ptr)); \ - /* script->corrupted shows if the script in SHM or not */ \ - if (EXPECTED(script->corrupted)) { \ - GC_ADD_FLAGS(ptr, IS_STR_INTERNED); \ - GC_DEL_FLAGS(ptr, IS_STR_PERMANENT); \ - } \ (ptr) = (void*)((char*)(ptr) - (char*)script->mem); \ } \ } \ @@ -163,6 +159,7 @@ static int zend_file_cache_flock(int fd, int type) GC_ADD_FLAGS(ptr, IS_STR_INTERNED); \ GC_DEL_FLAGS(ptr, IS_STR_PERMANENT); \ } \ + GC_DEL_FLAGS(ptr, IS_STR_CLASS_NAME_MAP_PTR); \ } \ } \ } while (0) From f4bd90825956bf10b9b85c94ddb1c483dee9a3db Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Thu, 6 Nov 2025 14:15:56 +0100 Subject: [PATCH 2/3] [skip ci] Relax Zend/tests/concat_003.phpt This test frequently fails in CI, where it took 1.3s, including a repeat due to being marked as flaky. Bump this limit with a generous margin. --- Zend/tests/concat_003.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/tests/concat_003.phpt b/Zend/tests/concat_003.phpt index dc22bae1a720..52594dffcfd2 100644 --- a/Zend/tests/concat_003.phpt +++ b/Zend/tests/concat_003.phpt @@ -11,7 +11,7 @@ if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test"); $time = microtime(TRUE); /* This might vary on Linux/Windows, so the worst case and also count in slow machines. */ -$t_max = 1.0; +$t_max = 2.0; $datas = array_fill(0, 220000, [ '000.000.000.000', From db8c331d07bf644e61361487c4acd1a84f0677a9 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+ndossche@users.noreply.github.com> Date: Thu, 6 Nov 2025 18:49:23 +0100 Subject: [PATCH 3/3] array_unshift: Add fast optimized case for packed arrays (#20353) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Packed arrays are likely common in this case, as with array_shift which already has a similar optimization. For the following benchmark: ```php