Reference handling change and PHP 4.4.0

php.internals

Colin Tucker

20 years ago
Hello all, I know this issue has most likely been discussed to death here so I apologise in advance for starting a new thread about it. I just need to get my head around the reasoning for introducing this change to PHP4 (4.4 branch). I can understand making the change to PHP5, but can someone bring me up to speed as to why it was done to PHP4? As I'm sure you're aware, it breaks heaps and heaps of existing code out there. We found this out the hard way yesterday when our server administrator upgraded our production server to PHP 4.4.0 (even though the Debian package description said it was a PHP 4.3.x release). We ended up with hundreds of errors and many, many vhosts stopped working correctly due to "variable references should be returned by reference" problems, both in my code and in third-party code, such as PHPBB instances. And now I read that this will not be "fixed" in future PHP4 releases due to breaking backwards compatibility? I just don't understand... a change that breaks backwards compatibility in a large portion of the existing PHP4 code base will not be fixed because it breaks backwards compatibility? It's doing my head in, please can someone explain? This means that either we have to (potentially) change thousands of lines of code and upgrade many instances of third-party PHP-based sites just to use PHP 4.4.0 and above, or miss out on using this and future PHP4 releases and any security vulnerability fixes they may include. Why could the change not be made optional by using a php.ini directive? Kind regards, Colin.

Jani Taskinen

20 years ago
You do understand the difference between 4.3.x and 4.4.x? :) (yes, this issue has been beaten to death already) --Jani On Wed, 14 Sep 2005, Colin Tucker wrote:

Colin Tucker

20 years ago
Hi Jani, Yes, the increase in the middle digit. ;) Ok, so does this mean that the 4.3.x and 4.4.x branches will now be updated separately? Say, if a serious vulnerability was detected in 4.3.x an 4.4.x, and separate release would be issued for both? Kind regards, Colin. Jani Taskinen wrote:

Pierre Joye

20 years ago
On 9/14/05, Colin Tucker <colin@encode.net.au> wrote:
> Hi Jani, > > Yes, the increase in the middle digit. ;) > > Ok, so does this mean that the 4.3.x and 4.4.x branches will now be > updated separately? Say, if a serious vulnerability was detected in > 4.3.x an 4.4.x, and separate release would be issued for both?
No, 4.3.x is a dead branche. But the problem is much more easier to fix in 4.4.0. Do what you always do in production servers, do not display errors/notices, especially as 4.4.0 raises only notices for the reference problem. Regards, --Pierre

Leigh Makewell

20 years ago
Pierre Joye wrote:
> No, 4.3.x is a dead branche. But the problem is much more easier to > fix in 4.4.0. Do what you always do in production servers, do not > display errors/notices, especially as 4.4.0 raises only notices for > the reference problem. > > Regards, > > --Pierre
Well that is exactly why this is a problem. Making large changes that break BC in php 5 is fine because there are two versions that are being maintained, php4, and php5. Security updates are made to both. However, breaking BC between 4.3 and 4.4 when 4.3 is a dead branch causes can cause some problems for system admins. What happens if the software being used is never updated to 4.4? There are important security updates that need to be applied, but they can't apply them because all of their websites will stop working. Oh and not displaying the error doesn't make the error go away :p

Rasmus Lerdorf

20 years ago
Leigh Makewell wrote:
> Pierre Joye wrote: > >> No, 4.3.x is a dead branche. But the problem is much more easier to >> fix in 4.4.0. Do what you always do in production servers, do not >> display errors/notices, especially as 4.4.0 raises only notices for >> the reference problem. >> >> Regards, >> >> --Pierre > > > Well that is exactly why this is a problem. Making large changes that > break BC in php 5 is fine because there are two versions that are being > maintained, php4, and php5. Security updates are made to both. > > However, breaking BC between 4.3 and 4.4 when 4.3 is a dead branch > causes can cause some problems for system admins. What happens if the > software being used is never updated to 4.4? There are important > security updates that need to be applied, but they can't apply them > because all of their websites will stop working. > > Oh and not displaying the error doesn't make the error go away :p
Once again, it is an E_NOTICE in 4.4. And yes, not displaying it makes it go away. Staying with 4.3 because of this is nuts. If you are seeing this notice under 4.4 that means you are most likely getting random memory corruption under 4.3. Move to 4.4 to fix the memory corruption. Go through the notices and fix as many of them as you can, since it indicates a basic problem in the code you are running. If you are not interested in doing that, just turn them off. It will run without corruption. -Rasmus

Colin Tucker

20 years ago
Rasmus Lerdorf wrote:
> Once again, it is an E_NOTICE in 4.4. And yes, not displaying it makes > it go away. Staying with 4.3 because of this is nuts. If you are > seeing this notice under 4.4 that means you are most likely getting > random memory corruption under 4.3. Move to 4.4 to fix the memory > corruption. Go through the notices and fix as many of them as you can, > since it indicates a basic problem in the code you are running. If you > are not interested in doing that, just turn them off. It will run > without corruption. > > -Rasmus
Hi again Rasmus, Well, I can tell you that following our unexpected server upgrade yesterday to 4.4.0, things definately DID break within our code, and the display of E_NOTICE errors is disabled on our production server. We quickly rolled back to 4.3, and I have not had a chance to fully investigate what is going on with the code as yet, but it seemed to be stemming from a class of mine that acts like a map. Instead of returning an object associated with a given key, it was returning the *last added* object. I think all objects in the map ended up being the same object, being the last one added - there is definately some reference weirdness going on. I'm as confused as you probably are, and will report back on what is going wrong when I have a chance. But one thing is sure, this code was working absolutely fine until the switch to 4.4.0. Cheers, Colin.

Derick Rethans

20 years ago
On Wed, 14 Sep 2005, Leigh Makewell wrote:
> However, breaking BC between 4.3 and 4.4 when 4.3 is a dead branch causes can > cause some problems for system admins. What happens if the software being used > is never updated to 4.4? There are important security updates that need to be > applied, but they can't apply them because all of their websites will stop > working.
I doubt any application would really stopped working - except for a friendly notice when people wrote bad code. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Leigh Makewell

20 years ago
Derick Rethans wrote:
> I doubt any application would really stopped working - except for a > friendly notice when people wrote bad code. > > Derick >
Except if you had read Colin's messages you would see that his code *had* stopped working. Leigh :)

Derick Rethans

20 years ago
On Wed, 14 Sep 2005, Leigh Makewell wrote:
> Derick Rethans wrote: > > I doubt any application would really stopped working - except for a friendly > > notice when people wrote bad code. > > Except if you had read Colin's messages you would see that his code *had* > stopped working.
But it just could as well have been because he was relying on the memory corruptions. Hard to tell without code. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Colin Tucker

20 years ago
Derick Rethans wrote:
> But it just could as well have been because he was relying on the memory > corruptions. Hard to tell without code. > > Derick
As I mentioned in my reply to Rasmus above, the problem seems to be stemming from a class that acts like a map of objects. Most of my PHP4 code would pass objects around by reference to ensure operations were working on the original object, thus avoiding the creation of copies. After the upgrade to 4.4.0, the map lost integrity in that returning any object within the map by key would return the object last added to the map. I may not have provided any code, but this problem description was enough for Todd Ruth to send me a very helpful and informative e-mail on the matter (i.e. "everything the same as the last added" bugs), which shall help me greatly in tracking it down (thanks again, Todd!). Regards, Colin.

Todd Ruth

20 years ago
For the record, I have no idea how the 4.3 -> 4.4 change could trigger such a bug. I just pointed out that we've hit the symptom Colin described many times in our company with code (yes, bad code) of the form: <?php function &f(&$y) { return $y; } $x = array('a','b','c'); foreach ($x as $y) { // The following line is a bad use of "&". It doesn't // do any good and ends up causing all the members of $z // to be references to eachother. $z[] =& f($y); } var_dump($x); var_dump($z); ?> I've played with many flavors of this user-bug, adding and subtracting "&"s, but have been unable to get different behavior between 4.3 and 4.4. Colin, when you find the code that went wild in the switch to 4.4, please post it. I'm sure there are others that are as curious as I am. (There may even be someone nice enough to fix the BC break if it doesn't mean reintroducing memory corruptions.) As long as I'm posting, I might as well put in a "thank you" note for the notices. I know they're generating a lot of heat, but it's made it soooo much easier to fix all of the novice uses of "&"s in our code. Thanks, Todd

Leigh Makewell

