View Issue Details

IDProjectCategoryView StatusLast Update
0001288XdebugUncategorizedpublic2016-04-11 19:49
ReporterArjen Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
PlatformLinux 
Product Version2.4.0 
Fixed in Version2.4.1 
Summary0001288: Segfault when uncaught exception message does not contain " in "
Description

A segfault occurs when an uncaught exceptions message does not contain the string ' in '.

Steps To Reproduce

<?php

class React_Exception extends Exception
{
public function __toString()
{
return "Custom message";
return "Custom message in random"; // this does not segfault because of ' in '.
}
}

set_error_handler(function(){ throw new React_Exception('waa');});

$_SERVER['SERVER_PROTOCOL'];

TagsNo tags attached.
Operating System
PHP Version7.0.0-7.0.4

Activities

unreal4u

2016-04-07 15:43

reporter   ~0003578

Last edited: 2016-04-08 07:43

I had no problems with above script on a PHP 7.0.5 machine with xDebug, but my problem is reproducible with the following snippet:

<code>
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);

class myException extends \Exception {
public function __toString() {
return 'my own custom message'; // Produces segfault
return 'my own in house custom message'; // Returns: Fatal error: Uncaught my own in /vagrant/src/test.php on line 18
}
}

try {
throw new myException('Hello world!');
} catch (Exception $e) {
throw new myException('Bye world! (originally: '.$e->getMessage().')');
}
</code>

Effectively, adding " in " in the custom message "solves" the problem, however, notice how the returned message has been stripped, should have been:

Fatal error: Uncaught my own in house custom message in /vagrant/src/test.php on line 18

is:

Fatal error: Uncaught my own in /vagrant/src/test.php on line 18

When disabling display_errors no segfault occurs.

No segfault on latest PHP 5.6 with latest xDebug either, but the displayed uncaught fatal error by xDebug lacks a stacktrace, with or without the " in " part of the custom exception.

derick

2016-04-11 19:49

administrator   ~0003581

Thanks for your report! A fix for this will make it into 2.4.1.

Issue History

Date Modified Username Field Change
2016-03-25 12:27 Arjen New Issue
2016-04-07 15:43 unreal4u Note Added: 0003578
2016-04-08 07:38 unreal4u Note Edited: 0003578
2016-04-08 07:43 unreal4u Note Edited: 0003578
2016-04-11 19:49 derick Note Added: 0003581
2016-04-11 19:49 derick Status new => closed
2016-04-11 19:49 derick Assigned To => derick
2016-04-11 19:49 derick Resolution open => fixed
2016-04-11 19:49 derick Fixed in Version => 2.4.1
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized