Re: Binary strings from 6 in 5.2?
| From: | Christian Schneider | Date: | Tue, 14 Nov 2006 23:05:38 +0000 |
| Subject: | Re: Binary strings from 6 in 5.2? | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-26589@lists.php.net to get a copy of this message | ||
Ilia Alshanetsky wrote:
> Just because behavior of something had changed in php6 does not mean it
> should change in php5 as well. It is the job of new releases to be
> backwards compatible, not old releases to be forward compatible.
While I agree not to clutter PHP5 too much I can see the point in adding
some stuff here.
It would have been easier to prepare PHP4 code to the PHP5 clone
migration if a clone functionality would have been made available early
in PHP4 when it was clear what the PHP5 way of cloning would be.
Now I'm stuck with this ugly work-around if I want to be cross-version
compatible:
function &cloneobj(&$object)
{
$result = (is_object($object) && version_compare(zend_version(), 2,
'>=')) ? clone($object) : $object;
return $result; # PHP internals need a tmp var to return by ref
}
While I'm as of yet unsure how and how often binary strings are going to
be used I think it is worth considering opening up the migration path early.
- Chris