[英]PHP preg_match stops responding at certain number of characters in string
是否有某種PHP配置設置會影響傳遞給preg_match或preg_match_all的字符串的長度?
我嘗試測試以下內容,以找出問題所在:
$re = "/\[\[section\:(.*?)\]\]((.|\n)*?)\[\[endsection\]\]/";
$str = "[[section:body]]
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
lots of lines here
[[endsection]]
other stuff here";
preg_match_all($re, $str, $matches);
var_dump($matches);
現在,如果我運行正常,它將立即返回結果。
但是,如果我再向$ str變量添加一行並再次運行它,它只會旋轉,然后我無法顯示網頁。
但是,如果我隨后在writecodeonline.com/php上運行完全相同的操作,它將正常工作並立即返回。
我的php錯誤日志或apache錯誤日志中沒有任何錯誤,一旦擊中某些字符,它只是拒絕執行任何操作(似乎擊中707個字符后,它將停止響應。
有人遇到過這種問題嗎? 這只是我需要更改的一些配置設置嗎?
干杯。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.