Skip to content

Promote warnings to exceptions in ext/simplexml #6011

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 5 commits into from

Conversation

kocsismate
Copy link
Member

No description provided.

@@ -400,7 +400,7 @@ static void change_node_zval(xmlNodePtr node, zval *value)
}
break;
default:
php_error_docref(NULL, E_WARNING, "It is not possible to assign complex types to nodes");
zend_type_error("It's not possible to assign a complex type to nodes, %s given", zend_zval_type_name(value));
Copy link
Member

Choose a reason for hiding this comment

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

Error condition seems to be untested.

Copy link
Member Author

@kocsismate kocsismate Aug 24, 2020

Choose a reason for hiding this comment

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

Uh, I couldn't trigger this error case in the newly added test :/

@@ -411,7 +411,7 @@ static zval *sxe_prop_dim_write(zend_object *object, zval *member, zval *value,
* and could also be E_PARSE, but we use this only during parsing
* and this is during runtime.
*/
zend_throw_error(NULL, "Cannot create unnamed attribute");
zend_throw_error(NULL, "Cannot append to an attribute list");
Copy link
Member

Choose a reason for hiding this comment

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

I'd leave only the first line of the preceding comment.

@kocsismate
Copy link
Member Author

ext/simplexml/tests/bug37076_1.phpt fails because there's a memory leak somewhere - it seems to me that the new exception revealed it :S

* * &EG(error_zval), if an exception has been thrown.
* * NULL, if acquiring a direct pointer is not possible.
* In this case, the VM will fall back to using read_property and write_property.
*/
Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the this explanation, it's really useful! Of course, I'm grateful for the fix, too :)

@php-pulls php-pulls closed this in 6c8fb12 Aug 25, 2020
@kocsismate kocsismate deleted the simplexml-warning branch August 25, 2020 13:16
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