-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PHP82] DateTime modify does not work with addition of minus values #9950
Comments
You are right that this is a change, but it is expected and on purpose to fix another bug: derickr/timelib@44cfe97 / derickr/timelib#124 It now picks the first sign that it finds... although perhaps it should warn on the second sign. In any case, the workaround is to change the |
FWIW, the original behaviour was pretty much a bug, so I don't think we need to do anything here, and hence I'm closing this issue. |
@derickr I know you closed this, but I just wanted to add that this change also affected strtotime, which broke applications under test in 8.2 in a non-obvious manner (caused duplication of dates in a dynamic built array that then caused data overwriting) and I couldn't find it listed as a PHP 8.2 breaking change anywhere. I've requested to see if PHPStan or PHPCompatibility (for codesniffer) can help detect this as a breaking change. As it was accepted methodology previously (albeit not to the written standard, I accept that) it may cause other breakages that are non-obvious. |
Documented as php/doc-en@cf220d0. |
The other variation, -+, is also no longer possible in 8.2 but worked (in the mathematical sense) in PHP versions from somewhere in PHP5 up to PHP8.1 as well (not that it's likely to happen in most code, but was possible if you were [un]suitably minded). |
@aquavark, done with php/doc-en@ef51b1c. |
Appreciate the update. Thanks. |
Description
The following code:
Resulted in this output:
But I expected this output instead:
https://3v4l.org/6eMQj
It did work before RC3. I am not sure if this is intended or not 😅
PHP Version
PHP 8.2.0 RC6
Operating System
macOs Ventura 13.1 Beta 2
The text was updated successfully, but these errors were encountered: