Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91209 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91259 invoked from network); 11 Feb 2016 16:25:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2016 16:25:46 -0000 X-Host-Fingerprint: 2.121.168.115 unknown Received: from [2.121.168.115] ([2.121.168.115:23630] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/BC-25203-806BCB65 for ; Thu, 11 Feb 2016 11:25:44 -0500 Message-ID: To: internals@lists.php.net References: <56A3A01F.1020500@php.net> <56BC988F.7080101@php.net> Date: Thu, 11 Feb 2016 16:25:38 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39 MIME-Version: 1.0 In-Reply-To: <56BC988F.7080101@php.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 2.121.168.115 Subject: Re: [PHP-DEV] [RFC] Generalize support of negative string offsets From: ajf@ajf.me (Andrea Faulds) Hi François, François Laupretre wrote: > String offsets are full of oddities : > > $str = "abc"; > $str{0} = ''; > var_dump($str); // -> string(3) "bc" (read as "\0bc") > > Assigning an empty string to a string offset inserts a null byte because > the string length is not checked in zend_assign_to_string_offset(). > > I see this as a bug. IMO, this case should raise a warning and the > string should remain unchanged. > > Thoughts before I register a bug and a PR ? Wow, that's quite egregious. I think this should be considered a bug and fixed as soon as possible. Whether it should go into 7.0.x or 7.1 is possibly a matter for debate, though. Thanks -- Andrea Faulds https://ajf.me/