Re: Changed behaviour for strtr()
| From: | Jordi Boggiano | Date: | Wed, 22 Jun 2011 07:44:16 +0000 |
| Subject: | Re: Changed behaviour for strtr() | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53503@lists.php.net to get a copy of this message | ||
On Wed, Jun 22, 2011 at 3:30 AM, Sanford Whiteman
<swhitemanlistens-software@cypressintegrated.com> wrote:
>> Right now strtr('anything', 'anything', '') ===
>> 'anything', which
>> means that anyone relying on this behavior is doing something strange
>> and dumb imo, doing a function call for nothing.
>
> How is relying on by-design behavior that turns the call into a no-op
> (instead of wrapping the call in an empty() check or whatever) dumb?
> Is there some performance hit for entering strtr() that makes this
> true?
Well, all I was saying was that you'd never hardcode such thing, it
could happen with dynamic user input, but in that case you'd have a
string, and not null. Anyway as always with PHP there's probably a
couple guys somewhere in the world that did it in a way that BC will
break for them.
I just think it's awkward to deny this feature for a possible edge
case in which BC would be broken, while in other instances BC is
broken in bigger ways, sometimes by accident, and sometimes in minor
versions too.
Cheers
--
Jordi Boggiano
@seldaek :: http://seld.be/