Hi internals,
At the moment, date_get_last_errors()
returns arrays that are keyed by
the character position of where the error was encountered.
While it is useful to have this character position available, using it
as the array keys means that in the case where more than one error is
raised at the same character position only one error message is
returned to userland. There are several situations where this can
occur, and this is not necessarily incorrect behaviour. This also
causes the count fields to report more errors than the number of
strings returned.
This causes bugs such as https://bugs.php.net/bug.php?id=64975 to be
opened - the behaviour exhibited there is by-design, but the
accompanying error message gets eaten by the next error at the same
position.
I propose that the returned array format be modified so that the inner
arrays are zero-indexed and the elements are themselves arrays, where
the character position is the first element and the error message is
the second - unless, that is, anyone has any objections/better ideas.
As a side note, I have submitted a PR on Github with a fix for the
specific case in the bug mentioned above, which solves the problem by
avoiding raising another error at the same character position. I would
appreciate it if someone with php-src karma could review and merge it
asap.
Thanks, Chris