Uh oh!
There was an error while loading. Please reload this page.
Add some ValueErrors to ext/date - #5613
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
5b5fc69 to
71d0b18CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
I am not keen on this change, as this is a BC break. Previously wrong values just returned false, which is something that strtotime and the older date functions have done for decades. Upgrading them to throw an exception is not a great thing to do here. It's going to cause BC breaks, even if people already carefully checked the return values. As most input to date functions will come from either user input or a database, I don't believe this is a worthy place to introduce breaks.
Instead, we should point people to the DateTime classes.
There was a problem hiding this comment.
I am not keen on this change, as this is a BC break. Previously wrong values just returned false, which is something that strtotime and the older date functions have done for decades. Upgrading them to throw an exception is not a great thing to do here. It's going to cause BC breaks, even if people already carefully checked the return values. As most input to date functions will come from either user input or a database, I don't believe this is a worthy place to introduce breaks.
Instead, we should point people to the DateTime classes.
There was a problem hiding this comment.
Are you trying to promote the use of the DateTim(Immutable) class for this specific case, or more generally?
From what I've understood the DateTime classes also return false and don't throw, or would you be more inclined for the objects to throw and be able to drop the false return?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
71d0b18 to
fef9ba0Comparefef9ba0 to
8475547CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
In any case, either do it, or don't add a comment.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
I'm thinking a ValueException or something is OK here, as the function/method specifically asks the code to return an integer since the epoch.
Uh oh!
There was an error while loading. Please reload this page.
ee82bda to
c1b5a49Compare
derickr
left a comment
There was a problem hiding this comment.
I made some minor new comments, but there are a few questions open from previous reviews wrt to idate.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
a9a6628 to
9a54cd7Compare9a54cd7 to
52593f5Compare
derickr
left a comment
There was a problem hiding this comment.
Except for my nit, and ignore the return type hint comments :-)
| ta.tm_zone = offset->abbr; | ||
| #endif | ||
| } | ||
| /** | ||
| * @return int|false | ||
| * @return int |
There was a problem hiding this comment.
Now it returns just an "int", can it not be set as a return type on the function (line 236) itself?
| /** | ||
| * @return int|false | ||
| * @return int |
A new spin on #4976 which is more conservative.
This allows to drop a couple of false returns.
@derickr is this change OK with you?