Bug #79474 [NEW]: get_declared_classes Wrong loading order Inheritance

From: Date: Tue, 14 Apr 2020 11:50:26 +0000
Subject: Bug #79474 [NEW]: get_declared_classes Wrong loading order Inheritance
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226570@lists.php.net to get a copy of this message
From: ahwelp at universo dot univates dot br Operating system: Linux PHP version: 7.4.4 Package: Class/Object related Bug Type: Bug Bug description:get_declared_classes Wrong loading order Inheritance Description: ------------ The function get_declared_classes() should return the loaded classes in the order they were defined. When a PSR-4 package is required and one class is extended on the local code, the child class is registered before the parent. In PHP7.3 the parent is registered before the child. In PHP7.4x the child is registered before the parent Test script: --------------- #composer require jasonlewis/menu dev-master #Small package, good for testing <?php include 'vendor/autoload.php'; use JasonLewis\Menu\HtmlBuilder; class BootstrapBuilder extends HtmlBuilder{} var_dump(print_r(get_declared_classes(), true)); Expected result: ---------------- Execution on PHP 7.3 string(4086) "Array ( [0] => stdClass [1] => Exception [2] => ErrorException [3] => Error ..... [137] => ComposerAutoloaderInitca7fe8d0414cd934e64e09ae5654bee8 [138] => Composer\Autoload\ClassLoader [139] => Composer\Autoload\ComposerStaticInitca7fe8d0414cd934e64e09ae5654bee8 [140] => JasonLewis\Menu\HtmlBuilder [141] => BootstrapBuilder ) Actual result: -------------- Execution on PHP 7.4 string(4146) "Array ( [0] => stdClass [1] => Exception [2] => ErrorException ...... [138] => ZipArchive [139] => BootstrapBuilder [140] => ComposerAutoloaderInitca7fe8d0414cd934e64e09ae5654bee8 [141] => Composer\Autoload\ClassLoader [142] => Composer\Autoload\ComposerStaticInitca7fe8d0414cd934e64e09ae5654bee8 [143] => JasonLewis\Menu\HtmlBuilder ) -- Edit bug report at https://bugs.php.net/bug.php?id=79474&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79474&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79474&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79474&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79474&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79474&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79474&r=support Expected behavior: https://bugs.php.net/fix.php?id=79474&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79474&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79474&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79474&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79474&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79474&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79474&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79474&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79474&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79474&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79474&r=mysqlcfg

« previous php.bugs (#226570) next »