#27255 [Opn->Bgs]: Code declaration order

From: Date: Sat, 14 Feb 2004 22:32:41 +0000
Subject: #27255 [Opn->Bgs]: Code declaration order
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-54917@lists.php.net to get a copy of this message
ID: 27255 Updated by: derick@php.net Reported By: minimoose at balpoint dot com -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: Windows XP Professional PHP Version: 5.0.0b4 (beta4) 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 Just one of the changes with PHP 5. Previous Comments: ------------------------------------------------------------------------ [2004-02-14 16:53:34] minimoose at balpoint dot com Description: ------------ The order in which php code (a class) is declared and referenced in the sourcefile causes a compile error if not properly considered. In PHP 4, declaring a class after referencing it posed no problem. In PHP 5 it generates a compile error. Reproduce code: --------------- <?php $myinst = new myClass(); echo $myinst->myvar; class myClass { public $myvar; function __construct() { $this->myvar = "initial value"; } } ?> Expected result: ---------------- "Initial value" should be printed to the output window/page/console. Actual result: -------------- <b>Fatal error</b>: Class 'myClass' not found in <b>C:\myClass.php</b> on line <b>2</b><br /> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27255&edit=1

« previous php.bugs (#54917) next »