mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Change dom_node_is_read_only() to return bool (#16757)
Returning int or zend_result doesn't make sense, it's a yes/no question.
This commit is contained in:
parent
cec9a98bc6
commit
7f5a888bdb
5 changed files with 11 additions and 16 deletions
|
@ -73,7 +73,7 @@ PHP_METHOD(DOMDocumentFragment, appendXML) {
|
|||
|
||||
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
|
||||
|
||||
if (dom_node_is_read_only(nodep) == SUCCESS) {
|
||||
if (dom_node_is_read_only(nodep)) {
|
||||
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
|
|
@ -837,8 +837,8 @@ static xmlNodePtr dom_insert_fragment(xmlNodePtr nodep, xmlNodePtr prevsib, xmlN
|
|||
|
||||
static bool dom_node_check_legacy_insertion_validity(xmlNodePtr parentp, xmlNodePtr child, bool stricterror, bool warn_empty_fragment)
|
||||
{
|
||||
if (dom_node_is_read_only(parentp) == SUCCESS ||
|
||||
(child->parent != NULL && dom_node_is_read_only(child->parent) == SUCCESS)) {
|
||||
if (dom_node_is_read_only(parentp) ||
|
||||
(child->parent != NULL && dom_node_is_read_only(child->parent))) {
|
||||
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror);
|
||||
return false;
|
||||
}
|
||||
|
@ -1279,8 +1279,8 @@ static void dom_node_remove_child(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry
|
|||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (dom_node_is_read_only(nodep) == SUCCESS ||
|
||||
(child->parent != NULL && dom_node_is_read_only(child->parent) == SUCCESS)) {
|
||||
if (dom_node_is_read_only(nodep) ||
|
||||
(child->parent != NULL && dom_node_is_read_only(child->parent))) {
|
||||
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
|
|
@ -699,8 +699,8 @@ void dom_parent_node_before(dom_object *context, zval *nodes, uint32_t nodesc)
|
|||
|
||||
static zend_result dom_child_removal_preconditions(const xmlNode *child, const dom_object *context)
|
||||
{
|
||||
if (dom_node_is_read_only(child) == SUCCESS ||
|
||||
(child->parent != NULL && dom_node_is_read_only(child->parent) == SUCCESS)) {
|
||||
if (dom_node_is_read_only(child) ||
|
||||
(child->parent != NULL && dom_node_is_read_only(child->parent))) {
|
||||
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(context->document));
|
||||
return FAILURE;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ typedef struct dom_prop_handler {
|
|||
dom_write_t write_func;
|
||||
} dom_prop_handler;
|
||||
|
||||
int dom_node_is_read_only(const xmlNode *node) {
|
||||
bool dom_node_is_read_only(const xmlNode *node) {
|
||||
switch (node->type) {
|
||||
case XML_ENTITY_REF_NODE:
|
||||
case XML_ENTITY_NODE:
|
||||
|
@ -166,14 +166,9 @@ int dom_node_is_read_only(const xmlNode *node) {
|
|||
case XML_ATTRIBUTE_DECL:
|
||||
case XML_ENTITY_DECL:
|
||||
case XML_NAMESPACE_DECL:
|
||||
return SUCCESS;
|
||||
break;
|
||||
return true;
|
||||
default:
|
||||
if (node->doc == NULL) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
return node->doc == NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr basep, xmlNodePtr nodep,
|
|||
void php_dom_create_implementation(zval *retval, bool modern);
|
||||
int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child);
|
||||
bool dom_has_feature(zend_string *feature, zend_string *version);
|
||||
int dom_node_is_read_only(const xmlNode *node);
|
||||
bool dom_node_is_read_only(const xmlNode *node);
|
||||
bool dom_node_children_valid(const xmlNode *node);
|
||||
void php_dom_create_iterator(zval *return_value, dom_iterator_type iterator_type, bool modern);
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, const char *local, size_t local_len, const char *ns, size_t ns_len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue