MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001288XdebugUsage problems (Wrong Results)public2016-03-25 12:272016-04-11 20:49
ReporterArjen 
Assigned Toderick 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSOS Version
Product Version2.4.0 
Target VersionFixed in Version2.4.1 
Summary0001288: Segfault when uncaught exception message does not contain " in "
DescriptionA 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
Attached Files

- Relationships

-  Notes
(0003578)
unreal4u (reporter)
2016-04-07 16:43
edited on: 2016-04-08 08: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.

(0003581)
derick (administrator)
2016-04-11 20:49

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 16:43 unreal4u Note Added: 0003578
2016-04-08 08:38 unreal4u Note Edited: 0003578 View Revisions
2016-04-08 08:43 unreal4u Note Edited: 0003578 View Revisions
2016-04-11 20:49 derick Note Added: 0003581
2016-04-11 20:49 derick Status new => closed
2016-04-11 20:49 derick Assigned To => derick
2016-04-11 20:49 derick Resolution open => fixed
2016-04-11 20:49 derick Fixed in Version => 2.4.1
2016-07-31 13:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 13:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker