Bug #73067 [NEW]: __debugInfo crashes when throwing an exception
| From: | martin dot smeeckaert at gmail dot com | Date: | Mon, 12 Sep 2016 15:37:27 +0000 |
| Subject: | Bug #73067 [NEW]: __debugInfo crashes when throwing an exception | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-203974@lists.php.net to get a copy of this message | ||
From: martin dot smeeckaert at gmail dot com
Operating system: Ubuntu 16.04
PHP version: 7.0.10
Package: Reproducible crash
Bug Type: Bug
Bug description:__debugInfo crashes when throwing an exception
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
--
Edit bug report at https://bugs.php.net/bug.php?id=73067&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73067&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73067&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73067&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73067&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73067&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73067&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73067&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73067&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73067&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73067&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73067&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73067&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73067&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73067&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73067&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73067&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73067&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73067&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73067&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73067&r=mysqlcfg