Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91230 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94256 invoked from network); 14 Feb 2016 17:42:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2016 17:42:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.182 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.182 mail-yw0-f182.google.com Received: from [209.85.161.182] ([209.85.161.182:33223] helo=mail-yw0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/B1-03820-D9CB0C65 for ; Sun, 14 Feb 2016 12:42:54 -0500 Received: by mail-yw0-f182.google.com with SMTP id u200so99798130ywf.0 for ; Sun, 14 Feb 2016 09:42:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=aG0jXXFvD41/qwMOw4JhAMNOOl+VH1Uj9sqpv7HbbaA=; b=FJadtTO0EZ4Oi/VqrU5aRvSqEaPWCdFiwACbkLVdfzev3U4E/mesAZGe7TtPHU9yRy dQ5hMPDtwwN63KnRssQA99B498fTKvYvP+VsfR5gmc+dpUpdBaa4L+nzgo3A9tIAyCJD 3qcjJtIpfzMXHg7QnpbGa84lbQDhCnpMJfHexmctYU72ksWyacNQAD3l2HzTMMNlLs3/ t+o/tzfppminLpUv4tJcvDBLy9Zm5EuAHJyLXRYjSnkr+Mc+EF7bj5jBq4ZAtSkdvtbE 2bBM+ymkld74n1/EbIOKvYy8fPQAsmIxro9HxdWuPDFcbgaQhwc8rv/VgRGT4nLR9l6U bYRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=aG0jXXFvD41/qwMOw4JhAMNOOl+VH1Uj9sqpv7HbbaA=; b=mikC4eq30futNJK7+m9Zgl1xYYK5aw/RC6u+rriIGPgAGaLn4viflx17rJgt7R7Vgm GBFaGEBjPOCAJP9M8gnt7sbVBbiyCDtFfYnZYlNPG/4FcUocY1DMwizGD+ah0IizUvGS GIWCs8imvSLm3PIjR2kJ+TebyBifEfkblrHPn+GVIlsb8GyBgD5tCqWIea1BnmfAEEen hmsT0xVT8q2CSXdBWgapuQQJXerxt13cHhSO/dKKnsRWYsfhV5Sb0S0xwEWLaHPOhatV D0VKHZEbZuNjHFNz3pPOeEuNaJmqQ8lsb8CEtRMgTpS7BA5ubbeqIuYT8bZipq8jeyCm NDTg== X-Gm-Message-State: AG10YOTfnySPNJ90e70Oikd/y429cFxBrWTlKmj/8cjnraa1xMvd+u3+Kp2u80JCpAwJ63mFlcQYaKGZPVKQRw== MIME-Version: 1.0 X-Received: by 10.129.50.15 with SMTP id y15mr6794768ywy.305.1455471770945; Sun, 14 Feb 2016 09:42:50 -0800 (PST) Received: by 10.129.148.70 with HTTP; Sun, 14 Feb 2016 09:42:50 -0800 (PST) In-Reply-To: <56BD1CD4.8070206@php.net> References: <56A3A01F.1020500@php.net> <56BC988F.7080101@php.net> <56BD1CD4.8070206@php.net> Date: Sun, 14 Feb 2016 18:42:50 +0100 Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: Andrea Faulds , PHP internals , Stanislav Malyshev Content-Type: multipart/alternative; boundary=001a11408daee352f4052bbe6dcb Subject: Re: [PHP-DEV] [RFC] Generalize support of negative string offsets From: nikita.ppv@gmail.com (Nikita Popov) --001a11408daee352f4052bbe6dcb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Feb 12, 2016 at 12:44 AM, Fran=C3=A7ois Laupretre wrote: > Le 11/02/2016 17:25, Andrea Faulds a =C3=A9crit : > >> Hi Fran=C3=A7ois, >> >> Fran=C3=A7ois Laupretre wrote: >> >>> String offsets are full of oddities : >>> >>> $str =3D "abc"; >>> $str{0} =3D ''; >>> var_dump($str); // -> string(3) "bc" (read as "\0bc") >>> >>> Assigning an empty string to a string offset inserts a null byte becaus= e >>> 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=3D71572) along with P= R ( > https://github.com/php/php-src/pull/1761). > > Can someone please review/merge the PR and close the bug ? > This fix has been merged into master (targeting 7.1), thanks! Another issue mentioned in this thread is the spurious array conversion that happens for empty strings. We have an existing bug report for this: https://bugs.php.net/bug.php?id=3D53432 I've created a PR to fix this issue= : https://github.com/php/php-src/pull/1764 If there are no objections, I'll merge this for 7.1 as well. Nikita --001a11408daee352f4052bbe6dcb--