Re: php5 - possible bug discovered
| From: | David Restall - System Administrator | Date: | Tue, 09 Oct 2007 08:09:48 +0000 |
| Subject: | Re: php5 - possible bug discovered | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-262949@lists.php.net to get a copy of this message | ||
Hi Robert, Stut & List
Thanks for your replies which arrived after I had gone to bed |-Z
Robert :-
> In PHP5 objects are no longer copied when assigned. Instead the object's
> handle is assigned (similar to a reference but not quite). So the
> behaviour is as expected.
Stut :-
> > I think I have discovered a bug in php5. If I haven't, I've discovered
> > a bug in the documentation or a bug in my brain.
>
> Start here: http://php.net/language.oop5.cloning
It's amazing what a good night's sleep will do :-)
I could not find that page last night even though I was sure it must
have existed and I can see that it is a well documented and encountered
problem.
My main obesrvation is that I'm glad that I decided to revisit all my
old PHP4 stuff and rewrite or clean it up. I have hundreds of
$Working_Class = $Under_Class;
lines in my code as well as
$Upper_Class = & $Aristocracy;
lines too. I think the documentation on references needs updating to
reflect PHP 5's behaviour a little more accurately because I can see
this causing serious problems to somebody just copying their code blindly.
I have just built a client a development server using php5 instead of
php4 and turned zend.ze1_compatibility_mode on so that their old CMS would
work - I just hadn't realised that the cloning problem was solved by this.
Oh well, now I'm fresh I can crack on :-)
TTFN
D
php/general-2007-10-09.tx robert@interjinn.com
stuttle@gmail.com
php-general
+----------------------------------------------------------------------------+
| Dave Restall, Computer Nerd, Cyclist, Radio Amateur G4FCU, Bodger |
| Mob +44 (0) 7973 831245 Skype: dave.restall Radio: G4FCU |
| email : dave@restall.net Web : Not Ready Yet :-( |
+----------------------------------------------------------------------------+
| birth, n: |
| The first and direst of all disasters. |
| -- Ambrose Bierce, "The Devil's Dictionary" |
+----------------------------------------------------------------------------+