20 years ago
Derick Rethans wrote:
> On Wed, 14 Sep 2005, Leigh Makewell wrote: > > >>Derick Rethans wrote: >> >>>I doubt any application would really stopped working - except for a friendly >>>notice when people wrote bad code. >> >>Except if you had read Colin's messages you would see that his code *had* >>stopped working. > > > But it just could as well have been because he was relying on the memory > corruptions. Hard to tell without code.
I would like to start by apologising for this message. It's long, it's a rant, and I know this is probably not the place, but I can't let this slide. This sort of comment really annoys me. Zip it up Derick! Who do you think you are to dictate whether Colin's code is good or bad? You are very quickly starting to annoy a lot of PHP programmers. A quick search on this topic will find quite a few news posts, and forum threads discussing this issue, and I have seen you posting on a lot of them. You seem to have a "So What" attitude and are very quick to tell all these people that they are writing bad code and it's not your problem. We don't appreciate being told that we write bad code. We don't appreciate being treated as second rate programmers. We don't like being told that a perfectly legal statement like this $x = current(explode(' ','a b')); is wrong and bad programming! Who are we? We are the top 10% of PHP programmers. We are the PHP coders who take your language and manipulate it, coerce it, and gently push it into doing things you never imagined it for. We are the few people who actually use 100% of PHP's abilities. We are the ones who will notice *every* time you make a change like this. Do you want PHP to be taken seriously and used professionaly? Well *we* are the ones who decide that PHP is ready for the big time, and if we believe that the floor is constantly shifting under us and making our job harder then we will leave. If we leave PHP will be nothing but a toy box language suitable for nothing but basic little guestbook scripts coded by school children. I have enjoyed using PHP since the first script I wrote with it. But I am quickly losing that enjoyment, and not because of anything that has happened to the language. I am losing it because I feel like the PHP community does not respect it's users. As someone who works for a company that specialises in creating, building, and maintaining online communities I know how important good PR is. Like it or not PHP *is* an online community and it can be made or broken by it's people. Letting people like Derick here mouth off is not a good way to keep your community happy. Leigh.

Rasmus Lerdorf

20 years ago
Leigh Makewell wrote:
> a perfectly legal statement like this $x = current(explode(' ','a b'));
In this particular case, current() did not need to take a reference since it doesn't modify anything. This has been fixed in CVS. That's still not how I'd write that though. I would write: list($x) = explode(' ','a b'); Another way to write this: $x = array_shift(explode(' ','a b')); This is where it gets tricky. Is this legal code? We are modifying the argument and immediately discarding the modification. The user might want to know about that, so to me it makes sense that this throws a NOTICE. I do agree with folks who don't like this being a fatal error. I don't think it should be either and this is what we have been discussing. That doesn't change the fact that a lot of these examples are not optimal coding examples. There are usually more direct ways that doesn't involve a useless operation that ends up getting discarded right away. So while the tone of some of these messages may not be great, often the suggestion that the code in question isn't very good is accurate. -Rasmus

Pierre Joye

20 years ago
On 9/14/05, Derick Rethans <derick@php.net> wrote:
> I doubt any application would really stopped working - except for a > friendly notice when people wrote bad code.
Derick, I do not know if you ever learn but... Stop saying that people wrote bad codes and this is why they code could break. This is nothing else than _wrong_ and respectless. Regards, --Pierre

Rasmus Lerdorf

20 years ago
Colin Tucker wrote:
> I know this issue has most likely been discussed to death here so I > apologise in advance for starting a new thread about it. I just need to > get my head around the reasoning for introducing this change to PHP4 > (4.4 branch). I can understand making the change to PHP5, but can > someone bring me up to speed as to why it was done to PHP4? As I'm sure > you're aware, it breaks heaps and heaps of existing code out there. > > We found this out the hard way yesterday when our server administrator > upgraded our production server to PHP 4.4.0 (even though the Debian > package description said it was a PHP 4.3.x release). We ended up with > hundreds of errors and many, many vhosts stopped working correctly due > to "variable references should be returned by reference" problems, both > in my code and in third-party code, such as PHPBB instances. > > And now I read that this will not be "fixed" in future PHP4 releases due > to breaking backwards compatibility? I just don't understand... a > change that breaks backwards compatibility in a large portion of the > existing PHP4 code base will not be fixed because it breaks backwards > compatibility? It's doing my head in, please can someone explain? > > This means that either we have to (potentially) change thousands of > lines of code and upgrade many instances of third-party PHP-based sites > just to use PHP 4.4.0 and above, or miss out on using this and future > PHP4 releases and any security vulnerability fixes they may include. Why > could the change not be made optional by using a php.ini directive?
We have been looking to see if there is a way to fix the memory corruption issue in a way that has less of an impact on existing code. This doesn't change the fact that every error you get is actually an error in the code you are running. The broken code is effectively doing something similar to: function foo(&$arg) { $arg = 4; } foo(strlen("abc")); which makes very little sense. There are many variations of this, but in every instance it is something that should be fixed, and in some of the cases it actually leads to memory corruption. There are many examples of this sort of thing working just fine in PHP 4.3.x because people are passing things in by reference and never modifying the passed in value. They'll do something along the lines of: function foo(&$arg) { return $arg[0] + 1; } echo foo(array(1,2,3,4,5,6,7,8,9,10)); possibly because they believe that they are saving memory by not making a copy of the array with that reference. Of course that is quite misguided as no copy is done until the arg is modified so if you don't modify it, you are better off passing it by value. Right now the change in 4.4 and 5.x is to complain loudly when you pass a reference to something without any associated storage. In both of the above examples there is no permanent storage associated with either of the passed arguments, so trying to get a reference to this storage makes very little sense. The only feasible way we might be able to work around this is to make a copy of such bogus reference attempts and effectively just pretend they were passed by value. I think it is a bit of a hack, but at the same time the breakage of existing apps has been more widespread than I think anybody anticipated. I'd still want to throw a notice to let people know they are doing something odd though. -Rasmus

