Bug #78887 [NEW]: Changed order in get_declared_classes() with parent(s) loaded by autoloader
| From: | andi dot wr at googlemail dot com | Date: | Fri, 29 Nov 2019 14:54:47 +0000 |
| Subject: | Bug #78887 [NEW]: Changed order in get_declared_classes() with parent(s) loaded by autoloader | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-223948@lists.php.net to get a copy of this message | ||
From: andi dot wr at googlemail dot com
Operating system: Linux
PHP version: 7.4.0
Package: SPL related
Bug Type: Bug
Bug description:Changed order in get_declared_classes() with parent(s) loaded by autoloader
Description:
------------
After loading a class which inherits from other classes and parent
classes are loaded by autoloader, get_declared_classes() gives another
order than in previous PHP versions.
< 7.4: parent => child
7.4: child => parent
Result of code example (reverse order of get_declared_classes()):
Array
(
[0] => A
[1] => B
...
)
vs.
Array
(
[0] => B
[1] => A
...
)
Url: https://3v4l.org/lEnsR
Test script:
---------------
<?php
spl_autoload_register(function($class){
if ($class === 'A') {
eval("class A { }");
}
});
class B extends A {
}
print_r(array_reverse(get_declared_classes()));
Expected result:
----------------
Parent class(es) should be declared before child class.
Actual result:
--------------
Parent classes are declared before child class.
--
Edit bug report at https://bugs.php.net/bug.php?id=78887&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78887&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78887&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78887&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78887&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78887&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78887&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78887&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78887&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78887&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78887&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78887&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78887&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78887&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78887&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78887&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78887&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78887&r=mysqlcfg