|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78239 Deprecation notice during string conversion converted to exception hangs
Submitted: 2019-07-02 10:06 UTC Modified: 2019-07-03 08:57 UTC
From: cxlblm at gmail dot com Assigned:
Status: Closed Package: Reflection related
PHP Version: 7.4.0alpha2 OS: Linux 788f0b0a7ad1 4.9.125-linux
Private report: No CVE-ID: None
 [2019-07-02 10:06 UTC] cxlblm at gmail dot com
Deprecated: Function ReflectionType::__toString() is deprecated  with set_error_handler blocked

Test script:

function handleError($level, $message, $file = '', $line = 0, $context = [])
    throw new ErrorException($message, 0, $level, $file, $line);


class A
    public function abc(): bool
        return false;

$r = new ReflectionMethod("A", "abc");


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-07-02 10:14 UTC]
-Status: Open +Status: Feedback
 [2019-07-02 10:14 UTC]
What is the bug? I get:

Fatal error: Uncaught ErrorException: Function ReflectionType::__toString() is deprecated in /home/nikic/php-7.4/t077.php:20
Stack trace:
#0 /home/nikic/php-7.4/t077.php(20): handleError(8192, 'Function Reflec...', '/home/nikic/php...', 20, Array)
#1 {main}
  thrown in /home/nikic/php-7.4/t077.php on line 20

Which looks correct to me.
 [2019-07-02 10:21 UTC] cxlblm at gmail dot com
-Status: Feedback +Status: Open
 [2019-07-02 10:21 UTC] cxlblm at gmail dot com
I'm sorry! I lost some code
(string)$r->getReturnType() ?: "";
 [2019-07-02 10:26 UTC]
Last line should be

 [2019-07-02 13:17 UTC] cxlblm at gmail dot com
Sorry, My english is terrible. Above code will worked with Exception, but now blocked!
 [2019-07-03 07:54 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2019-07-03 07:54 UTC]
As of PHP 7.4.0, ReflectionType::__toString() generates a
deprecation notice[1], which is caught by your error handler.
This is expected behavior.

If you do not get a similar output as posted by,
please re-open this ticket, and post the output you have got.


[1] <>
 [2019-07-03 08:13 UTC] cxlblm at gmail dot com
Please see this url:
error: Process exited with code 137.
 [2019-07-03 08:35 UTC]
-Status: Not a bug +Status: Re-Opened -Assigned To: cmb +Assigned To:
 [2019-07-03 08:35 UTC]
Thanks!  This is indeed unexpected.  I cannot reproduce, though.
 [2019-07-03 08:42 UTC]
-Status: Re-Opened +Status: Verified
 [2019-07-03 08:42 UTC]
Confirming hang with the ?: "" at the end.
 [2019-07-03 08:57 UTC]
-Summary: set_error_handler() blocked +Summary: Deprecation notice during string conversion converted to exception hangs
 [2019-07-03 09:00 UTC]
Automatic comment on behalf of
Log: Fixed bug #78239
 [2019-07-03 09:00 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon May 29 01:03:39 2023 UTC