Re: [PHP4BETA] Re: convert_to_string_ex is not the solution.
| From: | Zeev Suraski | Date: | Fri, 17 Sep 1999 15:52:17 +0000 |
| Subject: | Re: [PHP4BETA] Re: convert_to_string_ex is not the solution. | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-4582@lists.php.net to get a copy of this message | ||
On Fri, 17 Sep 1999, Joey wrote:
> >
> > i know a few people - including myself - who add a '&' here and there in
> > my scripts to speed things up. and yes, i've got bitten by funtions that
> > changed variable-types around without me expecting them to do so.
> >
> >
>
> If you _DO_ decide to change this behavior, it should definitely go into
> the incompat list. I have actually used this as an undocumented feature...
> by calling strlen() on something passed by ref., I programmed some thing
> to then expect a str.
>
> I agree, it should _NOT_ have been happening, but bcz it did, I programmed
> around it...perhaps others did also...
By the way, the reason I'm so strict with saying you mustn't rely on it is
that you're relying on an internal implementation of a function that may
definitely change without notice (unlike language level features, which
don't change too often).
For example, what if we decided to optimize strlen() for integers, and
just divide the number by 10 instead of converting it to a string and
checking its length? Your code would break.
Regardless of the change Thies suggested, you should change your code not
to rely on this undocumented feature.
Zeev
--
-----------------------------------------------------
Zeev Suraski <zeev@zend.com> http://www.zend.com/
For a PGP public key, finger bourbon@netvision.net.il