|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-05-11 12:30 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 01:00:02 2025 UTC |
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"