记遇到的一个php坑

2018-06-22 05:39:46来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

最近对项目的一个高访问量业务接口进行功能扩展,上线一段时间后,服务器cpu load突然飙升,并出现大量502。一开始找运维查看日志,并没有看是什么问题,后来发现别的部门项目之前也遇到类似的问题,原来是触发了一个php bug。此bug触发条件是:PHP版本低于5.6.12、开启opcache、高访问量、定义 const 常量并且为二维数组,刚好满足这些条件,真心泪奔。。升级服务器上面的PHP版本之后,就没有再出现了。重启php-fpm,可以一段时间内不会出现502,应急处理之用。

php bug:https://bugs.php.net/bug.php?id=70601

const
            REPLACEMENTS_PASS_1 = [
        	"\x00" => "", "\x01" => "", "\x02" => "", "\x03" => "", 
		"\x04" => "", "\x05" => "", "\x06" => "", "\x07" => "", 
		"\x08" => "", "\x0B" => "", "\x0C" => "", "\x0D" => "", 
		"\x0E" => "", "\x0F" => "", "\x10" => "", "\x11" => "", 
		"\x12" => "", "\x13" => "", "\x14" => "", "\x15" => "", 
		"\x16" => "", "\x17" => "", "\x18" => "", "\x19" => "", 
		"\x1A" => "", "\x1B" => "", "\x1C" => "", "\x1D" => "", 
		"\x1E" => "", "\x1F" => "", "\x7F" => "",
    ];
	
	public function __construct() {
		echo strtr("abcd", self::REPLACEMENTS_PASS_1);
	}

  

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:tp5 接入腾讯对象存储COS

下一篇:浅谈HTTP中GET和POST请求方式的区别