Skip to content

Commit 067b293

Browse files
committed
Simplify document standalone setter
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 c426157 commit 067b293

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ext/dom/document.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ 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+
docp->standalone = Z_TYPE_P(newval) == IS_TRUE;
160159

161160
return SUCCESS;
162161
}

0 commit comments

Comments
 (0)