Hi,
Please take a look and make your opinion.
https://wiki.php.net/rfc/fix_list_behavior_inconsistency
This inconsistency might be interpreted like a bug, but fixing it might
break existing PHP code (at least my attempt to fix it in documented way
broke few phpt tests).
Thanks. Dmitry.
Hi!
Please take a look and make your opinion.
https://wiki.php.net/rfc/fix_list_behavior_inconsistency
This inconsistency might be interpreted like a bug, but fixing it might
break existing PHP code (at least my attempt to fix it in documented way
broke few phpt tests).
I think it makes sense to make list($a, $b, ...) = <something> to mean:
$a = <something>[0]
$b = <something>[1]
...etc...
This is how it works in most cases, not sure why it doesn't work when
<something> is a string literal, but I think it should work the same too.
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
Please take a look and make your opinion.
https://wiki.php.net/rfc/fix_list_behavior_inconsistency
This inconsistency might be interpreted like a bug, but fixing it might
break existing PHP code (at least my attempt to fix it in documented way
broke few phpt tests).
I think it makes sense to make list($a, $b, ...) = <something> to mean:
$a = <something>[0]
$b = <something>[1]
...etc...This is how it works in most cases, not sure why it doesn't work when
<something> is a string literal, but I think it should work the same too.
Isn't this just a side affect of making a simple string also look like
an array? One has to assume first that what is returned is a simple byte
string array while currently is IS possible that it will contain unicode
characters? So should it not be looked at n the context of the whole
PHP7 discussion rather than trying to fix more edge cases in isolation?
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
One has to assume first that what is returned is a simple byte
string array while currently is IS possible that it will contain unicode
characters?
Well, currently, every single string function in PHP treats a string as
a simple byte array, apart from those in the mbstring and intl extensions.
What's more, there isn't really a single meaning of the term "Unicode
character" - at its simplest, there are code points, but they're not
necessarily the most useful unit; as I mentioned before [1], people
often actually want to work with "grapheme clusters", what a writer of
the language would consider "a single character".
If more integrated Unicode support is ever added, it will presumably be
in the form of a new data type; if that type implements $foo[0] to mean
"first grapheme cluster", then it would be natural for list($a,) = $foo
to do the same. But there is no reason for that to stop list($a,) = $foo
being equivalent to $foo[0] for existing strings, and mean "first byte".
[1] http://news.php.net/php.internals/72914
--
Rowan Collins
[IMSoP]
Please take a look and make your opinion.
https://wiki.php.net/rfc/fix_list_behavior_inconsistency
This inconsistency might be interpreted like a bug, but fixing it might
break existing PHP code (at least my attempt to fix it in documented way
broke few phpt tests).
But at least your option "Enable string handling in all cases" makes
additional things work, instead of making things no longer work.
I realize that:
list($a,$b) = "aa";var_dump($a,$b);
Will now start returning something else than NULL, but I would almost
consider that a bug. I would definitely elect to vote for "Enable string
handling in all cases" as it IMO actually fixes something.
cheers,
Derick
Both decisions make sense. I'm indifferent which one to make.
Just not to keep the undocumented inconsistency :)
Thanks. Dmitry,
Please take a look and make your opinion.
https://wiki.php.net/rfc/fix_list_behavior_inconsistency
This inconsistency might be interpreted like a bug, but fixing it might
break existing PHP code (at least my attempt to fix it in documented way
broke few phpt tests).But at least your option "Enable string handling in all cases" makes
additional things work, instead of making things no longer work.I realize that:
list($a,$b) = "aa";var_dump($a,$b);
Will now start returning something else than NULL, but I would almost
consider that a bug. I would definitely elect to vote for "Enable string
handling in all cases" as it IMO actually fixes something.cheers,
Derick