note 123202 added to migration53.incompatible
| From: | chokolatrix@php.net | Date: | Fri, 05 Oct 2018 21:24:22 +0000 |
| Subject: | note 123202 added to migration53.incompatible | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209378@lists.php.net to get a copy of this message | ||
In PHP 5.3, when accessing a string as an array, if the key was a string (non-existing because, for
strings, the keys are integers), first char was returned. Probably it converts the string to
integer, therefore to 0.
PHP 5.4 throws a warning.
$article; // this holds '98765' but you expect an array
// You try to read a value from your "array"
// PHP 5.3 : nothing
// PHP 5.4 : Warning: Illegal string offset at line ...
$value = $article['id_article'];
var_dump($value); // returns: string(1) "9"
.
----
Server IP: 208.43.231.9
Probable Submitter: 2.233.115.153
----
Manual Page -- http://php.net/manual/en/migration53.incompatible.php
Edit -- https://master.php.net/note/edit/123202
Del: integrated -- https://master.php.net/note/delete/123202/integrated
Del: useless -- https://master.php.net/note/delete/123202/useless
Del: bad code -- https://master.php.net/note/delete/123202/bad+code
Del: spam -- https://master.php.net/note/delete/123202/spam
Del: non-english -- https://master.php.net/note/delete/123202/non-english
Del: in docs -- https://master.php.net/note/delete/123202/in+docs
Del: other reasons-- https://master.php.net/note/delete/123202
Reject -- https://master.php.net/note/reject/123202
Search -- https://master.php.net/manage/user-notes.php