diff options
-rw-r--r-- | Zend/zend_API.h | 202 | ||||
-rw-r--r-- | ext/curl/multi.c | 4 | ||||
-rw-r--r-- | ext/exif/exif.c | 6 | ||||
-rw-r--r-- | ext/ftp/php_ftp.c | 2 | ||||
-rw-r--r-- | ext/intl/formatter/formatter_parse.c | 4 | ||||
-rw-r--r-- | ext/ldap/ldap.c | 42 | ||||
-rw-r--r-- | ext/mysqli/mysqli_api.c | 18 | ||||
-rw-r--r-- | ext/openssl/openssl.c | 34 | ||||
-rw-r--r-- | ext/pcntl/pcntl.c | 4 | ||||
-rw-r--r-- | ext/pcre/php_pcre.c | 6 | ||||
-rw-r--r-- | ext/sockets/sockets.c | 44 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 4 | ||||
-rw-r--r-- | ext/standard/exec.c | 2 | ||||
-rw-r--r-- | ext/standard/file.c | 4 | ||||
-rw-r--r-- | ext/standard/fsock.c | 8 | ||||
-rw-r--r-- | ext/standard/head.c | 6 | ||||
-rw-r--r-- | ext/standard/scanf.c | 12 | ||||
-rw-r--r-- | ext/standard/streamsfuncs.c | 22 | ||||
-rw-r--r-- | ext/standard/string.c | 6 | ||||
-rw-r--r-- | ext/standard/type.c | 4 | ||||
-rw-r--r-- | ext/sysvmsg/sysvmsg.c | 18 | ||||
-rw-r--r-- | ext/xmlrpc/xmlrpc-epi-php.c | 6 | ||||
-rw-r--r-- | ext/zip/php_zip.c | 8 |
23 files changed, 300 insertions, 166 deletions
diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 00a39f6624..2ae1990ced 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -675,9 +675,9 @@ ZEND_API int zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *r ZEND_API int zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv); ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict); -#define ZEND_TRY_ASSIGN_NULL(zv) do { \ +#define _ZEND_TRY_ASSIGN_NULL(zv, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_null(ref); \ @@ -689,9 +689,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_NULL(_zv); \ } while (0) -#define ZEND_TRY_ASSIGN_FALSE(zv) do { \ +#define ZEND_TRY_ASSIGN_NULL(zv) \ + _ZEND_TRY_ASSIGN_NULL(zv, 0) + +#define ZEND_TRY_ASSIGN_REF_NULL(zv) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_NULL(zv, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_FALSE(zv, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_bool(ref, 0); \ @@ -703,9 +711,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_FALSE(_zv); \ } while (0) -#define ZEND_TRY_ASSIGN_TRUE(zv) do { \ +#define ZEND_TRY_ASSIGN_FASLE(zv) \ + _ZEND_TRY_ASSIGN_FALSE(zv, 0) + +#define ZEND_TRY_ASSIGN_REF_FALSE(zv) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_FALSE(zv, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_TRUE(zv, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_bool(ref, 1); \ @@ -717,9 +733,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_TRUE(_zv); \ } while (0) -#define ZEND_TRY_ASSIGN_BOOL(zv, bval) do { \ +#define ZEND_TRY_ASSIGN_TRUE(zv) \ + _ZEND_TRY_ASSIGN_TRUE(zv, 0) + +#define ZEND_TRY_ASSIGN_REF_TRUE(zv) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_TRUE(zv, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_BOOL(zv, bval, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_bool(ref, 1); \ @@ -731,9 +755,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_BOOL(_zv, bval); \ } while (0) -#define ZEND_TRY_ASSIGN_LONG(zv, lval) do { \ +#define ZEND_TRY_ASSIGN_BOOL(zv, bval) \ + _ZEND_TRY_ASSIGN_BOOL(zv, bval, 0) + +#define ZEND_TRY_ASSIGN_REF_BOOL(zv, bval) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_BOOL(zv, bval, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_LONG(zv, lval, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_long(ref, lval); \ @@ -745,9 +777,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_LONG(_zv, lval); \ } while (0) -#define ZEND_TRY_ASSIGN_DOUBLE(zv, dval) do { \ +#define ZEND_TRY_ASSIGN_LONG(zv, lval) \ + _ZEND_TRY_ASSIGN_LONG(zv, lval, 0) + +#define ZEND_TRY_ASSIGN_REF_LONG(zv, lval) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_LONG(zv, lval, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_DOUBLE(zv, dval, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_double(ref, dval); \ @@ -759,9 +799,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_DOUBLE(_zv, dval); \ } while (0) -#define ZEND_TRY_ASSIGN_EMPTY_STRING(zv) do { \ +#define ZEND_TRY_ASSIGN_DOUBLE(zv, dval) \ + _ZEND_TRY_ASSIGN_DOUBLE(zv, dval, 0) + +#define ZEND_TRY_ASSIGN_REF_DOUBLE(zv, dval) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_DOUBLE(zv, dval, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_EMPTY_STRING(zv, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_empty_string(ref); \ @@ -773,9 +821,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_EMPTY_STRING(_zv); \ } while (0) -#define ZEND_TRY_ASSIGN_STR(zv, str) do { \ +#define ZEND_TRY_ASSIGN_EMPTY_STRING(zv) \ + _ZEND_TRY_ASSIGN_EMPTY_STRING(zv, 0) + +#define ZEND_TRY_ASSIGN_REF_EMPTY_STRING(zv) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_EMPTY_STRING(zv, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_STR(zv, str, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_str(ref, str); \ @@ -787,9 +843,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_STR(_zv, str); \ } while (0) -#define ZEND_TRY_ASSIGN_NEW_STR(zv, str) do { \ +#define ZEND_TRY_ASSIGN_STR(zv, str) \ + _ZEND_TRY_ASSIGN_STR(zv, str, 0) + +#define ZEND_TRY_ASSIGN_REF_STR(zv, str) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_STR(zv, str, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_NEW_STR(zv, str, is_str) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_str || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_str(ref, str); \ @@ -801,9 +865,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_NEW_STR(_zv, str); \ } while (0) -#define ZEND_TRY_ASSIGN_STRING(zv, string) do { \ +#define ZEND_TRY_ASSIGN_NEW_STR(zv, str) \ + _ZEND_TRY_ASSIGN_NEW_STR(zv, str, 0) + +#define ZEND_TRY_ASSIGN_REF_NEW_STR(zv, str) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_NEW_STR(zv, str, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_STRING(zv, string, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_string(ref, string); \ @@ -815,9 +887,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_STRING(_zv, string); \ } while (0) -#define ZEND_TRY_ASSIGN_STRINGL(zv, string, len) do { \ +#define ZEND_TRY_ASSIGN_STRING(zv, string) \ + _ZEND_TRY_ASSIGN_STRING(zv, string, 0) + +#define ZEND_TRY_ASSIGN_REF_STRING(zv, string) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_STRING(zv, string, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_STRINGL(zv, string, len, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_stringl(ref, string, len); \ @@ -829,9 +909,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_STRINGL(_zv, string, len); \ } while (0) -#define ZEND_TRY_ASSIGN_ARR(zv, arr) do { \ +#define ZEND_TRY_ASSIGN_STRINGL(zv, string, len) \ + _ZEND_TRY_ASSIGN_STRINGL(zv, string, len, 0) + +#define ZEND_TRY_ASSIGN_REF_STRINGL(zv, string, len) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_STRINGL(zv, string, len, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_ARR(zv, arr, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_arr(ref, arr); \ @@ -843,9 +931,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_ARR(_zv, arr); \ } while (0) -#define ZEND_TRY_ASSIGN_RES(zv, res) do { \ +#define ZEND_TRY_ASSIGN_ARR(zv, arr) \ + _ZEND_TRY_ASSIGN_ARR(zv, arr, 0) + +#define ZEND_TRY_ASSIGN_REF_ARR(zv, arr) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_ARR(zv, arr, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_RES(zv, res, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_res(ref, res); \ @@ -857,9 +953,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_RES(_zv, res); \ } while (0) -#define ZEND_TRY_ASSIGN_TMP(zv, other_zv) do { \ +#define ZEND_TRY_ASSIGN_RES(zv, res) \ + _ZEND_TRY_ASSIGN_RES(zv, res, 0) + +#define ZEND_TRY_ASSIGN_REF_RES(zv, res) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_RES(zv, res, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_TMP(zv, other_zv, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref(ref, other_zv); \ @@ -871,9 +975,17 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_COPY_VALUE(_zv, other_zv); \ } while (0) -#define ZEND_TRY_ASSIGN_VALUE(zv, other_zv) do { \ +#define ZEND_TRY_ASSIGN_TMP(zv, other_zv) \ + _ZEND_TRY_ASSIGN_TMP(zv, other_zv, 0) + +#define ZEND_TRY_ASSIGN_REF_TMP(zv, other_zv) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_TMP(zv, other_zv, 1); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_VALUE(zv, other_zv, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_zval(ref, other_zv); \ @@ -885,14 +997,27 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_COPY_VALUE(_zv, other_zv); \ } while (0) +#define ZEND_TRY_ASSIGN_VALUE(zv, other_zv) \ + _ZEND_TRY_ASSIGN_VALUE(zv, other_zv, 0) + +#define ZEND_TRY_ASSIGN_REF_VALUE(zv, other_zv) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_VALUE(zv, other_zv, 1); \ +} while (0) + #define ZEND_TRY_ASSIGN_COPY(zv, other_zv) do { \ Z_TRY_ADDREF_P(other_zv); \ ZEND_TRY_ASSIGN_VALUE(zv, other_zv); \ } while (0) -#define ZEND_TRY_ASSIGN_VALUE_EX(zv, other_zv, strict) do { \ +#define ZEND_TRY_ASSIGN_REF_COPY(zv, other_zv) do { \ + Z_TRY_ADDREF_P(other_zv); \ + ZEND_TRY_ASSIGN_REF_VALUE(zv, other_zv); \ +} while (0) + +#define _ZEND_TRY_ASSIGN_VALUE_EX(zv, other_zv, strict, is_ref) do { \ zval *_zv = zv; \ - if (EXPECTED(Z_ISREF_P(_zv))) { \ + if (is_ref || UNEXPECTED(Z_ISREF_P(_zv))) { \ zend_reference *ref = Z_REF_P(_zv); \ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { \ zend_try_assign_typed_ref_zval_ex(ref, other_zv, strict); \ @@ -904,11 +1029,24 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze ZVAL_COPY_VALUE(_zv, other_zv); \ } while (0) +#define ZEND_TRY_ASSIGN_VALUE_EX(zv, other_zv, strict) \ + _ZEND_TRY_ASSIGN_VALUE_EX(zv, other_zv, strict, 0) + +#define ZEND_TRY_ASSIGN_REF_VALUE_EX(zv, other_zv, strict) do { \ + ZEND_ASSERT(Z_ISREF_P(zv)); \ + _ZEND_TRY_ASSIGN_VALUE_EX(zv, other_zv, strict, 1); \ +} while (0) + #define ZEND_TRY_ASSIGN_COPY_EX(zv, other_zv, strict) do { \ Z_TRY_ADDREF_P(other_zv); \ ZEND_TRY_ASSIGN_VALUE_EX(zv, other_zv, strict); \ } while (0) +#define ZEND_TRY_ASSIGN_REF_COPY_EX(zv, other_zv, strict) do { \ + Z_TRY_ADDREF_P(other_zv); \ + ZEND_TRY_ASSIGN_REF_VALUE_EX(zv, other_zv, strict); \ +} while (0) + /* Initializes a reference to an empty array and returns dereferenced zval, * or NULL if the initialization failed. */ static zend_always_inline zval *zend_try_array_init_size(zval *zv, uint32_t size) diff --git a/ext/curl/multi.c b/ext/curl/multi.c index 473866f551..4a1190214e 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -290,7 +290,7 @@ PHP_FUNCTION(curl_multi_exec) still_running = zval_get_long(z_still_running); error = curl_multi_perform(mh->multi, &still_running); - ZEND_TRY_ASSIGN_LONG(z_still_running, still_running); + ZEND_TRY_ASSIGN_REF_LONG(z_still_running, still_running); SAVE_CURLM_ERROR(mh, error); RETURN_LONG((zend_long) error); @@ -350,7 +350,7 @@ PHP_FUNCTION(curl_multi_info_read) } if (zmsgs_in_queue) { - ZEND_TRY_ASSIGN_LONG(zmsgs_in_queue, queued_msgs); + ZEND_TRY_ASSIGN_REF_LONG(zmsgs_in_queue, queued_msgs); } array_init(return_value); diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 609d1e8fa0..edd97166c8 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -4622,11 +4622,11 @@ PHP_FUNCTION(exif_thumbnail) ImageInfo.Thumbnail.width = ImageInfo.Thumbnail.height = 0; } } - ZEND_TRY_ASSIGN_LONG(z_width, ImageInfo.Thumbnail.width); - ZEND_TRY_ASSIGN_LONG(z_height, ImageInfo.Thumbnail.height); + ZEND_TRY_ASSIGN_REF_LONG(z_width, ImageInfo.Thumbnail.width); + ZEND_TRY_ASSIGN_REF_LONG(z_height, ImageInfo.Thumbnail.height); } if (arg_c >= 4) { - ZEND_TRY_ASSIGN_LONG(z_imagetype, ImageInfo.Thumbnail.filetype); + ZEND_TRY_ASSIGN_REF_LONG(z_imagetype, ImageInfo.Thumbnail.filetype); } #ifdef EXIF_DEBUG diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index e798213e7f..5bd1fa70cc 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -688,7 +688,7 @@ PHP_FUNCTION(ftp_alloc) ret = ftp_alloc(ftp, size, zresponse ? &response : NULL); if (response) { - ZEND_TRY_ASSIGN_STR(zresponse, response); + ZEND_TRY_ASSIGN_REF_STR(zresponse, response); } if (!ret) { diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c index a2a20f147d..ed338dd7d1 100644 --- a/ext/intl/formatter/formatter_parse.c +++ b/ext/intl/formatter/formatter_parse.c @@ -105,7 +105,7 @@ PHP_FUNCTION( numfmt_parse ) efree(oldlocale); #endif if(zposition) { - ZEND_TRY_ASSIGN_LONG(zposition, position); + ZEND_TRY_ASSIGN_REF_LONG(zposition, position); } if (sstr) { @@ -159,7 +159,7 @@ PHP_FUNCTION( numfmt_parse_currency ) number = unum_parseDoubleCurrency(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, currency, &INTL_DATA_ERROR_CODE(nfo)); if(zposition) { - ZEND_TRY_ASSIGN_LONG(zposition, position); + ZEND_TRY_ASSIGN_REF_LONG(zposition, position); } if (sstr) { efree(sstr); diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 2245752b86..8a91e5060c 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -3029,7 +3029,7 @@ PHP_FUNCTION(ldap_get_option) if (ldap_get_option(ld->link, option, &val)) { RETURN_FALSE; } - ZEND_TRY_ASSIGN_LONG(retval, val); + ZEND_TRY_ASSIGN_REF_LONG(retval, val); } break; #ifdef LDAP_OPT_NETWORK_TIMEOUT case LDAP_OPT_NETWORK_TIMEOUT: @@ -3045,7 +3045,7 @@ PHP_FUNCTION(ldap_get_option) if (!timeout) { RETURN_FALSE; } - ZEND_TRY_ASSIGN_LONG(retval, timeout->tv_sec); + ZEND_TRY_ASSIGN_REF_LONG(retval, timeout->tv_sec); ldap_memfree(timeout); } break; #elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) @@ -3056,7 +3056,7 @@ PHP_FUNCTION(ldap_get_option) if (ldap_get_option(ld->link, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) { RETURN_FALSE; } - ZEND_TRY_ASSIGN_LONG(retval, (timeout / 1000)); + ZEND_TRY_ASSIGN_REF_LONG(retval, (timeout / 1000)); } break; #endif #ifdef LDAP_OPT_TIMEOUT @@ -3073,7 +3073,7 @@ PHP_FUNCTION(ldap_get_option) if (!timeout) { RETURN_FALSE; } - ZEND_TRY_ASSIGN_LONG(retval, timeout->tv_sec); + ZEND_TRY_ASSIGN_REF_LONG(retval, timeout->tv_sec); ldap_memfree(timeout); } break; #endif @@ -3120,7 +3120,7 @@ PHP_FUNCTION(ldap_get_option) } RETURN_FALSE; } - ZEND_TRY_ASSIGN_STRING(retval, val); + ZEND_TRY_ASSIGN_REF_STRING(retval, val); ldap_memfree(val); } break; case LDAP_OPT_SERVER_CONTROLS: @@ -3363,7 +3363,7 @@ PHP_FUNCTION(ldap_parse_result) RETURN_FALSE; } - ZEND_TRY_ASSIGN_LONG(errcode, lerrcode); + ZEND_TRY_ASSIGN_REF_LONG(errcode, lerrcode); /* Reverse -> fall through */ switch (myargcount) { @@ -3384,16 +3384,16 @@ PHP_FUNCTION(ldap_parse_result) } case 5: if (lerrmsg == NULL) { - ZEND_TRY_ASSIGN_EMPTY_STRING(errmsg); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(errmsg); } else { - ZEND_TRY_ASSIGN_STRING(errmsg, lerrmsg); + ZEND_TRY_ASSIGN_REF_STRING(errmsg, lerrmsg); ldap_memfree(lerrmsg); } case 4: if (lmatcheddn == NULL) { - ZEND_TRY_ASSIGN_EMPTY_STRING(matcheddn); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(matcheddn); } else { - ZEND_TRY_ASSIGN_STRING(matcheddn, lmatcheddn); + ZEND_TRY_ASSIGN_REF_STRING(matcheddn, lmatcheddn); ldap_memfree(lmatcheddn); } } @@ -3440,17 +3440,17 @@ PHP_FUNCTION(ldap_parse_exop) switch (myargcount) { case 4: if (lretoid == NULL) { - ZEND_TRY_ASSIGN_EMPTY_STRING(retoid); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(retoid); } else { - ZEND_TRY_ASSIGN_STRING(retoid, lretoid); + ZEND_TRY_ASSIGN_REF_STRING(retoid, lretoid); ldap_memfree(lretoid); } case 3: /* use arg #3 as the data returned by the server */ if (lretdata == NULL) { - ZEND_TRY_ASSIGN_EMPTY_STRING(retdata); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(retdata); } else { - ZEND_TRY_ASSIGN_STRINGL(retdata, lretdata->bv_val, lretdata->bv_len); + ZEND_TRY_ASSIGN_REF_STRINGL(retdata, lretdata->bv_val, lretdata->bv_len); ldap_memfree(lretdata->bv_val); ldap_memfree(lretdata); } @@ -4089,13 +4089,13 @@ PHP_FUNCTION(ldap_control_paged_result_response) ldap_controls_free(lserverctrls); if (myargcount == 4) { - ZEND_TRY_ASSIGN_LONG(estimated, lestimated); + ZEND_TRY_ASSIGN_REF_LONG(estimated, lestimated); } if (lcookie.bv_len == 0) { - ZEND_TRY_ASSIGN_EMPTY_STRING(cookie); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(cookie); } else { - ZEND_TRY_ASSIGN_STRINGL(cookie, lcookie.bv_val, lcookie.bv_len); + ZEND_TRY_ASSIGN_REF_STRINGL(cookie, lcookie.bv_val, lcookie.bv_len); } ldap_memfree(lcookie.bv_val); @@ -4159,19 +4159,19 @@ PHP_FUNCTION(ldap_exop) if (retoid) { if (lretoid) { - ZEND_TRY_ASSIGN_STRING(retoid, lretoid); + ZEND_TRY_ASSIGN_REF_STRING(retoid, lretoid); ldap_memfree(lretoid); } else { - ZEND_TRY_ASSIGN_EMPTY_STRING(retoid); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(retoid); } } if (lretdata) { - ZEND_TRY_ASSIGN_STRINGL(retdata, lretdata->bv_val, lretdata->bv_len); + ZEND_TRY_ASSIGN_REF_STRINGL(retdata, lretdata->bv_val, lretdata->bv_len); ldap_memfree(lretdata->bv_val); ldap_memfree(lretdata); } else { - ZEND_TRY_ASSIGN_EMPTY_STRING(retdata); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(retdata); } RETVAL_TRUE; diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 604b4b672d..1a7303c987 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -992,16 +992,16 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) } while (--j > 0); tmp[10]= '\0'; /* unsigned int > INT_MAX is 10 digits - ALWAYS */ - ZEND_TRY_ASSIGN_STRINGL(result, tmp, 10); + ZEND_TRY_ASSIGN_REF_STRINGL(result, tmp, 10); efree(tmp); break; } #endif } if (stmt->stmt->fields[i].flags & UNSIGNED_FLAG) { - ZEND_TRY_ASSIGN_LONG(result, *(unsigned int *)stmt->result.buf[i].val); + ZEND_TRY_ASSIGN_REF_LONG(result, *(unsigned int *)stmt->result.buf[i].val); } else { - ZEND_TRY_ASSIGN_LONG(result, *(int *)stmt->result.buf[i].val); + ZEND_TRY_ASSIGN_REF_LONG(result, *(int *)stmt->result.buf[i].val); } break; case IS_DOUBLE: @@ -1018,7 +1018,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) dval = *((double *)stmt->result.buf[i].val); } - ZEND_TRY_ASSIGN_DOUBLE(result, dval); + ZEND_TRY_ASSIGN_REF_DOUBLE(result, dval); break; } case IS_STRING: @@ -1059,20 +1059,20 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) * use MYSQLI_LL_SPEC. */ snprintf(tmp, sizeof(tmp), (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? MYSQLI_LLU_SPEC : MYSQLI_LL_SPEC, llval); - ZEND_TRY_ASSIGN_STRING(result, tmp); + ZEND_TRY_ASSIGN_REF_STRING(result, tmp); } else { - ZEND_TRY_ASSIGN_LONG(result, llval); + ZEND_TRY_ASSIGN_REF_LONG(result, llval); } } else { #if defined(MYSQL_DATA_TRUNCATED) && MYSQL_VERSION_ID > 50002 if (ret == MYSQL_DATA_TRUNCATED && *(stmt->stmt->bind[i].error) != 0) { /* result was truncated */ - ZEND_TRY_ASSIGN_STRINGL(result, stmt->result.buf[i].val, stmt->stmt->bind[i].buffer_length); + ZEND_TRY_ASSIGN_REF_STRINGL(result, stmt->result.buf[i].val, stmt->stmt->bind[i].buffer_length); } else { #else { #endif - ZEND_TRY_ASSIGN_STRINGL(result, stmt->result.buf[i].val, stmt->result.buf[i].output_len); + ZEND_TRY_ASSIGN_REF_STRINGL(result, stmt->result.buf[i].val, stmt->result.buf[i].output_len); } } break; @@ -1080,7 +1080,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) break; } } else { - ZEND_TRY_ASSIGN_NULL(result); + ZEND_TRY_REF_ASSIGN_NULL(result); } } } else { diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index ff6d053d32..bdee55e638 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -2138,7 +2138,7 @@ PHP_FUNCTION(openssl_x509_export) BUF_MEM *bio_buf; BIO_get_mem_ptr(bio_out, &bio_buf); - ZEND_TRY_ASSIGN_STRINGL(zout, bio_buf->data, bio_buf->length); + ZEND_TRY_ASSIGN_REF_STRINGL(zout, bio_buf->data, bio_buf->length); RETVAL_TRUE; } else { @@ -2979,7 +2979,7 @@ PHP_FUNCTION(openssl_pkcs12_export) BUF_MEM *bio_buf; BIO_get_mem_ptr(bio_out, &bio_buf); - ZEND_TRY_ASSIGN_STRINGL(zout, bio_buf->data, bio_buf->length); + ZEND_TRY_ASSIGN_REF_STRINGL(zout, bio_buf->data, bio_buf->length); RETVAL_TRUE; } else { @@ -3417,7 +3417,7 @@ PHP_FUNCTION(openssl_csr_export) BUF_MEM *bio_buf; BIO_get_mem_ptr(bio_out, &bio_buf); - ZEND_TRY_ASSIGN_STRINGL(zout, bio_buf->data, bio_buf->length); + ZEND_TRY_ASSIGN_REF_STRINGL(zout, bio_buf->data, bio_buf->length); RETVAL_TRUE; } else { @@ -3637,7 +3637,7 @@ PHP_FUNCTION(openssl_csr_new) if (we_made_the_key) { /* and a resource for the private key */ - ZEND_TRY_ASSIGN_RES(out_pkey, zend_register_resource(req.priv_key, le_key)); + ZEND_TRY_ASSIGN_REF_RES(out_pkey, zend_register_resource(req.priv_key, le_key)); req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */ } else if (key_resource != NULL) { req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */ @@ -4700,7 +4700,7 @@ PHP_FUNCTION(openssl_pkey_export) RETVAL_TRUE; bio_mem_len = BIO_get_mem_data(bio_out, &bio_mem_ptr); - ZEND_TRY_ASSIGN_STRINGL(out, bio_mem_ptr, bio_mem_len); + ZEND_TRY_ASSIGN_REF_STRINGL(out, bio_mem_ptr, bio_mem_len); } else { php_openssl_store_errors(); } @@ -5734,7 +5734,7 @@ PHP_FUNCTION(openssl_private_encrypt) if (successful) { ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0'; - ZEND_TRY_ASSIGN_NEW_STR(crypted, cryptedbuf); + ZEND_TRY_ASSIGN_REF_NEW_STR(crypted, cryptedbuf); cryptedbuf = NULL; RETVAL_TRUE; } else { @@ -5802,7 +5802,7 @@ PHP_FUNCTION(openssl_private_decrypt) if (successful) { ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0'; - ZEND_TRY_ASSIGN_NEW_STR(crypted, cryptedbuf); + ZEND_TRY_ASSIGN_REF_NEW_STR(crypted, cryptedbuf); cryptedbuf = NULL; RETVAL_TRUE; } else { @@ -5863,7 +5863,7 @@ PHP_FUNCTION(openssl_public_encrypt) if (successful) { ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0'; - ZEND_TRY_ASSIGN_NEW_STR(crypted, cryptedbuf); + ZEND_TRY_ASSIGN_REF_NEW_STR(crypted, cryptedbuf); cryptedbuf = NULL; RETVAL_TRUE; } else { @@ -5933,7 +5933,7 @@ PHP_FUNCTION(openssl_public_decrypt) if (successful) { ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0'; - ZEND_TRY_ASSIGN_NEW_STR(crypted, cryptedbuf); + ZEND_TRY_ASSIGN_REF_NEW_STR(crypted, cryptedbuf); cryptedbuf = NULL; RETVAL_TRUE; } else { @@ -6029,7 +6029,7 @@ PHP_FUNCTION(openssl_sign) EVP_SignFinal(md_ctx, (unsigned char*)ZSTR_VAL(sigbuf), &siglen, pkey)) { ZSTR_VAL(sigbuf)[siglen] = '\0'; ZSTR_LEN(sigbuf) = siglen; - ZEND_TRY_ASSIGN_NEW_STR(signature, sigbuf); + ZEND_TRY_ASSIGN_REF_NEW_STR(signature, sigbuf); RETVAL_TRUE; } else { php_openssl_store_errors(); @@ -6195,7 +6195,7 @@ PHP_FUNCTION(openssl_seal) } if (len1 + len2 > 0) { - ZEND_TRY_ASSIGN_NEW_STR(sealdata, zend_string_init((char*)buf, len1 + len2, 0)); + ZEND_TRY_ASSIGN_REF_NEW_STR(sealdata, zend_string_init((char*)buf, len1 + len2, 0)); efree(buf); ekeys = zend_try_array_init(ekeys); @@ -6213,7 +6213,7 @@ PHP_FUNCTION(openssl_seal) if (iv) { iv_buf[iv_len] = '\0'; - ZEND_TRY_ASSIGN_NEW_STR(iv, zend_string_init((char*)iv_buf, iv_len, 0)); + ZEND_TRY_ASSIGN_REF_NEW_STR(iv, zend_string_init((char*)iv_buf, iv_len, 0)); } } else { efree(buf); @@ -6302,7 +6302,7 @@ PHP_FUNCTION(openssl_open) EVP_OpenUpdate(ctx, buf, &len1, (unsigned char *)data, (int)data_len) && EVP_OpenFinal(ctx, buf + len1, &len2) && (len1 + len2 > 0)) { buf[len1 + len2] = '\0'; - ZEND_TRY_ASSIGN_NEW_STR(opendata, zend_string_init((char*)buf, len1 + len2, 0)); + ZEND_TRY_ASSIGN_REF_NEW_STR(opendata, zend_string_init((char*)buf, len1 + len2, 0)); RETVAL_TRUE; } else { php_openssl_store_errors(); @@ -6693,7 +6693,7 @@ PHP_OPENSSL_API zend_string* php_openssl_encrypt(char *data, size_t data_len, ch if (EVP_CIPHER_CTX_ctrl(cipher_ctx, mode.aead_get_tag_flag, tag_len, ZSTR_VAL(tag_str)) == 1) { ZSTR_VAL(tag_str)[tag_len] = '\0'; ZSTR_LEN(tag_str) = tag_len; - ZEND_TRY_ASSIGN_NEW_STR(tag, tag_str); + ZEND_TRY_ASSIGN_REF_NEW_STR(tag, tag_str); } else { php_error_docref(NULL, E_WARNING, "Retrieving verification tag failed"); zend_string_release_ex(tag_str, 0); @@ -6701,7 +6701,7 @@ PHP_OPENSSL_API zend_string* php_openssl_encrypt(char *data, size_t data_len, ch outbuf = NULL; } } else if (tag) { - ZEND_TRY_ASSIGN_NULL(tag); + ZEND_TRY_ASSIGN_REF_NULL(tag); php_error_docref(NULL, E_WARNING, "The authenticated tag cannot be provided for cipher that doesn not support AEAD"); } else if (mode.is_aead) { @@ -6935,7 +6935,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes) } if (zstrong_result_returned) { - ZEND_TRY_ASSIGN_FALSE(zstrong_result_returned); + ZEND_TRY_ASSIGN_REF_FALSE(zstrong_result_returned); } if ((buffer = php_openssl_random_pseudo_bytes(buffer_length))) { @@ -6944,7 +6944,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes) } if (zstrong_result_returned) { - ZEND_TRY_ASSIGN_TRUE(zstrong_result_returned); + ZEND_TRY_ASSIGN_REF_TRUE(zstrong_result_returned); } } /* }}} */ diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 0176ef89e9..63751d4b17 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -742,7 +742,7 @@ PHP_FUNCTION(pcntl_waitpid) } #endif - ZEND_TRY_ASSIGN_LONG(z_status, status); + ZEND_TRY_ASSIGN_REF_LONG(z_status, status); RETURN_LONG((zend_long) child_id); } @@ -792,7 +792,7 @@ PHP_FUNCTION(pcntl_wait) } #endif - ZEND_TRY_ASSIGN_LONG(z_status, status); + ZEND_TRY_ASSIGN_REF_LONG(z_status, status); RETURN_LONG((zend_long) child_id); } diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 9ab5d44656..05f8d9f817 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -2307,7 +2307,7 @@ static void preg_replace_common(INTERNAL_FUNCTION_PARAMETERS, int is_filter) } if (zcount) { - ZEND_TRY_ASSIGN_LONG(zcount, replace_count); + ZEND_TRY_ASSIGN_REF_LONG(zcount, replace_count); } } /* }}} */ @@ -2355,7 +2355,7 @@ static PHP_FUNCTION(preg_replace_callback) replace_count = preg_replace_func_impl(return_value, regex, &fci, &fcc, subject, limit, flags); if (zcount) { - ZEND_TRY_ASSIGN_LONG(zcount, replace_count); + ZEND_TRY_ASSIGN_REF_LONG(zcount, replace_count); } } /* }}} */ @@ -2423,7 +2423,7 @@ static PHP_FUNCTION(preg_replace_callback_array) } ZEND_HASH_FOREACH_END(); if (zcount) { - ZEND_TRY_ASSIGN_LONG(zcount, replace_count); + ZEND_TRY_ASSIGN_REF_LONG(zcount, replace_count); } } /* }}} */ diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 46484e3566..c55f0b91a7 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -1335,19 +1335,15 @@ PHP_FUNCTION(socket_getsockname) RETURN_FALSE; } - if (port != NULL) { - ZVAL_DEREF(port); - } - switch (sa->sa_family) { #if HAVE_IPV6 case AF_INET6: sin6 = (struct sockaddr_in6 *) sa; inet_ntop(AF_INET6, &sin6->sin6_addr, addr6, INET6_ADDRSTRLEN); - ZEND_TRY_ASSIGN_STRING(addr, addr6); + ZEND_TRY_ASSIGN_REF_STRING(addr, addr6); if (port != NULL) { - ZEND_TRY_ASSIGN_LONG(port, htons(sin6->sin6_port)); + ZEND_TRY_ASSIGN_REF_LONG(port, htons(sin6->sin6_port)); } RETURN_TRUE; break; @@ -1359,10 +1355,10 @@ PHP_FUNCTION(socket_getsockname) addr_string = inet_ntoa(sin->sin_addr); inet_ntoa_lock = 0; - ZEND_TRY_ASSIGN_STRING(addr, addr_string); + ZEND_TRY_ASSIGN_REF_STRING(addr, addr_string); if (port != NULL) { - ZEND_TRY_ASSIGN_LONG(port, htons(sin->sin_port)); + ZEND_TRY_ASSIGN_REF_LONG(port, htons(sin->sin_port)); } RETURN_TRUE; break; @@ -1370,7 +1366,7 @@ PHP_FUNCTION(socket_getsockname) case AF_UNIX: s_un = (struct sockaddr_un *) sa; - ZEND_TRY_ASSIGN_STRING(addr, s_un->sun_path); + ZEND_TRY_ASSIGN_REF_STRING(addr, s_un->sun_path); RETURN_TRUE; break; @@ -1419,10 +1415,10 @@ PHP_FUNCTION(socket_getpeername) sin6 = (struct sockaddr_in6 *) sa; inet_ntop(AF_INET6, &sin6->sin6_addr, addr6, INET6_ADDRSTRLEN); - ZEND_TRY_ASSIGN_STRING(arg2, addr6); + ZEND_TRY_ASSIGN_REF_STRING(arg2, addr6); if (arg3 != NULL) { - ZEND_TRY_ASSIGN_LONG(arg3, htons(sin6->sin6_port)); + ZEND_TRY_ASSIGN_REF_LONG(arg3, htons(sin6->sin6_port)); } RETURN_TRUE; @@ -1435,10 +1431,10 @@ PHP_FUNCTION(socket_getpeername) addr_string = inet_ntoa(sin->sin_addr); inet_ntoa_lock = 0; - ZEND_TRY_ASSIGN_STRING(arg2, addr_string); + ZEND_TRY_ASSIGN_REF_STRING(arg2, addr_string); if (arg3 != NULL) { - ZEND_TRY_ASSIGN_LONG(arg3, htons(sin->sin_port)); + ZEND_TRY_ASSIGN_REF_LONG(arg3, htons(sin->sin_port)); } RETURN_TRUE; @@ -1447,7 +1443,7 @@ PHP_FUNCTION(socket_getpeername) case AF_UNIX: s_un = (struct sockaddr_un *) sa; - ZEND_TRY_ASSIGN_STRING(arg2, s_un->sun_path); + ZEND_TRY_ASSIGN_REF_STRING(arg2, s_un->sun_path); RETURN_TRUE; break; @@ -1718,11 +1714,11 @@ PHP_FUNCTION(socket_recv) if ((retval = recv(php_sock->bsd_socket, ZSTR_VAL(recv_buf), len, flags)) < 1) { zend_string_efree(recv_buf); - ZEND_TRY_ASSIGN_NULL(buf); + ZEND_TRY_ASSIGN_REF_NULL(buf); } else { ZSTR_LEN(recv_buf) = retval; ZSTR_VAL(recv_buf)[ZSTR_LEN(recv_buf)] = '\0'; - ZEND_TRY_ASSIGN_NEW_STR(buf, recv_buf); + ZEND_TRY_ASSIGN_REF_NEW_STR(buf, recv_buf); } if (retval == -1) { @@ -1817,8 +1813,8 @@ PHP_FUNCTION(socket_recvfrom) ZSTR_LEN(recv_buf) = retval; ZSTR_VAL(recv_buf)[ZSTR_LEN(recv_buf)] = '\0'; - ZEND_TRY_ASSIGN_NEW_STR(arg2, recv_buf); - ZEND_TRY_ASSIGN_STRING(arg5, s_un.sun_path); + ZEND_TRY_ASSIGN_REF_NEW_STR(arg2, recv_buf); + ZEND_TRY_ASSIGN_REF_STRING(arg5, s_un.sun_path); break; case AF_INET: @@ -1843,9 +1839,9 @@ PHP_FUNCTION(socket_recvfrom) address = inet_ntoa(sin.sin_addr); - ZEND_TRY_ASSIGN_NEW_STR(arg2, recv_buf); - ZEND_TRY_ASSIGN_STRING(arg5, address ? address : "0.0.0.0"); - ZEND_TRY_ASSIGN_LONG(arg6, ntohs(sin.sin_port)); + ZEND_TRY_ASSIGN_REF_NEW_STR(arg2, recv_buf); + ZEND_TRY_ASSIGN_REF_STRING(arg5, address ? address : "0.0.0.0"); + ZEND_TRY_ASSIGN_REF_LONG(arg6, ntohs(sin.sin_port)); break; #if HAVE_IPV6 case AF_INET6: @@ -1871,9 +1867,9 @@ PHP_FUNCTION(socket_recvfrom) memset(addr6, 0, INET6_ADDRSTRLEN); inet_ntop(AF_INET6, &sin6.sin6_addr, addr6, INET6_ADDRSTRLEN); - ZEND_TRY_ASSIGN_NEW_STR(arg2, recv_buf); - ZEND_TRY_ASSIGN_STRING(arg5, addr6[0] ? addr6 : "::"); - ZEND_TRY_ASSIGN_LONG(arg6, ntohs(sin6.sin6_port)); + ZEND_TRY_ASSIGN_REF_NEW_STR(arg2, recv_buf); + ZEND_TRY_ASSIGN_REF_STRING(arg5, addr6[0] ? addr6 : "::"); + ZEND_TRY_ASSIGN_REF_LONG(arg6, ntohs(sin6.sin6_port)); break; #endif default: diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index c78de74f2f..0ec4fb39b1 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4384,7 +4384,7 @@ PHP_FUNCTION(getopt) /* Init zoptind to 1 */ if (zoptind) { - ZEND_TRY_ASSIGN_LONG(zoptind, 1); + ZEND_TRY_ASSIGN_REF_LONG(zoptind, 1); } /* Get argv from the global symbol table. We calculate argc ourselves @@ -4532,7 +4532,7 @@ PHP_FUNCTION(getopt) /* Set zoptind to php_optind */ if (zoptind) { - ZEND_TRY_ASSIGN_LONG(zoptind, php_optind); + ZEND_TRY_ASSIGN_REF_LONG(zoptind, php_optind); } free_longopts(orig_opts); diff --git a/ext/standard/exec.c b/ext/standard/exec.c index e21dbacd5f..b79eb37c04 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -243,7 +243,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ ret = php_exec(2, cmd, ret_array, return_value); } if (ret_code) { - ZEND_TRY_ASSIGN_LONG(ret_code, ret); + ZEND_TRY_ASSIGN_REF_LONG(ret_code, ret); } } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index cc3d4d2699..572bf769bf 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -355,14 +355,14 @@ PHP_FUNCTION(flock) } if (wouldblock) { - ZEND_TRY_ASSIGN_LONG(wouldblock, 0); + ZEND_TRY_ASSIGN_REF_LONG(wouldblock, 0); } /* flock_values contains all possible actions if (operation & 4) we won't block on the lock */ act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0); if (php_stream_lock(stream, act)) { if (operation && errno == EWOULDBLOCK && wouldblock) { - ZEND_TRY_ASSIGN_LONG(wouldblock, 1); + ZEND_TRY_ASSIGN_REF_LONG(wouldblock, 1); } RETURN_FALSE; } diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index f896c70770..fe8fbea85c 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -95,11 +95,11 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (stream == NULL) { if (zerrno) { - ZEND_TRY_ASSIGN_LONG(zerrno, err); + ZEND_TRY_ASSIGN_REF_LONG(zerrno, err); } if (errstr) { if (zerrstr) { - ZEND_TRY_ASSIGN_STR(zerrstr, errstr); + ZEND_TRY_ASSIGN_REF_STR(zerrstr, errstr); } else { zend_string_release(errstr); } @@ -109,10 +109,10 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) } if (zerrno) { - ZEND_TRY_ASSIGN_LONG(zerrno, 0); + ZEND_TRY_ASSIGN_REF_LONG(zerrno, 0); } if (zerrstr) { - ZEND_TRY_ASSIGN_EMPTY_STRING(zerrstr); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(zerrstr); } if (errstr) { diff --git a/ext/standard/head.c b/ext/standard/head.c index 4e0ac2022e..e8b5d5b171 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -353,12 +353,12 @@ PHP_FUNCTION(headers_sent) switch(ZEND_NUM_ARGS()) { case 2: - ZEND_TRY_ASSIGN_LONG(arg2, line); + ZEND_TRY_ASSIGN_REF_LONG(arg2, line); case 1: if (file) { - ZEND_TRY_ASSIGN_STRING(arg1, file); + ZEND_TRY_ASSIGN_REF_STRING(arg1, file); } else { - ZEND_TRY_ASSIGN_EMPTY_STRING(arg1); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(arg1); } break; } diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 5740cd6412..fc48315973 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -738,7 +738,7 @@ literal: break; } else if (numVars) { current = args + objIndex++; - ZEND_TRY_ASSIGN_LONG(current, (zend_long) (string - baseString)); + ZEND_TRY_ASSIGN_REF_LONG(current, (zend_long) (string - baseString)); } else { add_index_long(return_value, objIndex++, string - baseString); } @@ -856,7 +856,7 @@ literal: break; } else if (numVars) { current = args + objIndex++; - ZEND_TRY_ASSIGN_STRINGL(current, string, end - string); + ZEND_TRY_ASSIGN_REF_STRINGL(current, string, end - string); } else { add_index_stringl(return_value, objIndex++, string, end-string); } @@ -896,7 +896,7 @@ literal: break; } else if (numVars) { current = args + objIndex++; - ZEND_TRY_ASSIGN_STRINGL(current, string, end - string); + ZEND_TRY_ASSIGN_REF_STRINGL(current, string, end - string); } else { add_index_stringl(return_value, objIndex++, string, end-string); } @@ -1049,7 +1049,7 @@ addToInt: } else if (numVars) { /* change passed value type to string */ current = args + objIndex++; - ZEND_TRY_ASSIGN_STRING(current, buf); + ZEND_TRY_ASSIGN_REF_STRING(current, buf); } else { add_index_string(return_value, objIndex++, buf); } @@ -1058,7 +1058,7 @@ addToInt: break; } else if (numVars) { current = args + objIndex++; - ZEND_TRY_ASSIGN_LONG(current, value); + ZEND_TRY_ASSIGN_REF_LONG(current, value); } else { add_index_long(return_value, objIndex++, value); } @@ -1162,7 +1162,7 @@ addToFloat: break; } else if (numVars) { current = args + objIndex++; - ZEND_TRY_ASSIGN_DOUBLE(current, dvalue); + ZEND_TRY_ASSIGN_REF_DOUBLE(current, dvalue); } else { add_index_double(return_value, objIndex++, dvalue ); } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 37461b0d1d..4fa705bed9 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -130,10 +130,10 @@ PHP_FUNCTION(stream_socket_client) tv.tv_usec = conv % 1000000; #endif if (zerrno) { - ZEND_TRY_ASSIGN_LONG(zerrno, 0); + ZEND_TRY_ASSIGN_REF_LONG(zerrno, 0); } if (zerrstr) { - ZEND_TRY_ASSIGN_EMPTY_STRING(zerrstr); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(zerrstr); } stream = php_stream_xport_create(ZSTR_VAL(host), ZSTR_LEN(host), REPORT_ERRORS, @@ -156,10 +156,10 @@ PHP_FUNCTION(stream_socket_client) if (stream == NULL) { if (zerrno) { - ZEND_TRY_ASSIGN_LONG(zerrno, err); + ZEND_TRY_ASSIGN_REF_LONG(zerrno, err); } if (zerrstr && errstr) { - ZEND_TRY_ASSIGN_STR(zerrstr, errstr); + ZEND_TRY_ASSIGN_REF_STR(zerrstr, errstr); } else if (errstr) { zend_string_release_ex(errstr, 0); } @@ -206,10 +206,10 @@ PHP_FUNCTION(stream_socket_server) } if (zerrno) { - ZEND_TRY_ASSIGN_LONG(zerrno, 0); + ZEND_TRY_ASSIGN_REF_LONG(zerrno, 0); } if (zerrstr) { - ZEND_TRY_ASSIGN_EMPTY_STRING(zerrstr); + ZEND_TRY_ASSIGN_REF_EMPTY_STRING(zerrstr); } stream = php_stream_xport_create(host, host_len, REPORT_ERRORS, @@ -222,10 +222,10 @@ PHP_FUNCTION(stream_socket_server) if (stream == NULL) { if (zerrno) { - ZEND_TRY_ASSIGN_LONG(zerrno, err); + ZEND_TRY_ASSIGN_REF_LONG(zerrno, err); } if (zerrstr && errstr) { - ZEND_TRY_ASSIGN_STR(zerrstr, errstr); + ZEND_TRY_ASSIGN_REF_STR(zerrstr, errstr); } else if (errstr) { zend_string_release_ex(errstr, 0); } @@ -279,7 +279,7 @@ PHP_FUNCTION(stream_socket_accept) ) && clistream) { if (peername) { - ZEND_TRY_ASSIGN_STR(zpeername, peername); + ZEND_TRY_ASSIGN_REF_STR(zpeername, peername); } php_stream_to_zval(clistream, return_value); } else { @@ -381,7 +381,7 @@ PHP_FUNCTION(stream_socket_recvfrom) php_stream_from_zval(stream, zstream); if (zremote) { - ZEND_TRY_ASSIGN_NULL(zremote); + ZEND_TRY_ASSIGN_REF_NULL(zremote); } if (to_read <= 0) { @@ -397,7 +397,7 @@ PHP_FUNCTION(stream_socket_recvfrom) if (recvd >= 0) { if (zremote && remote_addr) { - ZEND_TRY_ASSIGN_STR(zremote, remote_addr); + ZEND_TRY_ASSIGN_REF_STR(zremote, remote_addr); } ZSTR_VAL(read_buf)[recvd] = '\0'; ZSTR_LEN(read_buf) = recvd; diff --git a/ext/standard/string.c b/ext/standard/string.c index 41a391876c..0ec4bf77a8 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3645,7 +3645,7 @@ PHP_FUNCTION(similar_text) if (ZSTR_LEN(t1) + ZSTR_LEN(t2) == 0) { if (ac > 2) { - ZEND_TRY_ASSIGN_DOUBLE(percent, 0); + ZEND_TRY_ASSIGN_REF_DOUBLE(percent, 0); } RETURN_LONG(0); @@ -3654,7 +3654,7 @@ PHP_FUNCTION(similar_text) sim = php_similar_char(ZSTR_VAL(t1), ZSTR_LEN(t1), ZSTR_VAL(t2), ZSTR_LEN(t2)); if (ac > 2) { - ZEND_TRY_ASSIGN_DOUBLE(percent, sim * 200.0 / (ZSTR_LEN(t1) + ZSTR_LEN(t2))); + ZEND_TRY_ASSIGN_REF_DOUBLE(percent, sim * 200.0 / (ZSTR_LEN(t1) + ZSTR_LEN(t2))); } RETURN_LONG(sim); @@ -4451,7 +4451,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit count = php_str_replace_in_subject(search, replace, subject, return_value, case_sensitivity); } if (argc > 3) { - ZEND_TRY_ASSIGN_LONG(zcount, count); + ZEND_TRY_ASSIGN_REF_LONG(zcount, count); } } /* }}} */ diff --git a/ext/standard/type.c b/ext/standard/type.c index c3d20a340c..45f8b34cf4 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -84,7 +84,7 @@ PHP_FUNCTION(settype) RETURN_FALSE; } - ZEND_TRY_ASSIGN_TMP(var, &tmp); + ZEND_TRY_ASSIGN_REF_TMP(var, &tmp); RETVAL_TRUE; } /* }}} */ @@ -371,7 +371,7 @@ PHP_FUNCTION(is_callable) } if (ZEND_NUM_ARGS() > 2) { retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, &error); - ZEND_TRY_ASSIGN_STR(callable_name, name); + ZEND_TRY_ASSIGN_REF_STR(callable_name, name); } else { retval = zend_is_callable_ex(var, NULL, check_flags, NULL, NULL, &error); } diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index 12bc41aadd..68e4edcc74 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -370,9 +370,9 @@ PHP_FUNCTION(msg_receive) if (result >= 0) { /* got it! */ - ZEND_TRY_ASSIGN_LONG(out_msgtype, messagebuffer->mtype); + ZEND_TRY_ASSIGN_REF_LONG(out_msgtype, messagebuffer->mtype); if (zerrcode) { - ZEND_TRY_ASSIGN_LONG(zerrcode, 0); + ZEND_TRY_ASSIGN_REF_LONG(zerrcode, 0); } RETVAL_TRUE; @@ -384,20 +384,20 @@ PHP_FUNCTION(msg_receive) PHP_VAR_UNSERIALIZE_INIT(var_hash); if (!php_var_unserialize(&tmp, &p, p + result, &var_hash)) { php_error_docref(NULL, E_WARNING, "message corrupted"); - ZEND_TRY_ASSIGN_FALSE(out_message); + ZEND_TRY_ASSIGN_REF_FALSE(out_message); RETVAL_FALSE; } else { - ZEND_TRY_ASSIGN_VALUE(out_message, &tmp); + ZEND_TRY_ASSIGN_REF_VALUE(out_message, &tmp); } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); } else { - ZEND_TRY_ASSIGN_STRINGL(out_message, messagebuffer->mtext, result); + ZEND_TRY_ASSIGN_REF_STRINGL(out_message, messagebuffer->mtext, result); } } else { - ZEND_TRY_ASSIGN_LONG(out_msgtype, 0); - ZEND_TRY_ASSIGN_FALSE(out_message); + ZEND_TRY_ASSIGN_REF_LONG(out_msgtype, 0); + ZEND_TRY_ASSIGN_REF_FALSE(out_message); if (zerrcode) { - ZEND_TRY_ASSIGN_LONG(zerrcode, errno); + ZEND_TRY_ASSIGN_REF_LONG(zerrcode, errno); } } efree(messagebuffer); @@ -484,7 +484,7 @@ PHP_FUNCTION(msg_send) if (result == -1) { php_error_docref(NULL, E_WARNING, "msgsnd failed: %s", strerror(errno)); if (zerror) { - ZEND_TRY_ASSIGN_LONG(zerror, errno); + ZEND_TRY_ASSIGN_REF_LONG(zerror, errno); } } else { RETVAL_TRUE; diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 6665829d14..4dd2703d45 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -764,9 +764,9 @@ void decode_request_worker(char *xml_in, int xml_in_len, char *encoding_in, zval if (method_name_out) { method_name = XMLRPC_RequestGetMethodName(response); if (method_name) { - ZEND_TRY_ASSIGN_STRING(method_name_out, method_name); + ZEND_TRY_ASSIGN_REF_STRING(method_name_out, method_name); } else { - ZEND_TRY_ASSIGN_NULL(retval); + ZVAL_NULL(retval); } } } @@ -1396,7 +1396,7 @@ PHP_FUNCTION(xmlrpc_set_type) zval tmp; ZVAL_COPY(&tmp, Z_REFVAL_P(arg)); if (set_zval_xmlrpc_type(&tmp, vtype) == SUCCESS) { - ZEND_TRY_ASSIGN_VALUE(arg, &tmp); + ZEND_TRY_ASSIGN_REF_VALUE(arg, &tmp); RETURN_TRUE; } Z_TRY_DELREF(tmp); diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index abf901da1f..df3eade995 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -2143,8 +2143,8 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName) (zip_flags_t)flags, &opsys, &attr) < 0) { RETURN_FALSE; } - ZEND_TRY_ASSIGN_LONG(z_opsys, opsys); - ZEND_TRY_ASSIGN_LONG(z_attr, attr); + ZEND_TRY_ASSIGN_REF_LONG(z_opsys, opsys); + ZEND_TRY_ASSIGN_REF_LONG(z_attr, attr); RETURN_TRUE; } /* }}} */ @@ -2172,8 +2172,8 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex) (zip_flags_t)flags, &opsys, &attr) < 0) { RETURN_FALSE; } - ZEND_TRY_ASSIGN_LONG(z_opsys, opsys); - ZEND_TRY_ASSIGN_LONG(z_attr, attr); + ZEND_TRY_ASSIGN_REF_LONG(z_opsys, opsys); + ZEND_TRY_ASSIGN_REF_LONG(z_attr, attr); RETURN_TRUE; } /* }}} */ |