Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

kocsismate
Copy link
Member

No description provided.

if (name_length == 0) {
php_error_docref(NULL, E_WARNING, "Invalid parameter name");
return;
zend_argument_value_error(2, "cannot be empty");
Copy link
Member Author

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... :)

@kocsismate kocsismate force-pushed the soap-warning branch 6 times, most recently from df10d30 to 955f289 Compare August 17, 2020 07:15
@php php deleted a comment Aug 24, 2020
}
} 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");
Copy link
Member

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...

Copy link
Member Author

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));
Copy link
Member

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).

Copy link
Member Author

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();
Copy link
Member

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?

Copy link
Member Author

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!

}

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant return

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed when applying!

@php-pulls php-pulls closed this in 47d9446 Sep 1, 2020
@kocsismate kocsismate deleted the soap-warning branch September 1, 2020 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants