Hello,

Jason wrote:
JL> Maybe I'm missing something here ... but what is the point of trying
JL> to create a reference to a new object ... it hasn't been ceated prior
JL> to make reference to.  Can't you simply create the new object and
JL> then make whatever (if needed) references?

Uhh... maybe I'm missing someting, too?
We're talking about he followin line, don't we?

$g_fooInstance =& new foo();   // <-- here's the problem

IMHO this line causes no problem... using the & operator with new is
explicitly noticed in the php manual (Chapter 15):

"The same syntax can be used with functions, that return references, and
with new operator (in PHP 4.0.4 and later):
$bar =& new fooclass();"

The problem is, that the object created in that line is destructed when the
function is left. Or, in other words, an object is destructed automatically
by the php-engine, although a) the object is still referenced and b) even no
local variable has ever referenced it.

BTW: Of course the code here doesn't make really sense (according to your
last sentence), but it's only an example for illustrating the problem.

Regards,

Jens


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to