Pierre Joye

20 years ago
On 9/14/05, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:
> but at the same time the breakage of existing apps has been > more widespread than I think anybody anticipated.
Than "anybody" liked to anticipate could better said.
> I'd still want to throw a notice to let people know they are doing something odd though.
As I said hundred of times in the past weeks to everyone and his mother, yes, notices could be a much better choice for a first release (both branches) than fatal errors or warning :-) Regards, --Pierre

Colin Tucker

20 years ago
Hi Rasmus, thanks for replying, I appreciate your feedback. Rasmus Lerdorf wrote:
> We have been looking to see if there is a way to fix the memory > corruption issue in a way that has less of an impact on existing code. > This doesn't change the fact that every error you get is actually an > error in the code you are running.
Yes, I know this now, but I guess at the time it seemed ok, because it wasn't an error then. :)
> Right now the change in 4.4 and 5.x is to complain loudly when you pass > a reference to something without any associated storage. In both of the > above examples there is no permanent storage associated with either of > the passed arguments, so trying to get a reference to this storage makes > very little sense. The only feasible way we might be able to work > around this is to make a copy of such bogus reference attempts and > effectively just pretend they were passed by value. I think it is a bit > of a hack, but at the same time the breakage of existing apps has been > more widespread than I think anybody anticipated. I'd still want to > throw a notice to let people know they are doing something odd though.
Well for one I'm glad that PHP5 handles all objects as references now because this was primarily the reason I used references in PHP4, i.e. to ensure that copies of objects were not being passed around. Plus, I'm now in the process of converting my core code to PHP5 using it's 'proper OO' features. However, as you mentioned, this still leaves a lot of broken PHP4 code under 4.4 and above. I completely understand now why the change was made, I just guess a lot of us were doing funny things with references that we shouldn't have been. I suppose it's a tricky situation for you guys as there was no solution that wouldn't cause at least some breakage. Cheers, Colin.

Derick Rethans

20 years ago
On Wed, 14 Sep 2005, Colin Tucker wrote:
> Hello all, > > I know this issue has most likely been discussed to death here so I apologise > in advance for starting a new thread about it. I just need to get my head > around the reasoning for introducing this change to PHP4 (4.4 branch). I can > understand making the change to PHP5, but can someone bring me up to speed as > to why it was done to PHP4? As I'm sure you're aware, it breaks heaps and > heaps of existing code out there.
It already broke heaps of code - and this problems *was* affecting application with hard to find crashes. So yes, it is worth it.
> We found this out the hard way yesterday when our server administrator > upgraded our production server to PHP 4.4.0 (even though the Debian package > description said it was a PHP 4.3.x release). We ended up with hundreds of > errors and many, many vhosts stopped working correctly due to "variable > references should be returned by reference" problems, both in my code and in > third-party code, such as PHPBB instances.
Uhm, they're only notices - they shouldn't show up at the website in production, now should they?
> And now I read that this will not be "fixed" in future PHP4 releases due to > breaking backwards compatibility? I just don't understand... a change that > breaks backwards compatibility in a large portion of the existing PHP4 code > base will not be fixed because it breaks backwards compatibility? It's doing > my head in, please can someone explain?
PHP 4 is not going to change the behavior anymore. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Colin Tucker

