I will start by writing that I did see similar questions, and I did try the suggested solutions.
我将从写作开始,我确实看到了类似的问题,我确实尝试了建议的解决方案。
I am running a cli, when I purposely put a parse error in the php file, I get no error in stdOut.
I am using the below configurations:
22527 for error_reporting isini_set('error_reporting', E_ALL|E_STRICT);
我正在运行一个cli,当我故意在php文件中输入一个解析错误时,我在stdOut中没有得到任何错误。我使用以下配置:22527 for error_reporting是ini_set('error_reporting',E_ALL | E_STRICT);
PHP 5.5.20 (cli) (built: Jan 9 2015 11:20:56)
php -i | grep error
display_errors => STDOUT => STDOUT
display_startup_errors => Off => Off
error_append_string => no value => no value
error_log => no value => no value
error_prepend_string => no value => no value
error_reporting => 22527 => 22527
html_errors => Off => Off
ignore_repeated_errors => Off => Off
log_errors => Off => Off
log_errors_max_len => 1024 => 1024
track_errors => Off => Off
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
ADDITION: If I add my own fatal handler:
附加:如果我添加自己的致命处理程序:
function fatal_handler() {
$error = error_get_last();
if ($error !== null) {
echo ("\n\nERROR occured!\nFile [{$error['file']}].\nLine: [{$error['line']}].\nMessage: [{$error['message']}]\n\n");
}
exit(1);
}
register_shutdown_function("fatal_handler");
I do get to see the error in stdio.
我确实看到了stdio中的错误。
Below is an example to a code (with parse error) that does not produce errors for me
下面是一个代码(带解析错误)的示例,它不会给我带来错误
class A{
const AAA = 'aaa';
static public function Result(A::AAA){
}
}
1 个解决方案
#1
0
The error_reporting => 22527 => 22527
is equivalent to E_ALL & ~E_DEPRECATED & ~E_STRICT
.
error_reporting => 22527 => 22527相当于E_ALL&~E_DEPRECATED&~E_STRICT。
Use -1
or E_ALL
error level (E_ALL | E_STRICT
in PHP 5.4) to show all errors.
使用-1或E_ALL错误级别(PHP 5.4中的E_ALL | E_STRICT)来显示所有错误。
Set it in the ini file php.ini
.
将它设置在ini文件php.ini中。
error_reporting = -1
The following won't work, because the code contains a parse error so the ini_set()
never gets called.
以下操作无效,因为代码包含解析错误,因此永远不会调用ini_set()。
<?php
ini_set('error_reporting', -1)
class A
{
const AAA = 'aaa';
static public function Result(A::AAA)
{
}
}
#1
0
The error_reporting => 22527 => 22527
is equivalent to E_ALL & ~E_DEPRECATED & ~E_STRICT
.
error_reporting => 22527 => 22527相当于E_ALL&~E_DEPRECATED&~E_STRICT。
Use -1
or E_ALL
error level (E_ALL | E_STRICT
in PHP 5.4) to show all errors.
使用-1或E_ALL错误级别(PHP 5.4中的E_ALL | E_STRICT)来显示所有错误。
Set it in the ini file php.ini
.
将它设置在ini文件php.ini中。
error_reporting = -1
The following won't work, because the code contains a parse error so the ini_set()
never gets called.
以下操作无效,因为代码包含解析错误,因此永远不会调用ini_set()。
<?php
ini_set('error_reporting', -1)
class A
{
const AAA = 'aaa';
static public function Result(A::AAA)
{
}
}