Bug #73067 [Opn->Csd]: __debugInfo crashes when throwing an exception

From: Date: Tue, 13 Sep 2016 02:59:52 +0000
Subject: Bug #73067 [Opn->Csd]: __debugInfo crashes when throwing an exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203990@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73067&edit=1 ID: 73067 Updated by: laruence@php.net Reported by: martin dot smeeckaert at gmail dot com Summary: __debugInfo crashes when throwing an exception -Status: Open +Status: Closed Type: Bug Package: Reproducible crash Operating System: Ubuntu 16.04 PHP Version: 7.0.10 Block user comment: N Private report: N New Comment: 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) Previous Comments: ------------------------------------------------------------------------ [2016-09-12 15:37:25] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73067&edit=1

« previous php.bugs (#203990) next »