Skip to content

Commit 3a75b3c

Browse files
Make the re-entrancy flag bit width-relative
zend_long is 32 bits on i386, where a constant 1 << 32 does not compile. Object ids are memory bound (every id owns a zval slot) far below bit 30 on 32-bit and bit 62 on 64-bit, so use the width's second-highest bit.
1 parent 4a092d4 commit 3a75b3c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

deepclone.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3221,8 +3221,10 @@ typedef struct {
32213221
/* Set on a handle_to_id value while that id's slots are being replayed, so a
32223222
* re-entrant manual initializer call on the same object (from an autoloader or any
32233223
* user code the hydration runs) cannot hydrate it a second time and delete
3224-
* the handle mid-initialization. Object ids are bounded well below 2^32. */
3225-
#define DC_LAZY_HYDRATING (((zend_long) 1) << 32)
3224+
* the handle mid-initialization. Width-relative bit: object ids are memory
3225+
* bound (every id owns a zval slot) far below 2^30 on 32-bit zend_long and
3226+
* below 2^62 on 64-bit. */
3227+
#define DC_LAZY_HYDRATING (((zend_long) 1) << (SIZEOF_ZEND_LONG * 8 - 2))
32263228

32273229
static zend_class_entry *dc_lazy_ctx_ce;
32283230
static zend_object_handlers dc_lazy_ctx_handlers;

0 commit comments

Comments
 (0)