Bug #78239 [Opn]: set_error_handler() blocked

From: Date: Tue, 02 Jul 2019 10:26:12 +0000
Subject: Bug #78239 [Opn]: set_error_handler() blocked
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221578@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78239&edit=1

 ID:                 78239
 Updated by:         cmb@php.net
 Reported by:        cxlblm at gmail dot com
 Summary:            set_error_handler() blocked
 Status:             Open
 Type:               Bug
 Package:            Reflection related
 Operating System:   Linux 788f0b0a7ad1 4.9.125-linux
 PHP Version:        7.4.0alpha2
 Block user comment: N
 Private report:     N

 New Comment:

Last line should be

  $r->getReturnType()->getName();


Previous Comments:
------------------------------------------------------------------------
[2019-07-02 10:21:44] cxlblm at gmail dot com

I'm sorry! I lost some code
(string)$r->getReturnType() ?: "";

------------------------------------------------------------------------
[2019-07-02 10:14:01] nikic@php.net

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:06:04] cxlblm at gmail dot com

Description:
------------
Deprecated: Function ReflectionType::__toString() is deprecated  with set_error_handler blocked

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

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

set_error_handler('handleError');

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

$r = new ReflectionMethod("A", "abc");
(string)$r->getReturnType();



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78239&edit=1


Thread (10 messages)

« previous php.bugs (#221578) next »