Hi!

> This fix has been merged into master (targeting 7.1), thanks!

I'm not sure that was such a good idea (sorry, didn't have time to write
about it before the weekend). Introducing a new warning into previously
working code is a BC break, and one that wasn't even discussed in its
own thread. Moreover, there's one more BC break in this patch - before
it, for this code:

$str = "abc";
$str{4} = '';
var_dump($str);

the $str was string of length 5, with this fix it would be string of
length 3, unchanged. Which may break other code (e.g. one composing
complex formats) in very subtle ways. And I'm not sure that current
behavior is an improvement.

> Another issue mentioned in this thread is the spurious array conversion
> that happens for empty strings. We have an existing bug report for this:
> https://bugs.php.net/bug.php?id=53432 I've created a PR to fix this
> issue: https://github.com/php/php-src/pull/1764 If there are no
> objections, I'll merge this for 7.1 as well.

This one looks like a bug, converting string to array is really weird.
And one more reason to never use [] for string offsets - clearly, the
bug stems out of confusion between arrays operation (which expects
conversion to array) and string operation (which expects string).
In any case, this needs a note in UPGRADING as behavior change.
-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to