Summary: $obj = new foo() patch

From: Date: Sat, 11 Nov 2000 10:36:14 +0000
Subject: Summary: $obj = new foo() patch
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-37730@lists.php.net to get a copy of this message
Hi all: Being the author (Andi cleaned it) of the $obj = new foo(), I haven?t resisted the temptation to come to make a summary. 1. Kiril reported the problem with "global $a" and "GLOBALS['a']". According to Mike this is a problem in PHP itself, but the problem lies in the fact that code actually running can change the expected behaviour as now, "new" will return a reference. So a problem exists 2. Andre reported that foo( new foo) changed its behaviour. As far as I am concerned, the patch should not affect this. The patch doesn?t modify "new"'s behaviour. It only comes into action when "new" is assigned to a variable. It is true that deep hidden interactions can be happening in PHP's code, and I am lookint into it. But recalling Andi and Zeev words, I think this is an issue belonging to passing by reference being banned in PHP 4.0.4. Only these two have shown up, but other interactions may exist. Mike also mentioned the possiblity of having the "cvar = &new object_t()" syntax supported. This is straightforward and will not change the behaviour of any running code, as it only add a new rule which is not currently in use. Should 4.0.4 go for this, if "$obj = new object_t()" is creating problems ? Probably, until all of them are sorted out. This is also consistent with the way the '&' symbol is used throughout PHP's syntax. Anyway, my head is buried in my monitor looking for possible solutions. Regards Daniel

« previous php.dev (#37730) next »