FAQ

On Wed, Nov 20, 2013 at 12:47 AM, Yasuo Ohgaki wrote:

Hi all,

This PR seems good fix for 5.6.

https://github.com/php/php-src/pull/463

Test script:
---------------
$a = ''; // empty string
$a[10] = 'a';
echo $a; // "Array"

$b = ' '; // non empty string
$b[10] = 'b';
echo $b; // " b"

Expected result:
----------------
" a"
" b"

Actual result:
--------------
"Array"
" b"

Current behavior does not make sense.
The current behavior is that anything "falsey" (e.g. null, false and the
empty string) is silently cast to array when an array operation is applied
to it. I don't like that behavior, but it's somewhat internally consistent
now. Changing it for strings *only* seems a bit weird.

Nikita

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 10 | next ›
Discussion Overview
groupphp-internals @
categoriesphp
postedNov 19, '13 at 11:48p
activeNov 22, '13 at 1:44a
posts10
users4
websitephp.net

People

Translate

site design / logo © 2022 Grokbase