-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Promote Intl warnings to standard ValueError #5669
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
Conversation
c8ff4b1
to
e1a1aeb
Compare
e1a1aeb
to
df9a403
Compare
df9a403
to
8c05241
Compare
If there are no objections I'll merge this at the end of the week |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good, but I think is missing some stub updates for IntlCalendar. E.g. fieldDifference can no longer return false, right?
@@ -355,6 +362,7 @@ static void _php_intlcal_before_after( | |||
CALENDAR_METHOD_FETCH_OBJECT; | |||
|
|||
when_co = Z_INTL_CALENDAR_P(when_object); | |||
/* Can this ever happen ? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be possible, e.g. via newInstanceWithoutConstructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, does are usually Errors right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we use Error for uninitialized objects.
8c05241
to
3d2d808
Compare
I promoted a couple more to ValueError, however in regards to the stubs I'm very confused as to why there are two different ones for the calendar proceduaral functions? I thought those were taken care by the aliasing of the Class methods? |
Can you please avoid rebasing and amending commits at the same time? This means the whole PR has to be reviewed from scratch every time, because it's not possible to see what changed.
The |
Okay will do that next time
Ah, understood |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
3d2d808
to
76ddff9
Compare
intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, | ||
"intlcal_before/after: Other IntlCalendar was unconstructed", 0); | ||
RETURN_FALSE; | ||
zend_argument_error(NULL, 2, "object is not fully initialized"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the error message this generates will make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this better?
zend_argument_error(NULL, 2, "object is not fully initialized"); | |
zend_argument_error(NULL, 2, "must be constructed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe?
zend_argument_error(NULL, 2, "object is not fully initialized"); | |
zend_argument_error(NULL, 2, "is uninitialized"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's better :D
Will go with that and merge it directly then. :)
@@ -1085,6 +1079,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time) | |||
object_init_ex(return_value, php_date_get_date_ce()); | |||
zend_call_known_instance_method_with_2_params( | |||
Z_OBJCE_P(return_value)->constructor, Z_OBJ_P(return_value), NULL, &ts_zval, timezone_zval); | |||
// TODO Bubble up exception? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually before I merge it, @nikic should I do that in this PR or just leave the TODO comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to change.
Seems no test are covering these cases
This was fixed in ICU 50.1 which is required as of PHP 7.4
76ddff9
to
ed93fb8
Compare
As Intl is rather large I think I will split this up into multiple PRs