Bug #75954 [NEW]: E_RECOVERABLE_ERROR Not Caught

From: Date: Tue, 13 Feb 2018 02:27:14 +0000
Subject: Bug #75954 [NEW]: E_RECOVERABLE_ERROR Not Caught
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213932@lists.php.net to get a copy of this message
From:             johnpaulwallway at gmail dot com
Operating system: Linux: 14.04.5 LTS, Trusty Tahr
PHP version:      7.0.27
Package:          *General Issues
Bug Type:         Bug
Bug description:E_RECOVERABLE_ERROR Not Caught

Description:
------------
E_RECOVERABLE_ERROR halts the interpreter. While shutdown_function is
called, one cannot handle framework shutdown, responses, and logging in
an appropriate manner.

E_RECOVERABLE_ERROR should be catchable by a catch( Throwable $t) or
catch(ERROR $e), and finally blocks _must_ be executed.

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

$x = new stdClass();
try {
	echo $x;
} catch (Throwable $t) {
	echo "Yeah, we couldn't convert that to a string. Log error and respond
to client's request";
	echo $t->__toString();
} finally {
	echo "Seriously? I must be wrong";
}

Expected result:
----------------
Something like:
Yeah, we couldn't convert that to a string. Log error and respond to
client's request.

E_RECOVERABLE_ERROR: Object of class stdClass could not be converted to
string

Seriously? I must be wrong



Actual result:
--------------
PHP Catchable fatal error:  Object of class stdClass could not be
converted to string in /tmp/foo.php on line 5
PHP Stack trace:
PHP   1. {main}() /tmp/foo.php:0

Catchable fatal error: Object of class stdClass could not be converted
to string in /tmp/foo.php on line 5

-- 
Edit bug report at https://bugs.php.net/bug.php?id=75954&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=75954&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=75954&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=75954&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=75954&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=75954&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=75954&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=75954&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=75954&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=75954&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=75954&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=75954&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=75954&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=75954&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75954&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=75954&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=75954&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=75954&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75954&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=75954&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=75954&r=mysqlcfg



Thread (5 messages)

« previous php.bugs (#213932) next »