20 years ago
Derick Rethans wrote:
>>We found this out the hard way yesterday when our server administrator >>upgraded our production server to PHP 4.4.0 (even though the Debian package >>description said it was a PHP 4.3.x release). We ended up with hundreds of >>errors and many, many vhosts stopped working correctly due to "variable >>references should be returned by reference" problems, both in my code and in >>third-party code, such as PHPBB instances. > > Uhm, they're only notices - they shouldn't show up at the website in > production, now should they?
Derick, can you show me where I said that they showed up on the website?
>>And now I read that this will not be "fixed" in future PHP4 releases due to >>breaking backwards compatibility? I just don't understand... a change that >>breaks backwards compatibility in a large portion of the existing PHP4 code >>base will not be fixed because it breaks backwards compatibility? It's doing >>my head in, please can someone explain? > > PHP 4 is not going to change the behavior anymore.
Sorry, but that doesn't really answer my question. Regards, Colin.

Oliver Grätz

20 years ago
Hi again from an "ordinary user"! This thread has some opponents sharpening their knives in the corners. Hey guys, cool down! It's only ones and zeroes! ;-) First of all let's find some agreements points: - I think most of you agree that it was a bigger problem fixing it with warning in PHP4 than it was in PHP5. - Not fixing it was out of question because it caused memory corruption. Some time ago there were default options in the php.ini that are considered very harmful nowadays (register_globals etc) but they are still there, just carefully defaulting to off. See the similarities? If some people just want to use it this way the put in an option: unstored_references = NOTICE|IMPLICIT_TEMP_STORE So people relying on using it the old way can just switch it to automagically assigning a temp variable inbetween (or is this standard procedure since 4.4? Then just allow to switch the log level for such events.). On a side note it would help people if there was a possibility to run all kinds of PHP versons as Apache module in parallel which nowadays has to be done by patching the sources. Some PHP coders don't like the CGI variant and prefer the module and just for the sake of using the module they resign to doing all stuff with a single PHP version. Being able to run a 4.3.10 module in parallel with a 4.4 module and choosing the one to use on a per-directory-basis via .htaccess could calm a lot of voices. AllOLLi ____________ Time is an illusion. Lunchtime doubtly so. [Douglas Adams]

Colin Tucker

20 years ago
Hello again, Wow, this thread generated more heat than I thought it would, I basically just wanted to know the reasoning behind making the change to PHP4, unfortunate I guess for all involved that it went downhill. I have learned much in the past few days, at any rate. As mentioned, my code actually broke following the switch to 4.4.0, in addition to logging hundreds of E_NOTICE errors. It's taken me some time to track down where it's going wrong, but I think I've found out the culprits involved. It's complicated, I'll try to explain it all. The problem was related to components of my web app framework (which is similar to Struts, and incidently, now being phased out for a MUCH more lightweight, PHP5-based framework), in particular, an array of attributes, view helper classes and the creation of DAOs (data access objects) at runtime via XML configuration, which would look like this: <daos> <dao name="dao.freight" class="FreightDAO" component="Generic/Commerce/DAO/FreightDAO.php" /> <dao name="dao.customer" class="CustomerDAO" component="Generic/Commerce/DAO/CustomerDAO.php" /> <dao name="dao.order.status" class="OrderStatusDAO" component="Generic/Commerce/DAO/OrderStatusDAO.php" /> </daos> This XML would be parsed and the relevant DAO instances would be created and recorded in attribute scope for the current application module instance. For each dao node, the following code would be called (where $daoClass and $daoComponent are extracted from the XML attributes): $dao =& $this->_createDAO($daoClass,$daoComponent); if ($dao) { $this->module->setAttributeByReference($name,$dao); } Notice it assigns by reference, however I discovered that the _createDAO() method was not *returning* by reference: function _createDAO($daoClass=null,$daoComponent=null) { // Obtain Database Object: $database =& $this->module->findDatabase(); if (is_null($database)) { trigger_error($this->error(ERROR_DB_COULD_NOT_OBTAIN)); } else { // Obtain Database Connection: $connection =& $database->getConnection(); if (is_null($connection)) { trigger_error($this->error(ERROR_DB_COULD_NOT_CONNECT)); } else { // Create DAO Instance: $cmp =& new ClassComponent($daoClass,$daoComponent); $dao =& $cmp->getInstance(); if ($dao) { $dao->setConnectionByReference($connection); return $dao; } } } return NULL; } What was happening under PHP 4.4.0 is when the newly created DAO was added to the module as an attribute (setAttributeByReference), a new attribute would be created, but ALL existing DAOs in the attribute scope would become the newly added DAO, for example: (create and set the dao.freight attribute): attributes (array) { [dao.freight] => FreightDAO Object } (create and set the dao.customer attribute): attributes (array) { [dao.freight] => CustomerDAO Object [dao.customer] => CustomerDAO Object } (create and set the dao.order.status attribute): attributes (array) { [dao.freight] => OrderStatusDAO Object [dao.customer] => OrderStatusDAO Object [dao.order.status] => OrderStatusDAO Object } Simply by adding the ampersand to the _createDAO() method, like so: function &_createDAO($daoClass=null,$daoComponent=null) { } ...rectified the problem (however did not make hundreds of E_NOTICE's disappear, of course ;)). The question is, why did this problem not occur before 4.4.0? Is this an example of the "memory corruption"? Regards, Colin.

