-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Promote warnings to exceptions in ext/soap and ext/xmlwriter #5998
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
e03c2f9
to
17afddb
Compare
if (name_length == 0) { | ||
php_error_docref(NULL, E_WARNING, "Invalid parameter name"); | ||
return; | ||
zend_argument_value_error(2, "cannot be empty"); |
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.
As far as I see, this PR will eliminate a few cases when a constructor returned null... :)
df10d30
to
955f289
Compare
} | ||
} else if (!actor_is_null) { | ||
if ((actor_long == SOAP_ACTOR_NEXT || actor_long == SOAP_ACTOR_NONE || actor_long == SOAP_ACTOR_UNLIMATERECEIVER)) { | ||
add_property_long(this_ptr, "actor", actor_long); | ||
} else { | ||
php_error_docref(NULL, E_WARNING, "Invalid actor"); | ||
zend_argument_value_error(5, "must be either SOAP_ACTOR_NEXT, SOAP_ACTOR_NONE or SOAP_ACTOR_UNLIMATERECEIVER"); |
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 have to wonder wtf UNLIMATERECEIVER is supposed to mean...
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.
:D Do you also suppose it's "ultimate receiver"? As far as I see, Google shows quite some hits for "soap ultimate receiver" :D
ext/soap/soap.c
Outdated
@@ -1146,8 +1145,8 @@ PHP_METHOD(SoapServer, addFunction) | |||
key = zend_string_tolower(Z_STR_P(function_name)); | |||
|
|||
if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { | |||
php_error_docref(NULL, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(function_name)); | |||
return; | |||
zend_argument_type_error(1, "must be a valid callback, function \"%s\" not found", Z_STRVAL_P(function_name)); |
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 error message is a bit misleading, in that it implies that it accepts arbitrary callbacks (not just global functions).
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.
Changed it to "must be a valid function name", if that's ok for you
php_error_docref(NULL, E_WARNING, "Invalid value passed"); | ||
return; | ||
zend_argument_value_error(1, "must be SOAP_FUNCTIONS_ALL when an integer is passed"); | ||
RETURN_THROWS(); |
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 there be one more else below to handle a completely invalid type?
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, I missed that, thanks!
ddd01cc
to
09a6b83
Compare
} | ||
|
||
key = zend_string_tolower(Z_STR_P(tmp_function)); | ||
|
||
if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { | ||
php_error_docref(NULL, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(tmp_function)); | ||
zend_type_error("SoapServer::addFunction(): Function \"%s\" not found", Z_STRVAL_P(tmp_function)); | ||
RETURN_THROWS(); | ||
return; |
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.
Redundant return
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.
Fixed when applying!
No description provided.