-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate passing null to non-nullable arg of internal function #6475
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
Zend/zend_API.c
Outdated
@@ -426,9 +426,20 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **p | |||
} | |||
/* }}} */ | |||
|
|||
static ZEND_COLD bool zend_null_arg_deprecated(const char *type) { | |||
zend_string *func_name = get_active_function_or_method_name(); | |||
zend_error(E_DEPRECATED, "%s(): Passing null to argument of type %s is deprecated", |
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.
Shouldn't it say "Passing null as argument" or "Passing null to parameter"?
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've changed it to say "Passing null to parameter".
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 decided to thread through the argument number after all, and provide a more detailed error message:
Deprecated: date_interval_create_from_date_string(): Passing null to parameter #1 ($datetime) of type string is deprecated
dd4e487
to
545a30b
Compare
Yay, all tests passing. |
Implementation for https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg.
TODO: