php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73067 __debugInfo crashes when throwing an exception
Submitted: 2016-09-12 15:37 UTC Modified: 2016-10-17 19:30 UTC
From: martin dot smeeckaert at gmail dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 7.0.10 OS: Ubuntu 16.04
Private report: No CVE-ID: None
 [2016-09-12 15:37 UTC] martin dot smeeckaert at gmail dot com
Description:
------------
I'm using php 7.0.8 on Ubuntu 16.04 and I came across a strange bug, if an exception is thrown in the __debugInfo call, it will result in a fatal error no matter what you do.

PHP expect __debugInfo to return an array but it is impossible because of the exception.

Test script:
---------------
<?php

class Debug
{
    public function __debugInfo()
    {
        throw new Exception("Test Crash");
    }
}

try {
    var_dump(new Debug());
} catch (Exception $e) {
   echo $e->getMessage();
}

Expected result:
----------------
> "Test Crash"

Actual result:
--------------
PHP Warning:  Uncaught Exception: Test Crash in .../BugDebugInfo.php:7
Stack trace:
#0 [internal function]: Debug->__debugInfo()
#1 .../BugDebugInfo.php(12): var_dump(Object(Debug))
#2 {main}
  thrown in .../BugDebugInfo.php on line 7
PHP Fatal error:  __debuginfo() must return an array in .../BugDebugInfo.php on line 12


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-13 02:59 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2d8ab51576695630a7471ff829cc5ea10becdc0f
Log: Fixed bug #73067 (__debugInfo crashes when throwing an exception)
 [2016-09-13 02:59 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-10-11 09:31 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c9f639a1df068976a841e9b5624d2f5d5d9c7c7
Log: Revert &quot;Fixed bug #73067 (__debugInfo crashes when throwing an exception)&quot;
 [2016-10-11 10:47 UTC] derick@php.net
-Status: Closed +Status: Re-Opened
 [2016-10-11 10:48 UTC] derick@php.net
The original fix broke expected behaviour in PHP. Discussion at http://news.php.net/php.internals/96304
 [2016-10-11 23:52 UTC] stas@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c9f639a1df068976a841e9b5624d2f5d5d9c7c7
Log: Revert &quot;Fixed bug #73067 (__debugInfo crashes when throwing an exception)&quot;
 [2016-10-11 23:52 UTC] stas@php.net
-Status: Re-Opened +Status: Closed
 [2016-10-12 14:26 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c9f639a1df068976a841e9b5624d2f5d5d9c7c7
Log: Revert &quot;Fixed bug #73067 (__debugInfo crashes when throwing an exception)&quot;
 [2016-10-14 02:23 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c9f639a1df068976a841e9b5624d2f5d5d9c7c7
Log: Revert &quot;Fixed bug #73067 (__debugInfo crashes when throwing an exception)&quot;
 [2016-10-17 10:07 UTC] bwoebi@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c9f639a1df068976a841e9b5624d2f5d5d9c7c7
Log: Revert &quot;Fixed bug #73067 (__debugInfo crashes when throwing an exception)&quot;
 [2016-10-17 10:08 UTC] bwoebi@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2d8ab51576695630a7471ff829cc5ea10becdc0f
Log: Fixed bug #73067 (__debugInfo crashes when throwing an exception)
 [2016-10-17 11:33 UTC] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fe166ffe539516cb438db5b85b5f131f21b25e72
Log: Revert &quot;Fixed bug #73067 (__debugInfo crashes when throwing an exception)&quot;
 [2016-10-17 13:22 UTC] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6091873d4af0d0c5f187abf92e701ccb76d0a8b8
Log: Revert &quot;Fixed bug #73067 (__debugInfo crashes when throwing an exception)&quot;
 [2016-10-17 16:13 UTC] andrey@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6091873d4af0d0c5f187abf92e701ccb76d0a8b8
Log: Revert &quot;Fixed bug #73067 (__debugInfo crashes when throwing an exception)&quot;
 [2016-10-17 19:30 UTC] ab@php.net
-Status: Closed +Status: Re-Opened
 [2016-10-25 15:21 UTC] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6091873d4af0d0c5f187abf92e701ccb76d0a8b8
Log: Revert &quot;Fixed bug #73067 (__debugInfo crashes when throwing an exception)&quot;
 [2016-10-25 15:21 UTC] krakjoe@php.net
-Status: Re-Opened +Status: Closed
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jan 20 23:01:25 2020 UTC