php7 nginx phpfpm 配置中无效的数组索引未失败
Invalid array index not failing in php7 nginx phpfpm configuration
在 php5 机器 运行 apache 和 mod_php 上使用以下代码会导致预期的无效索引错误,但在 php7 nginx 和 phpfpm 上使用它会没有。
<?php
$test = [];
echo $test['hello'];
谁能告诉我为什么?如果有办法告诉 phpfpm php7 实际遵守错误条件?
问题在于,创建与我一起工作的 docker 容器的人在应该 error_reporting=E_ALL & ~E_DEPRICATED & ~E_STRICT
时设置了 error_reporting=E_ERROR
。这可以防止抛出无效索引错误。
在 php5 机器 运行 apache 和 mod_php 上使用以下代码会导致预期的无效索引错误,但在 php7 nginx 和 phpfpm 上使用它会没有。
<?php
$test = [];
echo $test['hello'];
谁能告诉我为什么?如果有办法告诉 phpfpm php7 实际遵守错误条件?
问题在于,创建与我一起工作的 docker 容器的人在应该 error_reporting=E_ALL & ~E_DEPRICATED & ~E_STRICT
时设置了 error_reporting=E_ERROR
。这可以防止抛出无效索引错误。