Bug->Doc #73925 [Opn]: BC break on array overriding declared string

From: Date: Fri, 13 Jan 2017 14:28:45 +0000
Subject: Bug->Doc #73925 [Opn]: BC break on array overriding declared string
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14332@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73925&edit=1 ID: 73925 Updated by: nikic@php.net Reported by: zoeslam at gmail dot com Summary: BC break on array overriding declared string Status: Open -Type: Bug +Type: Documentation Problem Package: *General Issues Operating System: Linux PHP Version: 7.1.0 Block user comment: N Private report: N New Comment: Correct. The linked section currently only refers to the []= operation, while the same also applies to any [X]=. Previous Comments: ------------------------------------------------------------------------ [2017-01-13 14:14:08] zoeslam at gmail dot com Maybe more linked to https://secure.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.empty-string-index-operator but still an undocumented BC break to me ------------------------------------------------------------------------ [2017-01-13 14:06:29] zoeslam at gmail dot com Description: ------------ PHP 7.1.0 changed a behaviour that was there from ages: array access overriding a previously declared string. https://3v4l.org/25AIu As far as I can read the docs, this change is a BC break and is NOT listed in the upgrading guide: https://secure.php.net/manual/en/migration71.other-changes.php Even though is similar to the "Notices and warnings on arithmetic with invalid strings" change. Test script: --------------- $string = ''; $string[0] = array(1); var_dump($string); Expected result: ---------------- array(1) { [0]=> array(1) { [0]=> int(1) } } Actual result: -------------- Notice: Array to string conversion in /in/25AIu on line 4 string(1) "A" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73925&edit=1

« previous php.doc.bugs (#14332) next »