Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74672 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30885 invoked from network); 1 Jun 2014 18:56:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2014 18:56:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=kassner@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kassner@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.174 as permitted sender) X-PHP-List-Original-Sender: kassner@gmail.com X-Host-Fingerprint: 209.85.212.174 mail-wi0-f174.google.com Received: from [209.85.212.174] ([209.85.212.174:61810] helo=mail-wi0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/A2-15017-4677B835 for ; Sun, 01 Jun 2014 14:56:37 -0400 Received: by mail-wi0-f174.google.com with SMTP id r20so3463495wiv.7 for ; Sun, 01 Jun 2014 11:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=45W2GDwC3A6cS1heKL2ZFUnW2hzN15zZW8ONt71xrYo=; b=rJ+WZg68V8LVPgH+1iGNAkmcmIVplL+nsl8lRZ/G0hWAPo4u0ygICv2TZ5WVWJLYp6 hozJYk38pZ8B6KtlR5/RTheo+zyvTA6K8fCjvO7AunG15jIWpCIkI2oyhUSRwqH4YRTS vSeEBkg0DevlHvUtFqAClGxKzxI3GbZeH/futecnY+oFwZKSqSr3hLSNuFRhI7T0u84s stPRTfDkABJmzYFBRUXbBKbueUurp4PgYpII2lfRWrKKfOZ34ZETu9v+9Zf7zFvvzadF 7VDSozIVYOzPqCfwAOGRBrT4JhJnTrjMFr9bYMvm8bkb25TURel0d3xSRv+JN8dcTxYD UYcQ== X-Received: by 10.194.108.5 with SMTP id hg5mr42698783wjb.57.1401648993937; Sun, 01 Jun 2014 11:56:33 -0700 (PDT) MIME-Version: 1.0 Sender: kassner@gmail.com Received: by 10.194.2.47 with HTTP; Sun, 1 Jun 2014 11:56:13 -0700 (PDT) In-Reply-To: <71878B94-F83E-4787-BC5C-75F43FB00911@ajf.me> References: <6E3D6B3F-1BD6-42A2-B59C-12B9D6D597ED@ajf.me> <538B6D49.3030402@sugarcrm.com> <2F19394F-C75C-40E8-94C3-507FAA9ADE28@ajf.me> <71878B94-F83E-4787-BC5C-75F43FB00911@ajf.me> Date: Sun, 1 Jun 2014 15:56:13 -0300 X-Google-Sender-Auth: Rw661p1DY1NtZwxTkj7MPiq6zrI Message-ID: To: Andrea Faulds Cc: Stas Malyshev , PHP internals Content-Type: multipart/alternative; boundary=089e0103defa62349a04facad62b Subject: Re: [PHP-DEV] [RFC] Bare Name Array From: kassner@php.net (Rafael Kassner) --089e0103defa62349a04facad62b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable You missed my point, I'm not saying about undefined constants, I'm saying about the usage of defined constants as array keys. If the array declaration don't expand constants to strings anymore, many code will break. If we expand constants within array declaration, someone can mess up the code by adding a define() somewhere above and don't even realize what's wrong (constants have global scope). On Sun, Jun 1, 2014 at 3:49 PM, Andrea Faulds wrote: > > On 1 Jun 2014, at 19:47, Rafael Kassner wrote: > > > This causes a huge backward incompatibility: > > > > define('KEY', 'foo'); > > $data =3D array(KEY =3D> 'bar'); > > > > Should $data have 'foo' or 'KEY' as element? AFAIK, some frameworks use > this constants in array keys. > > =E2=80=98foo=E2=80=99, I checked. Frameworks doing that should really not= be, it=E2=80=99s really > bad practise to rely on PHP=E2=80=99s fallback for non-existent constants= , and that > generates a Notice. > > Now you=E2=80=99d have the option of doing array(KEY: =E2=80=98bar=E2=80= =99) though, which does > not resolve the constant. > -- > Andrea Faulds > http://ajf.me/ > > > > > --089e0103defa62349a04facad62b--