#26121 [NEW]: Object defined before object - error

From: Date: Tue, 04 Nov 2003 19:16:22 +0000
Subject: #26121 [NEW]: Object defined before object - error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-49979@lists.php.net to get a copy of this message
From: closer at netnitco dot net Operating system: Redhat Linux 9.0 / Apache 2.0.46 PHP version: 5.0.0b2 (beta2) PHP Bug Type: Class/Object related Bug description: Object defined before object - error Description: ------------ With PHP 4 you could create the object variable before the actual object was defined. This doesnt seem to be true in 5. If you move lines 2 and 3 of the code to the bottom the script oes work, but this does break backward compatibility. Reproduce code: --------------- <?php $new_obj = new new_class; $new_obj->hello (); class new_class { function hello () { echo "Hello"; } } ?> Expected result: ---------------- Hello Actual result: -------------- Fatal error: Class 'new_class' not found in /usr/local/apache2/htdocs/scripts/class_test.php on line 2 -- Edit bug report at http://bugs.php.net/?id=26121&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26121&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26121&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26121&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26121&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26121&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26121&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26121&r=support Expected behavior: http://bugs.php.net/fix.php?id=26121&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26121&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26121&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26121&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26121&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26121&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26121&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26121&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26121&r=float

« previous php.bugs (#49979) next »