|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #54708 Fatal error by defined class with inheritance and wrong order and including
Submitted: 2011-05-11 12:30 UTC Modified: 2017-01-02 14:35 UTC
Avg. Score:3.7 ± 1.3
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:0 (0.0%)
From: interrobang at noicq dot org Assigned:
Status: Open Package: Class/Object related
PHP Version: Irrelevant OS: Debian Squeeze
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: interrobang at noicq dot org
New email:
PHP Version: OS:


 [2011-05-11 12:30 UTC] interrobang at noicq dot org
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
class formularEssentials{}

main file: test.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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-09 21:37 UTC] 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"
 [2017-01-02 14:35 UTC]
-Type: Bug +Type: Feature/Change Request
 [2017-01-02 14:35 UTC]
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.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Nov 28 06:03:16 2021 UTC