On Fri, Mar 5, 2021 at 1:36 PM Christian Schneider <cschn...@cschneid.com> wrote:
> Am 19.02.2021 um 16:21 schrieb Sara Golemon <poll...@php.net>: > > On Fri, Feb 19, 2021 at 8:04 AM Christian Schneider < > cschn...@cschneid.com <mailto:cschn...@cschneid.com>> wrote: > > Indentation in var_export: > > ==================== > > The indentation for > > var_export((object)[(object)[]]); > > is off by one for nested structures: > > (object) array( > > '0' => # <-- extra space before index > > (object) array( > > and the fix would be to change > > buffer_append_spaces(buf, level + 2) > > to > > buffer_append_spaces(buf, level + 1) > > in ext/standard/var.c > > > > This breaks about 60 PHP tests relying on the var_export format. > > > > > > I think shifting the indentation in var_export() could probably be done > without a major BC break. Trimming trailing whitespace would also resolve > one of my long-time annoyances with the function. > > Feel free to propose that as a PR and/or an RFC. > > There is a PR fixing both the indentation and removing the trailing > spaces: https://github.com/php/php-src/pull/6724 > > Do you think this needs an RFC? > Well ... making stylistic changes to var_export() has come up a few times in the past -- by far the most common request is to use [] instead of array(). I think if we're going to make changes here, we should at least include that one as well, to make sure all changes happen at the same time. I'm personally happy with modifying the var_export() output, but from past discussions, I got the impression that not everyone else feels that such cosmetic changes are justified. Nikita