Skip to content

Commit 0122be5

Browse files
authored
Simplify document standalone setter (#15320)
The logic was very weird as it just should check whether the boolean is true or not. And in fact the code is equivalent because zval_get_long() will only return 0/1 because the type is a bool, and ZEND_NORMALIZE_BOOL won't change that value.
1 parent ee02e4b commit 0122be5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/dom/document.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ zend_result dom_document_standalone_write(dom_object *obj, zval *newval)
155155
{
156156
DOM_PROP_NODE(xmlDocPtr, docp, obj);
157157

158-
zend_long standalone = zval_get_long(newval);
159-
docp->standalone = ZEND_NORMALIZE_BOOL(standalone);
158+
ZEND_ASSERT(Z_TYPE_P(newval) == IS_TRUE || Z_TYPE_P(newval) == IS_FALSE);
159+
docp->standalone = Z_TYPE_P(newval) == IS_TRUE;
160160

161161
return SUCCESS;
162162
}

0 commit comments

Comments
 (0)