Skip to content

Commit 746b1cf

Browse files
authored
Access long value directly for call to count() in simplexml (#15278)
Because the signature is checked at compile time, we know that the only possible return value (if there is no exception) is IS_LONG. So we can avoid some work.
1 parent 43def0a commit 746b1cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/simplexml/simplexml.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,8 +1923,8 @@ static zend_result sxe_count_elements(zend_object *object, zend_long *count) /*
19231923
zval rv;
19241924
zend_call_method_with_0_params(object, intern->zo.ce, &intern->fptr_count, "count", &rv);
19251925
if (!Z_ISUNDEF(rv)) {
1926-
*count = zval_get_long(&rv);
1927-
zval_ptr_dtor(&rv);
1926+
ZEND_ASSERT(Z_TYPE(rv) == IS_LONG);
1927+
*count = Z_LVAL(rv);
19281928
return SUCCESS;
19291929
}
19301930
return FAILURE;

0 commit comments

Comments
 (0)