Skip to content

Commit 706ba15

Browse files
committed
Add ZEND_TRY_ASSIGN_BOOL API
1 parent 8578c54 commit 706ba15

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Zend/zend_API.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,20 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze
712712
ZVAL_TRUE(_zv); \
713713
} while (0)
714714

715+
#define ZEND_TRY_ASSIGN_BOOL(zv, bval) do { \
716+
zval *_zv = zv; \
717+
if (EXPECTED(Z_ISREF_P(_zv))) { \
718+
zend_reference *ref = Z_REF_P(_zv); \
719+
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \
720+
zend_try_assign_typed_ref_bool(ref, 1); \
721+
break; \
722+
} \
723+
_zv = &ref->val; \
724+
} \
725+
zval_ptr_dtor(_zv); \
726+
ZVAL_BOOL(_zv, bval); \
727+
} while (0)
728+
715729
#define ZEND_TRY_ASSIGN_LONG(zv, lval) do { \
716730
zval *_zv = zv; \
717731
if (EXPECTED(Z_ISREF_P(_zv))) { \

0 commit comments

Comments
 (0)