From d3fb1859f0db44c19b7766a8f6dda6b212ce9ce6 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 29 Aug 2014 17:28:53 +0200 Subject: [PATCH] restore the old behavior for the assignment to string offset --- Zend/zend_execute.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 57e68a2d53..9237e97415 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -762,11 +762,11 @@ static void zend_assign_to_string_offset(zval *str_offset, zval *value, int valu /* XXX String offset is uint32_t in _zval_struct, so can address only 2^32+1 space. To make the offset get over that barier, we need to make str_offset size_t and that would grow zval size by 8 bytes (currently from 16 to 24) on 64 bit build. */ - size_t offset = (size_t)Z_STR_OFFSET_IDX_P(str_offset); + uint32_t offset = Z_STR_OFFSET_IDX_P(str_offset); zend_string *old_str; - if ((zend_long)offset < 0) { - zend_error(E_WARNING, "Illegal string offset: %zd", offset); + if ((int)offset < 0) { + zend_error(E_WARNING, "Illegal string offset: %d", offset); zend_string_release(Z_STR_P(str)); if (result) { ZVAL_NULL(result); @@ -776,7 +776,7 @@ static void zend_assign_to_string_offset(zval *str_offset, zval *value, int valu old_str = Z_STR_P(str); if (offset >= Z_STRLEN_P(str)) { - size_t old_len = Z_STRLEN_P(str); + int old_len = Z_STRLEN_P(str); Z_STR_P(str) = zend_string_realloc(Z_STR_P(str), offset + 1, 0); Z_TYPE_INFO_P(str) = IS_STRING_EX; memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len); -- 2.40.0