Edit report at https://bugs.php.net/bug.php?id=54708&edit=1
ID: 54708
Comment by: pov at fingerprint dot fr
Reported by: interrobang at noicq dot org
Summary: Fatal error by defined class with inheritance and
wrong order and including
Status: Open
Type: Bug
Package: Class/Object related
Operating System: Debian Squeeze
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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"
Previous Comments:
------------------------------------------------------------------------
[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