2014-09-25 9:42 GMT+02:00 Dmitry Stogov <dmi...@zend.com>:

> Hi,
>
> The vote is opened at
> https://wiki.php.net/rfc/fix_list_behavior_inconsistency
>
> Thanks. Dmitry.
>

Hi,

I'm in favor of disabling for consistency as well, however, I wish a
warning would be emitted.
Not only it would tell me that I have a potential error while upgrading to
PHP 7 but also if I am using it incorrectly, which is always the case when
using a scalar value.

I therefor propose that:
list($a, $b) = 42;
list($a, $b) = "42";
list($a, $b) = null;
...
generates a warning like: PHP Warning:  list() expects right operand to be
array, <type> given in <path> on line <line>

Currently, all of the above lines wouldn't generate any notice / warning /
error, however, using:
list($a, $b) = [];

generates the following notices:
PHP Notice:  Undefined offset: 1 in ... on line ...
PHP Notice:  Undefined offset: 0 in ... on line ...

This is confusing since (to me) using an array is at least better than
using scalars.

Patrick

Reply via email to