|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-11-06 01:32 UTC] marcio@php.net
[2015-11-06 03:39 UTC] laruence@php.net
[2015-11-06 03:39 UTC] laruence@php.net
-Status: Open
+Status: Closed
[2015-11-09 18:12 UTC] ab@php.net
[2016-07-20 11:35 UTC] davey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ It seems there is a conflict when reusing patters while PCRE JIT is enabled, causing a segfault. It's an obscure bug that I couldn't find a solution and had to disable PCRE JIT to get things working. These are the (strange) requirements to reproduce the segfault: 1) code MUST be namespaced; 2) code must be run on a non debug build; 3) a preg_replace call must happen while iterating over a regex iterator or derivated; 4) both the preg_replace and the regex iterator instance involved must have the exact same regexp patter; The test script may be easier to understand. Requirement 1 is really a mystery to me :/ Test script: --------------- <?php namespace X; $iterator = new \RegexIterator( new \ArrayIterator(['A.phpt', 'B.phpt', 'C.phpt']), '/\.phpt$/' ) ; foreach ($iterator as $foo) { var_dump($foo); preg_replace('/\.phpt$/', '', ''); } echo "Done", PHP_EOL; ?> Expected result: ---------------- No segfault. Actual result: -------------- Segfault.