preg_match_all 崩溃/错误?
好的,我的脚本已经至少 3 个月没有变化了。代码根本没有被修改过。我的服务器(VPS)也没有被修改。但现在不知从何而来,大约 24 小时前开始,脚本中的一行导致页面/脚本超时/崩溃(大约 30 秒后出现白页)。
有问题的代码行是这样的:
$string = preg_match_all('/\[img\]([^\'"\[\]]+)\[\/img\]/is', substr($pag['page_text'], 0, 1024), $matches);
如果我注释掉该行,则页面加载正常。问题是该行对于页面至关重要。有谁知道为什么 preg_match_all 函数会导致页面崩溃?特别是因为我没有更改服务器或脚本上的任何内容..
Okay, so I have this script that has been the same for at least 3 months now. The code hasn't been modified at all. Nor has my server (VPS) been modified either. But now out of nowhere, started about 24 hours ago, a line in the script is causing the page/script to timeout/crash (white page after about 30 seconds).
The line of code in question is this:
$string = preg_match_all('/\[img\]([^\'"\[\]]+)\[\/img\]/is', substr($pag['page_text'], 0, 1024), $matches);
If I comment that line out the page loads fine. The thing is that line is critical to the page. Does anyone know why the preg_match_all function would cause a page to crash? Especially since I haven't changed anything on the server or script..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
字符串的大小和正则表达式捕获可能会影响您的内存限制。
The size of the string and the regex capturing might be affecting your memory_limit.