Bug #71733 [Opn->Nab]: double extends not autoload third class (if not correct order)
| From: | dmitry@php.net | Date: | Fri, 15 Jul 2016 09:23:05 +0000 |
| Subject: | Bug #71733 [Opn->Nab]: double extends not autoload third class (if not correct order) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202347@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71733&edit=1
ID: 71733
Updated by: dmitry@php.net
Reported by: oskars dot petermanis at gmail dot com
Summary: double extends not autoload third class (if not
correct order)
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
This is not a bug. Class B has to be defined before A.
Previous Comments:
------------------------------------------------------------------------
[2016-03-07 16:53:11] oskars dot petermanis at gmail dot com
Description:
------------
First, please, see test script.
One problem is that it is harder to debug (as the error points to existing class in same file).
Second (and main in my case) that autoload for class C is not working.
The workaround is to switch "extends" lines and it will work as expected for both
problems.
This bug makes our php code generator more complicated.
Test script:
---------------
<?php
class A extends B{}
class B extends C{}
$a = new A();
Expected result:
----------------
Fatal error: Class 'C' not found in /tmp/test.php on line 3
Actual result:
--------------
Fatal error: Class 'B' not found in /tmp/test.php on line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71733&edit=1