Re: var_export array syntax
| From: | Larry Garfield | Date: | Thu, 13 Aug 2026 18:41:33 +0000 |
| Subject: | Re: var_export array syntax | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132216@lists.php.net to get a copy of this message | ||
On Thu, Aug 13, 2026, at 1:25 PM, dev@hatlak.de wrote:
> Hi!
>
> I'm a seasoned PHP developer (started around when PHP 2 was still in
> use), yet this is the first time I'm getting involved beyond
> documentation fixes. I have ~0 knowledge in the internals, so bear with
> me.
>
> Since I've been around that long, I've seen PHP evolve steadily. But
> one thing I kept asking myself was why the old array syntax is still
> promoted by some parts of user-facing functions, namely var_export.
> That happens to for example be used by tools like PhpStorm/Xdebug to
> copy current contents of variables while debugging.
>
> My personal preferences (deprecate/kill the old array syntax
> altogether) aside, I wonder what the path forward is and what blocks
> it. RFC var-export-array-syntax has been created 6 years ago but I
> cannot see why it stalled, esp. since it seems to be confined to a very
> specific part of the source code.
>
> I remember to have read somewhere that the current syntax is used in
> many phpt files which would have to be adapted. Given the current day
> and age, that sounds like something that AI would do while asleep. So
> what else would be an issue?
>
> So I thought I'd ask here first before creating yet another RFC that
> might go stale just as quickly as the existing one.
>
> My concrete proposal:
> 1. add a (user) config switch that allows to enable var_dump to use the
> new array syntax, off by default in whichever PHP version this land
> first (e.g. 8.6 if it's not too late already). phpt files can stay as
> is, but a new test for when the switch is On would be needed.
> 2. switch the default to On in a later PHP version (9.0 the latest),
> then adapting the phpt files
> 3. first deprecate and then remove the config switch in even later
> versions
>
> WDYT?
>
> Greetings,
>
> Jens
Without stating an opinion on the matter, here's some prior discussions of the topic:
https://externals.io/message/106674
https://externals.io/message/101883
https://externals.io/message/112924
--Larry Garfield