APCuIterator:Could not compile regular expression

Sometimes I get a "HTTP ERROR 500" on loading a page.

The first time it happened the very first load of the website. Looking in the log the error is:

PHP Fatal error:  APCuIterator::__construct(): Could not compile regular expression: [bdb9e21fd62195c66628e3356990c7b9::bdb9e21fd62195c66628e3356990c7b9::sp::stash_default::dic::di\\definition\\group_tools::*] in /vendor/tedivm/stash/src/Stash/Driver/Apc.php on line 123, referer: https://mydomain/admin

if I comment line 123 it can load the page. And everything goes on then even if I decomment the line 123. But sometime the error returns, always when I flush the cache.

It also works if I leave

$it = new \APCUIterator('user',$keyRegex, \APC_ITER_KEY, $chunkSize);


instead of 

$it = $this->apcu ? new \APCUIterator($keyRegex, \APC_ITER_KEY, $chunkSize) : new \APCIterator('user', $keyRegex, \APC_ITER_KEY, $chunkSize);

I cannot figure out how to set up the problem, can you help me, please?


  • Never tried APC but maybe a new release of vendor can fix this issue.

    Try to test it: replace a new version with existing vendor\tedivm\stash\

  • Hello,

    I encounter the same error on a brand new install of Elgg 3.1.3 (Ubuntu 18.04, PHP 7.2, nginx) :

    Fatal error: APCuIterator::__construct(): Could not compile regular expression: [410dddb3a669b6e51a8398f10329061f::410dddb3a669b6e51a8398f10329061f::sp::stash_default::dic::di\definition\logger::*] in /Datastore/www/php72/esope_3.1/vendor/tedivm/stash/src/Stash/Driver/Apc.php on line 124

    The error appeared after upgrading from a brand new 3.1.2 install (which broke because of the DB bug corrected in 3.1.3), from zip packaged version.

    I also read https://elgg.org/discussion/view/2740445/cli-composer-install-issue and particularly https://github.com/Elgg/Elgg/issues/12289 and made some tests with various Stash versions (original packaged tedivm Stash version (0.14), but also with latest version 0.15.1).

    It also works if i comment line 123 in Stash.php, but that is not a sustainable option... i still can't figure what's happening?

    Any other feedbacks or information on this ?