PHP Segmentation fault during preg_replace

fre*_*nto 4 php crash zend-framework magento

I'm using Magento and got PHP Segmentation fault during rollback database from admin. I make and investigation and see that the reason is such line:

preg_replace("/'(\\'|\\\\{2}|[^'])*'/", '', $sql);
Run Code Online (Sandbox Code Playgroud)

$sql string is big enough, I'm attaching it.

https://drive.google.com/file/d/0B9UbKYbywcABOTRSVG5KRl9La0k/edit?usp=sharing

You may use such script to reproduce the problem:

<?php
    $test = file_get_contents('test.txt');
    $sql = preg_replace("/'(\\'|\\\\{2}|[^'])*'/", '', $test);
Run Code Online (Sandbox Code Playgroud)

May be somebody knows about this problem and can help me to solve it?

P.S. Class that directly causes the problem is abstract class Zend_Db_Statement 204:208

bah*_*hoo 5

我自己一直在为此苦苦挣扎,并偶然发现了这个建议更改 php.ini 值的线程:

http://zend-framework-community.634137.n4.nabble.com/Fixing-Zend-Db-Statement-stripQuoted-seg-faults-on-large-SQL-strings-in-ZF-1-x-td4648143。 html

[PCRE]
pcre.recursion_limit = 1000
Run Code Online (Sandbox Code Playgroud)

对我来说就像一种魅力。希望这可以帮助!

编辑:也可以使用方便的 .htaccess 格式:

php_value pcre.recursion_limit 1000
Run Code Online (Sandbox Code Playgroud)