mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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.
This commit is contained in:
parent
43def0af46
commit
746b1cf43e
1 changed files with 2 additions and 2 deletions
|
@ -1923,8 +1923,8 @@ static zend_result sxe_count_elements(zend_object *object, zend_long *count) /*
|
||||||
zval rv;
|
zval rv;
|
||||||
zend_call_method_with_0_params(object, intern->zo.ce, &intern->fptr_count, "count", &rv);
|
zend_call_method_with_0_params(object, intern->zo.ce, &intern->fptr_count, "count", &rv);
|
||||||
if (!Z_ISUNDEF(rv)) {
|
if (!Z_ISUNDEF(rv)) {
|
||||||
*count = zval_get_long(&rv);
|
ZEND_ASSERT(Z_TYPE(rv) == IS_LONG);
|
||||||
zval_ptr_dtor(&rv);
|
*count = Z_LVAL(rv);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue