|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78887 Side-effects for uninitialised typed property
Submitted: 2019-11-29 14:54 UTC Modified: 2019-12-08 07:46 UTC
From: andi dot wr at googlemail dot com Assigned:
Status: Closed Package: SPL related
PHP Version: 7.4.0 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: andi dot wr at googlemail dot com
New email:
PHP Version: OS:


 [2019-11-29 14:54 UTC] andi dot wr at googlemail dot com
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()):

    [0] => A
    [1] => B


    [0] => B
    [1] => A


Test script:

    if ($class === 'A') {
        eval("class A { }");

class B extends A {


Expected result:
Parent class(es) should be declared before child class.

Actual result:
Parent classes are declared before child class.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-29 14:56 UTC]
-Status: Open +Status: Feedback
 [2019-11-29 14:56 UTC]
Sounds like undefined behavior to me. Is there documentation somewhere that says they'll be returned in a certain order?
 [2019-11-29 22:43 UTC]
Definitely unspecified behavior, at best an upgrading note can be added for this.
 [2019-12-08 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2019-12-08 07:46 UTC]
-Summary: Changed order in get_declared_classes() with parent(s) loaded by autoloader +Summary: Side-effects for uninitialised typed property -Status: No Feedback +Status: Re-Opened
 [2019-12-08 07:46 UTC]
Reopening for upgrading note.
 [2019-12-09 07:58 UTC]
Automatic comment on behalf of
Log: Fix bug #78887: Add upgrading note about get_declared_classes() order
 [2019-12-09 07:58 UTC]
-Status: Re-Opened +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Feb 28 13:01:24 2021 UTC