Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91237 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59356 invoked from network); 16 Feb 2016 11:48:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2016 11:48:27 -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:63751] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 32/94-00200-A8C03C65 for ; Tue, 16 Feb 2016 06:48:26 -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 4F9EA4B0054; Tue, 16 Feb 2016 12:45:28 +0100 (CET) To: Stanislav Malyshev , Nikita Popov References: <56A3A01F.1020500@php.net> <56BC988F.7080101@php.net> <56BD1CD4.8070206@php.net> <56C14AC6.7060307@gmail.com> Cc: Andrea Faulds , PHP internals Message-ID: <56C30C80.3080009@php.net> Date: Tue, 16 Feb 2016 12:48:16 +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: <56C14AC6.7060307@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 160216-0, 16/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 15/02/2016 04:49, Stanislav Malyshev a écrit : > Hi! > >> This fix has been merged into master (targeting 7.1), thanks! > > I'm not sure that was such a good idea (sorry, didn't have time to write > about it before the weekend). Introducing a new warning into previously > working code is a BC break, and one that wasn't even discussed in its > own thread. Moreover, there's one more BC break in this patch - before > it, for this code: > > $str = "abc"; > $str{4} = ''; > var_dump($str); > > the $str was string of length 5, with this fix it would be string of > length 3, unchanged. Which may break other code (e.g. one composing > complex formats) in very subtle ways. And I'm not sure that current > behavior is an improvement. Right. Introducing a BC break in a minor version requires a consensus, and we should probably have discussed about it on the list, instead of github. So, let's discuss it further. As we probably agree that introducing a null byte in the string is a bug, what fix would you suggest ? If we consider the BC break too important for a minor version, another solution could be to consider an empty RHS string as a space character, because this is the padding char used when extending the string. There, we can keep almost the same behavior as the current one, except we put a space instead of a null byte and, maybe, raise an E_NOTICE. So, your example would cause $str to become "abc " instead of "abc \0" and the assignement would return " " instead of "\0". Regards François