#26121 [Opn->WFx]: Object defined before object - error

From: Date: Tue, 18 Nov 2003 20:33:04 +0000
Subject: #26121 [Opn->WFx]: Object defined before object - error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-50658@lists.php.net to get a copy of this message
 ID:               26121
 Updated by:       sniper@php.net
 Reported By:      closer at netnitco dot net
-Status:           Open
+Status:           Wont fix
 Bug Type:         Zend Engine 2 problem
 Operating System: Redhat Linux 9.0 / Apache 2.0.46
 PHP Version:      5.0.0b2 (beta2)
 New Comment:

This is expected and correct behaviour.



Previous Comments:
------------------------------------------------------------------------

[2003-11-04 14:16:22] closer at netnitco dot net

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 this bug report at http://bugs.php.net/?id=26121&edit=1


Thread (2 messages)

« previous php.bugs (#50658) next »