Skip to content

Commit f09448c

Browse files
committed
Expose zendi_try_get_long() function via a public API
1 parent 4cee2c0 commit f09448c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Zend/zend_operators.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,15 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(zval *op, bo
403403
}
404404
/* }}} */
405405

406+
ZEND_API zend_long ZEND_FASTCALL zend_try_get_long(zval *op, bool *failed)
407+
{
408+
if (EXPECTED(Z_TYPE_P(op) == IS_LONG)) {
409+
*failed = false;
410+
return Z_LVAL_P(op);
411+
}
412+
return zendi_try_get_long(op, failed);
413+
}
414+
406415
#define ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(opcode) \
407416
if (UNEXPECTED(Z_TYPE_P(op1) == IS_OBJECT) \
408417
&& UNEXPECTED(Z_OBJ_HANDLER_P(op1, do_operation))) { \

Zend/zend_operators.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ ZEND_API void ZEND_FASTCALL convert_to_array(zval *op);
274274
ZEND_API void ZEND_FASTCALL convert_to_object(zval *op);
275275

276276
ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op, bool is_strict);
277+
ZEND_API zend_long ZEND_FASTCALL zend_try_get_long(zval *op, bool *failed);
277278
ZEND_API double ZEND_FASTCALL zval_get_double_func(zval *op);
278279
ZEND_API zend_string* ZEND_FASTCALL zval_get_string_func(zval *op);
279280
ZEND_API zend_string* ZEND_FASTCALL zval_try_get_string_func(zval *op);

0 commit comments

Comments
 (0)