User tests: Successful: Unsuccessful:
Partial Pull Request for Issue #16584
PHP 7.2 deprecates the track_errors
INI configuration and the scoped $php_errormsg
variable in favor of using the error_get_last()
function for retrieving error data, and at PHP 7.0 using error_clear_last()
to clear any errors (to my knowledge we aren't doing anything in core requiring the latter at the moment).
This PR phases out this deprecated functionality for the HTTP and Language packages.
The packages should still function normally, including error handling (easiest way to test error handling is enable debug mode and language debug and break one of the language files with a parsing error).
Category | ⇒ | Libraries |
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
I suggest to use
error_clear_last
.
How reliable is the polyfill for error_clear_last()
?. error_clear_last()
was only introduced in PHP 7.0 so we need to polyfill it until 4.0.
Or you can remember the previous error message before line error_reporting(E_ALL)
and compare it to the last one at the bottom. I assumed that error messages are unique:)
This is my test.
$ php -a
Interactive mode enabled
php > echo $e;
PHP Notice: Undefined variable: e in php shell code on line 1
php > $handler = function() { return false;};
php > set_error_handler($handler);
php > @trigger_error('');
php > restore_error_handler();
php > print_r(error_get_last());
Array
(
[type] => 1024
[message] =>
[file] => php shell code
[line] => 1
)
php > echo phpversion();
7.1.12-3+ubuntu16.04.1+deb.sury.org+1
Eh, maybe later.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-07-21 02:35:30 |
Closed_By | ⇒ | mbabker |
I suggest to use
error_clear_last
.For test I removed the first double quote character from com_content language file.
Before patch:
After patch: