Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91214 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16028 invoked from network); 11 Feb 2016 23:44:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2016 23:44:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:9274] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/5F-25203-EDC1DB65 for ; Thu, 11 Feb 2016 18:44:30 -0500 Received: from [127.0.0.1] (unknown [82.240.16.115]) (Authenticated sender: flaupretre@free.fr) by smtp2-g21.free.fr (Postfix) with ESMTPSA id B60064B0109; Fri, 12 Feb 2016 00:41:45 +0100 (CET) To: Andrea Faulds , internals@lists.php.net, Stanislav Malyshev References: <56A3A01F.1020500@php.net> <56BC988F.7080101@php.net> Message-ID: <56BD1CD4.8070206@php.net> Date: Fri, 12 Feb 2016 00:44:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 160211-1, 11/02/2016), Outbound message X-Antivirus-Status: Clean Subject: Re: [PHP-DEV] [RFC] Generalize support of negative string offsets From: francois@php.net (=?UTF-8?Q?Fran=c3=a7ois_Laupretre?=) Le 11/02/2016 17:25, Andrea Faulds a écrit : > 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 > OK. Bug registered (https://bugs.php.net/bug.php?id=71572) along with PR (https://github.com/php/php-src/pull/1761). Can someone please review/merge the PR and close the bug ? Thanks François