|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-10-24 08:51 UTC] kalle@php.net
-Summary: Modifying a cached value while using APCUIterator
Causes Segmentation Fault
+Summary: APCu: Modifying a cached value while using
APCUIterator Causes segfault
[2018-01-12 21:15 UTC] sethgrim123 at yahoo dot com
[2018-02-11 20:28 UTC] nikic@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: nikic
[2018-02-11 20:28 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 02:00:01 2025 UTC |
Description: ------------ Changing a cached value with apcu_store after retrieving the key names using APCUIterator seems to cause a Segmentation fault. For example, I found that if I save three values into the APC cache, I could modify the cache via apcu_store as long as I know the key names ahead of time. If I use APCUIterator with a regex to find the key names, then iterated through the entries, a segmentation fault would occur if I tried to adjust the cached value. It will still crash even if I try to save the key names in an array then try to change them outside of the APCUIterator iteration loop. This issue does not seem to happen when reverting back to APCu 5.1.7. Test script: --------------- <?php $keys = array("Test1", "Test2", "Test3"); foreach($keys as $key) { $value = rand(1, 100); apcu_add($key, $value); // set initial values } foreach($keys as $key) { $value = rand(1, 100); apcu_store($key, $value); // this does not cause a crash } $iterator = new APCUIterator('#^Test#', APC_ITER_KEY); foreach ($iterator as $entry) { $key = (string) $entry['key']; apcu_store($key, 0); // this will cause a Segmentation fault with APC 5.1.8 } Expected result: ---------------- The script should run without any errors and ultimately set the APC cache for keys "Test1", "Test2" and "Test3" to 0. Actual result: -------------- With APC 5.1.8, a "Segmentation fault (core dumped)" or "zend_mm_heap corrupted" error will be displayed instead.