View Issue Details

IDProjectCategoryView StatusLast Update
0001758XdebugUncategorizedpublic2020-03-13 16:40
Reporteralenore Assigned Toderick  
Status closedResolutionfixed 
Product Version2.9.2 
Target Version2.9.3Fixed in Version2.9.3 
Summary0001758: Xdebug changes error_get_last results inside a try catch

When an error is caught in a try statement (since PHP 7.x), PHP doesn't update the last_error_message, last_error_file, last_error_type, and last_error_lineno variables.
error_get_last() would just return null in this case.

However, when Xdebug is installed, these variables get replaced before the error_handling is checked, and populate the variables even if it shouldn't

It's happening in 2.8.1, 3.0.0-dev and 2.9.2.

Steps To Reproduce

Install php7.4, enable Xdebug, then execute this script. It should display "true" (error_get_last return null), but display "false" (the error from our incorrect DateTime format).

register_shutdown_function(function () {

try {
new DateTime('Incorrect value');
} catch (Exception $e) { }

Operating System
PHP Version7.4.0-7.4.4



2020-03-12 14:28

administrator   ~0005285

It looks like this has changed in PHP itself between PHP 7.2 and PHP 7.3 (notice the -n, which means Xdebug isn't loaded):

derick@gargleblaster:~/dev/php/derickr-xdebug$ pe 7.2dev; php -n tests/base/bug01758.phpt
array(4) {
string(137) "DateTime::__construct(): Failed to parse time string (Incorrect value) at position 0 (I): The timezone could not be found in the database"
string(60) "/home/derick/dev/php/derickr-xdebug/tests/base/bug01758.phpt"
derick@gargleblaster:~/dev/php/derickr-xdebug$ pe 7.3dev; php -n tests/base/bug01758.phpt

Issue History

Date Modified Username Field Change
2020-03-06 17:31 alenore New Issue
2020-03-06 17:31 alenore Tag Attached: error_get_last
2020-03-12 14:28 derick Note Added: 0005285
2020-03-12 16:09 derick Status new => assigned
2020-03-12 16:09 derick Target Version => 2.9.3
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized
2020-03-13 16:40 derick Assigned To => derick
2020-03-13 16:40 derick Status assigned => closed
2020-03-13 16:40 derick Resolution open => fixed
2020-03-13 16:40 derick Fixed in Version => 2.9.3