-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Promote warnings to error in DOM ext #5418
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
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
417c4d0
Promote warnings to error in DOM ext
Girgias e21c667
Reviews
Girgias 702e062
Review
Girgias a626b03
XPath test addition
Girgias 81022bc
Drop comments and split a warning case
Girgias 59ac05e
Address review
Girgias bff9868
Adjust stubs
Girgias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ PHP_METHOD(DOMElement, __construct) | |
name_valid = xmlValidateName((xmlChar *) name, 0); | ||
if (name_valid != 0) { | ||
php_dom_throw_error(INVALID_CHARACTER_ERR, 1); | ||
return; | ||
RETURN_THROWS(); | ||
} | ||
|
||
/* Namespace logic is separate and only when uri passed in to insure no BC breakage */ | ||
|
@@ -71,7 +71,7 @@ PHP_METHOD(DOMElement, __construct) | |
xmlFreeNode(nodep); | ||
} | ||
php_dom_throw_error(errorcode, 1); | ||
return; | ||
RETURN_THROWS(); | ||
} | ||
} else { | ||
/* If you don't pass a namespace uri, then you can't set a prefix */ | ||
|
@@ -80,14 +80,14 @@ PHP_METHOD(DOMElement, __construct) | |
xmlFree(localname); | ||
xmlFree(prefix); | ||
php_dom_throw_error(NAMESPACE_ERR, 1); | ||
return; | ||
RETURN_THROWS(); | ||
} | ||
nodep = xmlNewNode(NULL, (xmlChar *) name); | ||
} | ||
|
||
if (!nodep) { | ||
php_dom_throw_error(INVALID_STATE_ERR, 1); | ||
return; | ||
RETURN_THROWS(); | ||
} | ||
|
||
if (value_len > 0) { | ||
|
@@ -255,14 +255,14 @@ PHP_METHOD(DOMElement, setAttribute) | |
} | ||
|
||
if (name_len == 0) { | ||
php_error_docref(NULL, E_WARNING, "Attribute Name is required"); | ||
RETURN_FALSE; | ||
zend_argument_value_error(1, "cannot be empty"); | ||
RETURN_THROWS(); | ||
} | ||
|
||
name_valid = xmlValidateName((xmlChar *) name, 0); | ||
if (name_valid != 0) { | ||
php_dom_throw_error(INVALID_CHARACTER_ERR, 1); | ||
RETURN_FALSE; | ||
RETURN_THROWS(); | ||
} | ||
|
||
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern); | ||
|
@@ -294,8 +294,8 @@ PHP_METHOD(DOMElement, setAttribute) | |
attr = (xmlNodePtr)xmlSetProp(nodep, (xmlChar *) name, (xmlChar *)value); | ||
} | ||
if (!attr) { | ||
php_error_docref(NULL, E_WARNING, "No such attribute '%s'", name); | ||
RETURN_FALSE; | ||
zend_argument_value_error(1, "must be a valid XML attribute"); | ||
RETURN_THROWS(); | ||
} | ||
|
||
DOM_RET_OBJ(attr, &ret, intern); | ||
|
@@ -424,8 +424,8 @@ PHP_METHOD(DOMElement, setAttributeNode) | |
DOM_GET_OBJ(attrp, node, xmlAttrPtr, attrobj); | ||
|
||
if (attrp->type != XML_ATTRIBUTE_NODE) { | ||
php_error_docref(NULL, E_WARNING, "Attribute node is required"); | ||
RETURN_FALSE; | ||
zend_argument_value_error(1, "must have the node attribute"); | ||
RETURN_THROWS(); | ||
} | ||
|
||
if (!(attrp->doc == NULL || attrp->doc == nodep->doc)) { | ||
|
@@ -628,8 +628,8 @@ PHP_METHOD(DOMElement, setAttributeNS) | |
} | ||
|
||
if (name_len == 0) { | ||
php_error_docref(NULL, E_WARNING, "Attribute Name is required"); | ||
RETURN_FALSE; | ||
zend_argument_value_error(2, "cannot be empty"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change removes the only false return value :) |
||
RETURN_THROWS(); | ||
} | ||
|
||
DOM_GET_OBJ(elemp, id, xmlNodePtr, intern); | ||
|
@@ -873,10 +873,10 @@ PHP_METHOD(DOMElement, setAttributeNodeNS) | |
|
||
DOM_GET_OBJ(attrp, node, xmlAttrPtr, attrobj); | ||
|
||
if (attrp->type != XML_ATTRIBUTE_NODE) { | ||
php_error_docref(NULL, E_WARNING, "Attribute node is required"); | ||
RETURN_FALSE; | ||
} | ||
/* ZPP Guarantees that a DOMAttr class is given, as it is converted to a xmlAttr | ||
* to pass to libxml (see http://www.xmlsoft.org/html/libxml-tree.html#xmlAttr) | ||
* if it is not of type XML_ATTRIBUTE_NODE it indicates a bug somewhere */ | ||
ZEND_ASSERT(attrp->type == XML_ATTRIBUTE_NODE); | ||
|
||
if (!(attrp->doc == NULL || attrp->doc == nodep->doc)) { | ||
php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document)); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.