Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70236 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35321 invoked from network); 20 Nov 2013 15:26:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Nov 2013 15:26:41 -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.219.49 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.49 mail-oa0-f49.google.com Received: from [209.85.219.49] ([209.85.219.49:37963] helo=mail-oa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/E0-27452-0B4DC825 for ; Wed, 20 Nov 2013 10:26:41 -0500 Received: by mail-oa0-f49.google.com with SMTP id i4so4962269oah.8 for ; Wed, 20 Nov 2013 07:26:38 -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=VGC4tzOz9zYDFJ1U0d/P3WFW2lnhfEe0Cmavw6a6Jd4=; b=J1M3FCXzp9FKNVUr7sa4h+MSZMaXm/Ty3RpwQS2us0s0bMaSqVc4Y8dBZykZU0WGLd +Vg7msAVSQ78nW2ERWVXtezLqV4rWYjIMz0N/ddgvha1ZqzlXwoKRVkEomGLUc1IpJki 2KYZZT3bjXT0j7jAP3NwEX6SFpgoBFocJ5G8P/cM/WJiZ1kLqw3YCqUkItibOU56B04t gX29kBFKQ0QCPGsC8zXeQ951K78dRXQ+sdE1xwVC61+LGZCaE7Xm5L1c+pXGkOLaGNHy 4yakRdOD8DzwU+AvQ/ZJ0IzkUXVzMVSdMrWFRPyGyWRSMD+5mp1bkWYOosJzEm0oCuTU xUvw== MIME-Version: 1.0 X-Received: by 10.60.58.166 with SMTP id s6mr982916oeq.40.1384961198167; Wed, 20 Nov 2013 07:26:38 -0800 (PST) Received: by 10.182.54.112 with HTTP; Wed, 20 Nov 2013 07:26:38 -0800 (PST) In-Reply-To: References: Date: Wed, 20 Nov 2013 16:26:38 +0100 Message-ID: To: Yasuo Ohgaki Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e0139faa83e9e8704eb9d68f1 Subject: Re: [PHP-DEV] fix bug #53432 (Assignment via string index access on an empty string converts to array) From: nikita.ppv@gmail.com (Nikita Popov) --089e0139faa83e9e8704eb9d68f1 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Nov 20, 2013 at 12:47 AM, Yasuo Ohgaki wrote: > Hi all, > > This PR seems good fix for 5.6. > > https://github.com/php/php-src/pull/463 > > Test script: > --------------- > $a = ''; // empty string > $a[10] = 'a'; > echo $a; // "Array" > > $b = ' '; // non empty string > $b[10] = 'b'; > echo $b; // " b" > > Expected result: > ---------------- > " a" > " b" > > Actual result: > -------------- > "Array" > " b" > > Current behavior does not make sense. > The current behavior is that anything "falsey" (e.g. null, false and the empty string) is silently cast to array when an array operation is applied to it. I don't like that behavior, but it's somewhat internally consistent now. Changing it for strings *only* seems a bit weird. Nikita --089e0139faa83e9e8704eb9d68f1--