Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

strtotime needs a special case #83

Closed
bendavies opened this issue Jan 22, 2019 · 2 comments
Closed

strtotime needs a special case #83

bendavies opened this issue Jan 22, 2019 · 2 comments

Comments

@bendavies
Copy link

bendavies commented Jan 22, 2019

Hi there!
Thanks for the great library!
I think I've found a bug when integrating safe into my project.

Because of this:
https://3v4l.org/HL9Xn
strtotime('+1 day') is not equivalent to \Safe\strtotime('+1 day'), so looks to need some special handling, to not pass null as the 2nd param if the caller didn't specifically pass null, or enforce int for the 2nd param, or pass time() manually if null.

Thanks

@moufmouf
Copy link
Member

True! The default value for the second parameter in the PHP doc is "time()" (which of course is not a "valid" default value from a PHP standpoint). It gets replaced by null and that causes the issue.

Looking at the documentation, the touch function might also be impacted.

@moufmouf
Copy link
Member

Closed in #85

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants