Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106684 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45525 invoked from network); 21 Aug 2019 10:55:12 -0000 Received: from unknown (HELO mail-qt1-f178.google.com) (209.85.160.178) by pb1.pair.com with SMTP; 21 Aug 2019 10:55:12 -0000 Received: by mail-qt1-f178.google.com with SMTP id x4so2031361qts.5 for ; Wed, 21 Aug 2019 01:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pI3GSVkb6eSsXx7tPbmXK2x8KP4NuRjqu9Fcmyhsl54=; b=tAQC5qRxtv1U0TlvLMW3cw9s80RzIXxO+XMQeJN/opQF2VtOh+5bxbu2pJEdd8yaaq zkYd8CB2D5GvCWimRpD1I/bGIL6mnWx2H/Q8sqjtlDyOCdFoZ5O3j3+OJl2gOJI0koS3 6l1wTC9O/qqXr/79JBY8OOAgmZhfJVJYSOoxDRMadUgvQBVuCrjkRcsVrJGIh+9Be9NF HoCbgkEdaWDF+VupeAS5ca3qOhCmaWiJH3xgtyIeCy7XDjeKV23jNqggHsfnxVjKghDH UatO3GFSx1jx4eKH8Ijgda6NycXyaHXoK0Yr1m/KLiYwAbqLnu/uF4RrAZDqlAIv8b0m A2zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pI3GSVkb6eSsXx7tPbmXK2x8KP4NuRjqu9Fcmyhsl54=; b=DFIbl2s2eRArgGq+m423T7CnZc4NoDOdpRNXp1bAPQ29zpSoJeCnYjQ7J1qP9LVVRN ICuihovkuzei5/B1kXvgTDuQdPT96iwDC2fKCLX8nRfx0DvBdcwuI8riS1SEFJD4vgZp PTaeDfOsH+Gk+MFGM8NV0ilAx/HHNBdacH3W44rln65q4ZJGwXyuoYDDpm16hUKMZPam MfRPmZthCOwqErJtPEn3PhIrabBRbrduJ0MVgJGxXfQ2rOhAuSjp8KkhilZXCA+ty3dG hmGNyAhQPcMtEpo50jEAGH43RKN31OXrC/tnUiXW8AdHL2e/MmDTFLmMGk4nAK3y2Zoy IaTw== X-Gm-Message-State: APjAAAUQ4thgRbtQdYEyih+mpS4xR4gVkQ30FXbvMgIQA1jygkfUh2b6 kmFatHHk7Ml++06/7y+D8DgJ1rpZTCo= X-Google-Smtp-Source: APXvYqyTKeQMyHqrLnwOkZPCMVGLPDqVCWNgPAYS17+IaKQ+8cUrFULK1lC+FnBXILdzt943I1YwdQ== X-Received: by 2002:a0c:81b8:: with SMTP id 53mr16683993qvd.91.1566375932880; Wed, 21 Aug 2019 01:25:32 -0700 (PDT) Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com. [209.85.222.176]) by smtp.googlemail.com with ESMTPSA id e15sm8989363qtr.51.2019.08.21.01.25.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Aug 2019 01:25:31 -0700 (PDT) Received: by mail-qk1-f176.google.com with SMTP id d23so1108966qko.3 for ; Wed, 21 Aug 2019 01:25:30 -0700 (PDT) X-Received: by 2002:a05:620a:1113:: with SMTP id o19mr29382468qkk.46.1566375930622; Wed, 21 Aug 2019 01:25:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 21 Aug 2019 10:25:18 +0200 X-Gmail-Original-Message-ID: Message-ID: To: =?UTF-8?B?0JLQu9Cw0LQg0JzQsNC60LjQvQ==?= Cc: Sara Golemon , PHP internals Content-Type: multipart/alternative; boundary="000000000000edfb2d05909c5086" Subject: Re: [PHP-DEV] RFC: var_export - short syntax for array From: andreas@dqxtech.net (Andreas Hennings) --000000000000edfb2d05909c5086 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Avoiding disruption is indeed a concern. As an example, Drupal 7 features module uses a custom variation of var_export() to write configuration to code, which is then typically tracked in git. I am not sure if changing the native var_export() would have an impact here, and anyway the module can be updated if necessary, to guarantee stability of the output. What I would ask is to limit the frequency of change in this function, or make it opt-in. There are other issues with the format besides just the long array syntax. E.g. opening bracket on same line? Indentation? https://3v4l.org/MFLgd Ideally all of this would be "normalized" in one go, based on popular convention (psr-whichever), or it should be opt-in. Alternatively there could be a new function or class, leaving var_export() alone. =D0=92=D0=BB=D0=B0=D0=B4 =D0=9C=D0=B0=D0=BA=D0=B8=D0=BD = schrieb am Mi., 21. Aug. 2019, 08:55: > Thanks for the feedback! I will back with improved version of RFC. > > =D0=B2=D1=82, 20 =D0=B0=D0=B2=D0=B3. 2019 =D0=B3., 23:01 Sara Golemon : > > > On Tue, Aug 20, 2019 at 1:05 PM =D0=92=D0=BB=D0=B0=D0=B4 =D0=9C=D0=B0= =D0=BA=D0=B8=D0=BD wrote: > > > >> I would like to propose a little change in var_export function behavio= r. > >> For today, this function returns string representation of array in old > >> style with =E2=80=9Carray=E2=80=9D keyword: > >> > >> var_export([]); // array() > >> > >> I think it would be better if the function returned array representati= on > >> in > >> modern square brackets syntax: > >> > >> var_export([]); // [] > >> > >> I do like the idea of doing this, and would even be generally okay wit= h > > just making always work that way since the introduction of square brack= et > > syntax is really *quite* old. > > > > The only people I could see being bothered by the change in output woul= d > > be automated code-generation suddenly seeing a (potentially quite > massive) > > diff as the bracket style changes. As an example, > > https://github.com/php/web-php/blob/master/include/releases.inc is a 10= k > > line var_export() generated list. I'm actually /not/ bothered by the > idea > > of having a big point-in-time flip of that structure, though I'd want t= o > > make sure all RMs switch versions at the same time, otherwise it could > get > > noisy. > > > > Perhaps an option to quell any dissent might be to add a third param > > $options to allow controlling this behavior. > > > > function var_export(mixed $data, bool $return =3D false, int $options = =3D 0): > > string {} > > > > And you could either pass EXPORT_SHORT_ARRAY or EXPORT_LONG_ARRAY or > > whatever you want to call the constants depending on which behavior you= 'd > > make default (and honestly, I think we'd make the existing format > default). > > > > -Sara > > > --000000000000edfb2d05909c5086--