[php-src] Issue #15579: ReflectionClass::getParent() returns false on interfaces that extend another interface

From: Date: Sun, 25 Aug 2024 02:19:17 +0000
Subject: [php-src] Issue #15579: ReflectionClass::getParent() returns false on interfaces that extend another interface
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247587@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15579 Author: bkdotcom ### Description The following code: https://3v4l.org/Hio9E#v8.3.10 ```php <?php // example 1: PHP Predefined Interface $refClass = new ReflectionClass('Throwable'); $parentRef = $refClass->getParentClass(); echo $parentRef ? $parentRef->getName() : 'false'; echo "\n"; var_dump($refClass->getInterfaceNames()); // example 2 : userland interface interface Foo extends Bar { } interface Bar { } $refClass = new ReflectionClass('Foo'); $parentRef = $refClass->getParentClass(); echo $parentRef ? $parentRef->getName() : 'false'; echo "\n"; var_dump($refClass->getInterfaceNames()); ``` Resulted in this output: ``` false <-- this is the wrong array( 0 => string 'Stringable' (length=10) ) false <-- this is the wrong array( 0 => string 'Bar' (length=3) ) ``` But I expected this output instead: ``` Stringable array( 0 => string 'Stringable' (length=10) ) Stringable array( 0 => string 'Bar' (length=3) ) ``` ### PHP Version PHP 8.3.10 ### Operating System OSX & 3v4l.org

« previous php.bugs (#247587) next »