Re: Clone Operations

From: Date: Wed, 07 Jun 2006 14:04:32 +0000
Subject: Re: Clone Operations
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-23978@lists.php.net to get a copy of this message
I think that "hello" should be printed. Even if the result of clone()ing isn't going to be used, the side-effects should always occur (at least to be consistence). I would bet that other languages would do the same. Nuno ----- Original Message -----
When it comes to "empty" clone statements, should they be executed and then free the result (current behavior) or avoid clone all together. For example when class x { function __clone() { echo "hello"; } } clone new x(); code is executed, should it print hello or not print anything at all, treating the clone operation as a NOOP? Current behavior calls clone and then frees the result, meaning that "hello" is printed, but I am uncertain that this is the correct behavior, any comments? Ilia Alshanetsky


« previous php.internals (#23978) next »