Todd Ruth

20 years ago
Aha! That was the inspiration I needed to get the right combination of "&"s. The following bit of code behaves differently under 4.3 vs 4.4: <?php function f(&$a) { return $a; } $x = array('a','b','c'); foreach (array_keys($x) as $k) { // I think the following line disconnects $y in 4.3 // but leaves $y connected in 4.4 $y =& f($x[$k]); $z[] =& $y; } var_dump($x); var_dump($z); ?> My guess would be that in 4.3 the engine tries to do the reference even though it may be dangerous. That would "disconnect" $y from the previous $z[]. 4.4 knows the reference is impossible and leaves $y connected to the previous $z[]. Is that analysis correct, engine gurus? Thanks, Colin! - Todd On Fri, 2005-09-16 at 10:55 +1000, Colin Tucker wrote:

Todd Ruth

20 years ago
I should have said something about a fix. I guess the fix would be to always unset any variable that is attempting to be assigned by reference before doing anything else with the variable. Yes? That would at least fix BC for the example I gave (and I think Colin's example). If $y were unset (based on the "=&" even the "&" can't really be used) before being set, the behavior would have matched 4.3. - Todd On Thu, 2005-09-15 at 22:08 -0700, Todd Ruth wrote:

Derick Rethans

20 years ago
On Thu, 15 Sep 2005, Todd Ruth wrote:
> Aha! That was the inspiration I needed to get the right > combination of "&"s. The following bit of code behaves > differently under 4.3 vs 4.4: > > <?php > function f(&$a) { return $a; } > $x = array('a','b','c'); > foreach (array_keys($x) as $k) { > // I think the following line disconnects $y in 4.3 > // but leaves $y connected in 4.4 > $y =& f($x[$k]); > $z[] =& $y; > } > var_dump($x); > var_dump($z); > ?> > > My guess would be that in 4.3 the engine tries to do the > reference even though it may be dangerous. That would > "disconnect" $y from the previous $z[]. 4.4 knows the > reference is impossible and leaves $y connected to the > previous $z[]. Is that analysis correct, engine gurus?
Yes, it is. This has bitten me too a couple of times. But ofcourse, the new behavior *is* the correct one. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Todd Ruth

20 years ago
Wasn't part of the "negotiation" when 4.4 was created that the behavior would be the same as 4.3 (excluding anything that happened because of a memory corruption)? (I'm not counting the notices as behavior.) I don't see how it can be argued that "$y =& ..." leaving $y connected to it's old buddies can be considered correct. I see why $y should not be tied to the rvalue if the rvalue is not suitable for being used as a reference, but that doesn't change the fact that this code clearly indicates $y should be detached from anything it was formerly attached to. Wouldn't the php philosophy indicate $y should be unset before being assigned by value in this case? (and after all, doing that preserves BC!) Please elaborate on the idea that the new behavior is correct. BTW, when you say "This has bitten me too a couple of times", are you saying that you were aware of a BC break beyond memory corruption and didn't mention it? Thanks, Todd On Fri, 2005-09-16 at 08:21 -0400, Derick Rethans wrote:

Ondrej Ivanič

20 years ago
Hi I was lost in this thread. Could someone post resume from this discussion? How can I deal with this in 4.3, 4.4, 5+? Thanks
-- Ondrej Ivanič (ondrej@kmit.sk)