Skip to content

Add failing test for array#51

Closed
Nek- wants to merge 8 commits into
nette:masterfrom
Nek-:fix/array-dump
Closed

Add failing test for array#51
Nek- wants to merge 8 commits into
nette:masterfrom
Nek-:fix/array-dump

Conversation

@Nek-

@Nek- Nek- commented Jan 17, 2020

Copy link
Copy Markdown
  • bug fix (that is only bug exposition ATM)
  • BC break? no

Hello, I found this bug :(.

@dg

dg commented Jan 17, 2020

Copy link
Copy Markdown
Member

I can't see it.

@Nek-

Nek- commented Jan 17, 2020

Copy link
Copy Markdown
Author

@dg what can't you see? (the test failure is not good enough for you?)

I was not able to make a good fix for it :/.

@JanTvrdik

JanTvrdik commented Jan 18, 2020

Copy link
Copy Markdown
Contributor

The current behavior is intentional. See

$keyPart = $k === $counter ? '' : $this->dumpVar($k) . ' => ';

Maybe there should be an option to disable this?

@dg

dg commented Jan 18, 2020

Copy link
Copy Markdown
Member

Ok I get it. But it's not a bug, just a cosmetic thing because [606990006 => 'bar', 606990007 => 'baz'] is the same as [606990006 => 'bar', 'baz'].

@Nek-

Nek- commented Jan 19, 2020

Copy link
Copy Markdown
Author

@dg absolutely. But this is also assuming PHP behaves like that, which is weird. And I think all weird stuff should not be considered as "this is good".

Of course, it's also extremely disturbing for people that will use generated classes, that's mostly why I'm suggesting to support this.

An option is probably the better idea, yes :).

@dg

dg commented Jan 20, 2020

Copy link
Copy Markdown
Member

I would not call it a weird, it is a documented standard behavior that I like to use, for example in $months = [1 => 'January', 'February', 'March', 'April', 'May', 'June', ...]. But I understand that in the dumps where most keys are present, the missing ones are confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants