J
J
JackShcherbakov2018-03-31 13:52:08
PHP
JackShcherbakov, 2018-03-31 13:52:08

Why are errors displayed when error_reporting is disabled?

Hello colleagues! I recently encountered the following problem:
I turn off error reporting in the current script using the following script:

<?php
$oldLevel = error_reporting(0);

echo RD w3r4 d Brf=s bkporswk "" "da " 
<br>>>
?>

If you turn off the issuance globally, then there will be a notification about the browser, they say, the server cannot process this request or something like that, but for some reason an error is still issued, which in my opinion should not be.
Here is the output:
Parse error: syntax error, unexpected 'w3r4' (T_STRING), expecting ',' or ';' in C:\OpenServer\domains\tests\tests.php on line 4

I would like to thank everyone in advance who will help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-03-31
@JackShcherbakov

Good afternoon.
Because error_reporting(0) turns off error logging. And the value "0" is not correct. Defaults to NULL or takes a constant (several constants.)
And display_errors() disables displaying errors in the browser.
display_errors string
This setting determines whether errors should be displayed with the rest of the output, or whether errors should be hidden from the user.
You can turn off error output like this
Even though display_errors can be set at run time (with the ini_set() function), this has no effect if there are fatal errors in the script. This is due to the fact that the expected actions of the program during execution will not receive control (will not be executed).
Read more here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question