Marcus, BC is working. PHP5 has zend.ze1_compatibility_mode and some PHP applications use it.
BTW to disallow =& $this and passing $this by reference we should change not only compiler but also executor. On each parameter passing we should check if we do passing $this by reference (it is not possile to eleminaty all such checks at compile time). Dmitry. > -----Original Message----- > From: Marcus Boerger [mailto:[EMAIL PROTECTED] > Sent: Monday, October 03, 2005 6:14 PM > To: Dmitry Stogov > Cc: 'Derick Rethans'; 'PHP Developers Mailing List' > Subject: Re: [PHP-DEV] $ref =& $this; > > > Hello Dmitry, > > that IS NOT proper code and it wasn't in php 4 either, it > was only a workaround that is no longer needed. Had the php 4 > design been correct in the first place that wouldn't have > been allowed in 4 either. Since BC is not working out anyway > i see absolutley no reason to encourage people to continue to > missuse php. > > marcus > > Monday, October 3, 2005, 4:05:56 PM, you wrote: > > > Hi, > > > At first $ref =& $this; produced fatal error because of the > bug (not > > by design). For example $ref->prop =& $this; worked and > works without > > errors. > > > So my patch shouldn't be reverted in any case. > > > At second disallowing such assignments and passign $this by > reference > > will breake a lot of PHP4 code (Mamaba CMS). In PHP4 > passing $object > > by refernce and by value had completely different semantic. > > > I don't see any reason to disallow 100% proper code (like the the > > following). > > > class Child { > > function Child($parent) { > > $parent->children[] =& $this; > > } > > } > > > Of course using "=& $this" user can breake $this value, but other > > languages > > (C++) allows this too. > > I don't think we should be paranoiacs. > > > Thanks. Dmitry. > > > >> -----Original Message----- > >> From: Derick Rethans [mailto:[EMAIL PROTECTED] > >> Sent: Monday, October 03, 2005 5:09 PM > >> To: PHP Developers Mailing List > >> Subject: [PHP-DEV] $ref =& $this; > >> > >> > >> Hello, > >> > >> Dmitry committed a fix earlier to ignore the & in the > >> statement above. I > >> think this is not a good thing to do as it's simply > >> conceptually wrong. > >> The first thing is that ignoring syntax without issuing a > warning is > >> dubious because people might think it does actually work, and > >> secondly > >> because I think that the code above is wrong anyway - > somewhat in the > >> same way that "$this = new foo();" is wrong. > >> > >> There is never any need to assign $this by reference, nor to > >> pass it by > >> reference to a function as it's an object anyway, making the > >> references > >> pointless - I would even go as far as disallowing passing $this by > >> references to a function - where the reference has to be > >> ignored again, > >> otherwise it allows you to chantge $this to a different > object with: > >> > >> class Foo { > >> function byRef(&$f) { > >> $f = new Bar(); > >> } > >> > >> function modifyThis() { > >> $this->byRef($this); > >> } > >> } > >> > >> I think we should prevent people from writing syntax like > >> this, as it is > >> not obvious what is going to happen. This means that we > should revert > >> Dmitry's patch. > >> > >> regards, > >> Derick > >> > >> -- > >> Derick Rethans > >> http://derickrethans.nl | http://ez.no | http://xdebug.org > >> > >> -- > >> PHP Internals - PHP Runtime Development Mailing List > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > > > > > Best regards, > Marcus > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php