Bug #75242 [Opn->Csd]: RecursiveArrayIterator doesn't have constants from parent class

From: Date: Fri, 22 Dec 2017 17:12:33 +0000
Subject: Bug #75242 [Opn->Csd]: RecursiveArrayIterator doesn't have constants from parent class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213246@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75242&edit=1 ID: 75242 Updated by: nikic@php.net Reported by: kukulich at kukulich dot cz Summary: RecursiveArrayIterator doesn't have constants from parent class -Status: Open +Status: Closed Type: Bug Package: Reflection related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=ec142f2c86c28b970aef631a5750f6a02b954089 Log: Fixed bug #75242 Previous Comments: ------------------------------------------------------------------------ [2017-09-21 21:07:20] kukulich at kukulich dot cz Description: ------------ RecursiveArrayIterator doesn't have constants from parent class See https://3v4l.org/7fVc4 Test script: --------------- <?php class Foo extends \ArrayIterator { } $fooReflection = new \ReflectionClass(\Foo::class); $recursiveArrayIteratorReflection = new \ReflectionClass(\RecursiveArrayIterator::class); printf("%d constants in %s, ", count($fooReflection->getConstants()), \Foo::class); if ($fooReflection->getParentClass()) { printf("%s extends %s\n", Foo::class, $fooReflection->getParentClass()->getName()); } printf("%d constants in %s, ", count($recursiveArrayIteratorReflection->getConstants()), \RecursiveArrayIterator::class); if ($recursiveArrayIteratorReflection->getParentClass()) { printf("%s extends %s\n", \RecursiveArrayIterator::class, $recursiveArrayIteratorReflection->getParentClass()->getName()); } printf("%d constants in %s\n", count((new \ReflectionClass(\ArrayIterator::class))->getConstants()), \ArrayIterator::class); Expected result: ---------------- 2 constants in Foo, Foo extends ArrayIterator 3 constants in RecursiveArrayIterator, RecursiveArrayIterator extends ArrayIterator 2 constants in ArrayIterator Actual result: -------------- 2 constants in Foo, Foo extends ArrayIterator 1 constants in RecursiveArrayIterator, RecursiveArrayIterator extends ArrayIterator 2 constants in ArrayIterator ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75242&edit=1

« previous php.bugs (#213246) next »