preg_replace 期间的 PHP 段错误

标签 php magento zend-framework crash

我正在使用 Magento 并在管理员回滚数据库期间遇到 PHP 段错误。我做了调查,发现原因是这样的:

preg_replace("/'(\\'|\\\\{2}|[^'])*'/", '', $sql);

$sql 字符串足够大,我正在附加它。

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

您可以使用这样的脚本来重现问题:

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

可能有人知道这个问题,可以帮我解决吗?

附言直接导致问题的类是抽象类Zend_Db_Statement 204:208

最佳答案

我自己一直在努力解决这个问题,偶然发现了这个建议更改 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

对我来说就像一个魅力。希望这对您有所帮助!

编辑:也提供方便的 .htaccess 格式:

php_value pcre.recursion_limit 1000

关于preg_replace 期间的 PHP 段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20750757/

相关文章:

php - pdfparser说: 'Secured pdf file are currently not supported.' [closed]

php - JSON 和 PHP 问题

php - 使用 PHP 脚本在 Magento 中更新全局价格时如何舍入数字?

php - 仅支持的密码是 AES-128-CBC 和 AES-256-CBC 错误

php - 拉维尔 5 : Why can't I use integers and floating point numbers in the language files?

forms - 如何在 Magento 中的表单提交错误后预先填写自定义表单?

magento - 在 Magento 中按类别筛选热门产品

php - 是否可以使用 unix 套接字连接 zf1 和 memcached?

php - MySQL 查询 - 选择所有帖子并计算每个帖子的评论

php - 使用define()存储数据库连接详细信息是好是坏?