-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Promote warnings to exceptions in ext/gettext, ext/sysvmsg and ext/xml #5926
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
83dfe61
to
85a98d3
Compare
f8817aa
to
26137e2
Compare
26137e2
to
ce010dd
Compare
CI failure is not related to these changes (apparently, 05c5c93#r41138411 caused it) |
@nikic I believe these errors promotions should be safe to do. Can I merge this PR? |
@@ -78,7 +78,7 @@ PHP_FUNCTION(textdomain) | |||
RETURN_THROWS(); | |||
} | |||
|
|||
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(domain_len) | |||
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(2, domain_len) |
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.
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(2, domain_len) | |
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(1, domain_len) |
@@ -1029,8 +1029,8 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp | |||
} else if (strcasecmp(encoding_param, "US-ASCII") == 0) { | |||
encoding = (XML_Char*)"US-ASCII"; | |||
} else { | |||
php_error_docref(NULL, E_WARNING, "Unsupported source encoding \"%s\"", encoding_param); | |||
RETURN_FALSE; | |||
zend_argument_value_error(1, "is an unsupported source encoding"); |
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.
zend_argument_value_error(1, "is an unsupported source encoding"); | |
zend_argument_value_error(1, "is not a supported source encoding"); |
...maybe? This reads nicer to me, but your version is also ok.
} | ||
parser->target_encoding = enc->name; | ||
break; | ||
} | ||
default: | ||
php_error_docref(NULL, E_WARNING, "Unknown option"); | ||
RETURN_FALSE; | ||
zend_argument_value_error(2, "must be one of PHP_XML_OPTION_CASE_FOLDING, PHP_XML_OPTION_SKIP_TAGSTART, PHP_XML_OPTION_SKIP_WHITE, PHP_XML_OPTION_TARGET_ENCODING"); |
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.
zend_argument_value_error(2, "must be one of PHP_XML_OPTION_CASE_FOLDING, PHP_XML_OPTION_SKIP_TAGSTART, PHP_XML_OPTION_SKIP_WHITE, PHP_XML_OPTION_TARGET_ENCODING"); | |
zend_argument_value_error(2, "must be a PHP_XML_OPTION_* constant"); |
or similar. I think we should not list out all possible values in cases such as these.
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 like these suggestion so went with them!
These warning promotions remove quite a few
false
return values.