Re: Broken compatibility with escaping { in php 5.2
| From: | Jochem Maas | Date: | Thu, 18 Jan 2007 13:19:21 +0000 |
| Subject: | Re: Broken compatibility with escaping { in php 5.2 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-247319@lists.php.net to get a copy of this message | ||
Bogdan Ribic wrote:
> Hi all,
>
> Try this:
>
> $a = '';
> echo "\{$a}";
>
> from php 4, it outputs "{}", from php 5.2 (one that comes with Zend 5.5)
no-one here supports Zend.
> it outputs "\{}", thus breaking existing scripts.
AFAICT the escaping in that string is wrong - the fact that it did work
the way you want it to is probably sheer luck.
lastly I ran your tests and determined at the least that the 'break'
occur *prior* to 5.2. at a guess it probably changed in 5.0, here are my results:
# php -r 'echo "php",phpversion(),":\n"; $a = "";
var_dump("\{$s}");' ;
php5 -r 'echo "php",phpversion(),":\n"; $a = "";
var_dump("\{$s}");'
OUTPUT:
php4.3.10-18:
string(2) "{}"
php5.1.2:
string(3) "\{}"
>
be pragmatic - fix your script :-)