#29041 [Opn->Bgs]: Will not execute extended class from before declaration

From: Date: Wed, 07 Jul 2004 07:17:28 +0000
Subject: #29041 [Opn->Bgs]: Will not execute extended class from before declaration
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-61834@lists.php.net to get a copy of this message
ID: 29041 Updated by: derick@php.net Reported By: torr0101 at hotmail dot com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: Windows 2003 Standard PHP Version: 5.0.0RC3 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This is expected behavior, and documented here: http://php/manual/en/keyword.extends.php Previous Comments: ------------------------------------------------------------------------ [2004-07-07 03:31:42] torr0101 at hotmail dot com Description: ------------ When you create a normal class you can call it before the class is defined on the page. However, when you extend a class you cannot instantiate the class before it is declared. It will not be found. Reproduce code: --------------- <?php require_once('controller.php'); $l = new Login(); class Login extends Controller { function __construct() { parent::__construct(); echo('Extended'); } } ?> Expected result: ---------------- Extended Actual result: -------------- Fatal error: Class 'Login' not found in ...\test.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29041&edit=1

« previous php.bugs (#61834) next »