Home  >  Article  >  Backend Development  >  Problems with preg_replace function under PHP5.2_PHP tutorial

Problems with preg_replace function under PHP5.2_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:36:31822browse

preg_replace uses more bytes than the default allowed by php5.2
That is, the size of pcre.backtrack_limit and pcre.recursion_limit is an issue.

Since the official version of Discuz! 6.0.0 was released, everyone has been busy upgrading, but some plug-ins have problems under 6.0
For example, http://www.discuz.net/viewthread.php?tid= 559133 This bank plug-in
will cause a white screen problem after installation in an environment with PHP 5.2.0 and above
From the perspective of Discuz! users, we need to assist the plug-in author to solve this problem

The following is my solution process, I hope I can give you some suggestions


First: This plug-in can run normally under 5.5, but the screen will be white under 6.0
Discuz! In order to increase the readability of template cache files, 6.0 has increased the indentation of cache files. , and the template processing part of some templates.func.php has indeed been modified.
Is this the reason? At first, I initially determined that the problem was here, because after replacing the modified code with part of the 5.5 code, it behaved normally, but I was very depressed and could not find the reason

Second step: I suspected that it was a problem with the writing format of the bank.htm template, so I started to analyze the template very depressedly. To be honest, it was really a headache to analyze the template when it was so big. Apparently no reason was found. It’s more depressing

Second step: Then I found that after splitting this template, it was executed normally. At this time, I initially suspected whether the regular matching bug caused an error when the amount of data was large, so I went to bugs.php. net started searching http://bugs.php.net/search.php?c... ace&x=3&y=5. I searched and searched here, and finally found http://bugs.php.net/bug. php?id=39405, suddenly found that it was a problem with the 5.2 configuration. After adjusting the pcre.backtrack_limit and pcre.recursion_limit, the problem was solved

The reason I write this in detail is to share my ideas for solving the problem:)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508224.htmlTechArticlepreg_replace uses more than the bytes allowed by php5.2 by default, which is the size of pcre.backtrack_limit and pcre.recursion_limit problem. Since the official release of Discuz! 6.0.0 program, everyone...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn