Skip to content

Conversation

andreasschroth
Copy link

This warning is easily reproducable under PHP 7.4 with code like this:

\Safe\strtotime('nonsense');

error_get_last() might return null and then an invalid array access occurs.
For more information see this RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container

error_get_last() might return null and then an invalid array access occurs.
For more information see this RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
@Kharhamel
Copy link
Collaborator

Is strtotime the only function that can create this bug? If yes maybe we should edit this function rather than the exception system?

@andreasschroth
Copy link
Author

andreasschroth commented Dec 16, 2019

I believe there's more cases.

But I'm not absolutely sure tbh, but even if that's the case I think it should be fixed that way - if $error is null, it doesn't make sense to try to access it like an array.

@Kharhamel
Copy link
Collaborator

Kharhamel commented Dec 16, 2019

But then why do we throw an exception if $error is null? Maybe it should throw a different kind of exception, or even nothing at all. I am going to look into this when I have a moment.

@Kharhamel
Copy link
Collaborator

the fix was implemented in #170

@Kharhamel Kharhamel closed this Dec 18, 2019
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.

2 participants