Req #54708 [Opn->Wfx]: Fatal error by defined class with inheritance and wrong order and including
| From: | cmb@php.net | Date: | Thu, 02 Dec 2021 18:24:13 +0000 |
| Subject: | Req #54708 [Opn->Wfx]: Fatal error by defined class with inheritance and wrong order and including | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-238118@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54708&edit=1
ID: 54708
Updated by: cmb@php.net
Reported by: interrobang at noicq dot org
Summary: Fatal error by defined class with inheritance and
wrong order and including
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Class/Object related
Operating System: Debian Squeeze
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
From <https://www.npopov.com/2021/10/20/Early-binding-in-PHP.html>:
| After reading this blog post, youâll probably appreciate why bug
| reports related to early binding go right on the âwonât fixâ pile.
Previous Comments:
------------------------------------------------------------------------
[2017-01-02 14:35:24] nikic@php.net
There are a number of variations on this. Here it's an unknown parent class, the two bugs
I've just marked as duplicates us an interface. The same happens for used traits.
------------------------------------------------------------------------
[2017-01-02 14:34:13] nikic@php.net
Related To: Bug #69665
------------------------------------------------------------------------
[2017-01-02 14:33:58] nikic@php.net
Related To: Bug #55103
------------------------------------------------------------------------
[2011-12-09 21:37:00] pov at fingerprint dot fr
Other weird comportment with probably the same origin :
<?php // test.php
require 'test2.php';
?>
<?php // test2.php
if (true) {
class SimpleFoo {
}
}
?>
Expected result : no error
Actual result : "Cannot redeclare class SimpleFoo"
------------------------------------------------------------------------
[2011-05-11 12:30:27] interrobang at noicq dot org
Description:
------------
Script "test.php" produces Fatal error in relation of writing order of classes.
If that missing class defined in same file, at the same place like require_once() (by replacing), no
error will appear :O
Test script:
---------------
class file: test.class.php
<?php
class formularEssentials{}
?>
main file: test.php
<?php
require_once 'test.class.php'; //contain "formularEssentials"
class formularBeta extends formularAlpha{}
class formularAlpha extends formularEssentials{}
?>
Expected result:
----------------
nothing, blank screen. No "Fatal error" should be displayed.
Actual result:
--------------
Fatal error: Class 'formularAlpha' not found in test.php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54708&edit=1