diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-05-28 16:27:12 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-05-28 16:27:12 +0300 |
commit | 5eb1f92f31cafc48384f9096012f421b37f6d425 (patch) | |
tree | 4ed67b92229407e7b5cbab37b96428fe80eb3f94 /ext | |
parent | 925f05dd1a35eafa71eb29abb69cdfc31a23a75d (diff) | |
download | php-git-5eb1f92f31cafc48384f9096012f421b37f6d425.tar.gz |
Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence.
Diffstat (limited to 'ext')
130 files changed, 663 insertions, 666 deletions
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index e7843e23e4..28814de09d 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -238,7 +238,7 @@ static void function_dtor(zval *zv) { zend_internal_function *f = (zend_internal_function*)Z_PTR_P(zv); - zend_string_release(f->function_name); + zend_string_release_ex(f->function_name, 0); if (f->arg_info) { efree(f->arg_info); } diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index a0e90df986..a5c820f774 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -201,7 +201,7 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa if (COMG(autoreg_verbose) && !compare_function(&results, &c.value, exists)) { php_error_docref(NULL, E_WARNING, "Type library constant %s is already defined", c.name); } - zend_string_release(c.name); + zend_string_release_ex(c.name, 1); ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc); continue; } diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c index 347a495831..5312c20a6c 100644 --- a/ext/com_dotnet/com_wrapper.c +++ b/ext/com_dotnet/com_wrapper.c @@ -476,7 +476,7 @@ static void generate_dispids(php_dispatchex *disp) /* Find the existing id */ if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) { - zend_string_release(name); + zend_string_release_ex(name, 0); continue; } @@ -488,7 +488,7 @@ static void generate_dispids(php_dispatchex *disp) ZVAL_LONG(&tmp2, pid); zend_hash_update(disp->name_to_dispid, name, &tmp2); - zend_string_release(name); + zend_string_release_ex(name, 0); } } @@ -511,7 +511,7 @@ static void generate_dispids(php_dispatchex *disp) /* Find the existing id */ if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) { - zend_string_release(name); + zend_string_release_ex(name, 0); continue; } @@ -523,7 +523,7 @@ static void generate_dispids(php_dispatchex *disp) ZVAL_LONG(&tmp2, pid); zend_hash_update(disp->name_to_dispid, name, &tmp2); - zend_string_release(name); + zend_string_release_ex(name, 0); } } } diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 13d2075d90..4c2f7e52db 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1698,7 +1698,7 @@ static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, v if (type == CURLINFO_HEADER_OUT) { if (ch->header.str) { - zend_string_release(ch->header.str); + zend_string_release_ex(ch->header.str, 0); } if (buf_len > 0) { ch->header.str = zend_string_init(buf, buf_len, 0); @@ -2628,7 +2628,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ } } - zend_string_release(string_key); + zend_string_release_ex(string_key, 0); continue; } @@ -2649,7 +2649,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ error = (CURLcode)form_error; } zend_tmp_string_release(tmp_postval); - zend_string_release(string_key); + zend_string_release_ex(string_key, 0); } ZEND_HASH_FOREACH_END(); SAVE_CURL_ERROR(ch, error); @@ -2889,7 +2889,7 @@ void _php_curl_cleanup_handle(php_curl *ch) { smart_str_free(&ch->handlers->write->buf); if (ch->header.str) { - zend_string_release(ch->header.str); + zend_string_release_ex(ch->header.str, 0); ch->header.str = NULL; } @@ -3274,7 +3274,7 @@ static void _php_curl_close_ex(php_curl *ch) zval_ptr_dtor(&ch->handlers->write_header->func_name); zval_ptr_dtor(&ch->handlers->std_err); if (ch->header.str) { - zend_string_release(ch->header.str); + zend_string_release_ex(ch->header.str, 0); } zval_ptr_dtor(&ch->handlers->write_header->stream); diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 71b3a35750..0e3dce4e61 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -901,7 +901,7 @@ restart: } else { if (opened_path) { info->lock.name = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); - zend_string_release(opened_path); + zend_string_release_ex(opened_path, 0); } } } @@ -915,7 +915,7 @@ restart: } /* now store the name of the lock */ info->lock.name = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); - zend_string_release(opened_path); + zend_string_release_ex(opened_path, 0); } } if (!lock_dbf) { diff --git a/ext/dom/attr.c b/ext/dom/attr.c index 13238c9bdd..930a2de827 100644 --- a/ext/dom/attr.c +++ b/ext/dom/attr.c @@ -171,7 +171,7 @@ int dom_attr_value_write(dom_object *obj, zval *newval) xmlNodeSetContentLen((xmlNodePtr) attrp, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1); - zend_string_release(str); + zend_string_release_ex(str, 0); return SUCCESS; } diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index 671f4033ee..bd801733c4 100644 --- a/ext/dom/characterdata.c +++ b/ext/dom/characterdata.c @@ -110,7 +110,7 @@ int dom_characterdata_data_write(dom_object *obj, zval *newval) xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1); - zend_string_release(str); + zend_string_release_ex(str, 0); return SUCCESS; } diff --git a/ext/dom/document.c b/ext/dom/document.c index 2d70338994..262a88896e 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -353,7 +353,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval) php_error_docref(NULL, E_WARNING, "Invalid Document Encoding"); } - zend_string_release(str); + zend_string_release_ex(str, 0); return SUCCESS; } @@ -441,7 +441,7 @@ int dom_document_version_write(dom_object *obj, zval *newval) docp->version = xmlStrdup((const xmlChar *) ZSTR_VAL(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); return SUCCESS; } @@ -669,7 +669,7 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval) docp->URL = xmlStrdup((const xmlChar *) ZSTR_VAL(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); return SUCCESS; } diff --git a/ext/dom/node.c b/ext/dom/node.c index 7d640ff6c5..3048ecef07 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -347,7 +347,7 @@ int dom_node_node_value_write(dom_object *obj, zval *newval) { zend_string *str = zval_get_string(newval); xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1); - zend_string_release(str); + zend_string_release_ex(str, 0); break; } default: @@ -748,14 +748,14 @@ int dom_node_prefix_write(dom_object *obj, zval *newval) } if (ns == NULL) { - zend_string_release(str); + zend_string_release_ex(str, 0); php_dom_throw_error(NAMESPACE_ERR, dom_get_strict_error(obj->document)); return FAILURE; } xmlSetNs(nodep, ns); } - zend_string_release(str); + zend_string_release_ex(str, 0); break; default: break; @@ -868,7 +868,7 @@ int dom_node_text_content_write(dom_object *obj, zval *newval) /* we have to use xmlNodeAddContent() to get the same behavior as with xmlNewText() */ xmlNodeSetContent(nodep, (xmlChar *) ""); xmlNodeAddContent(nodep, (xmlChar *) ZSTR_VAL(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); return SUCCESS; } diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 69da603247..61346cd590 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -308,7 +308,7 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, size_ hnd.write_func = write_func ? write_func : dom_write_na; str = zend_string_init_interned(name, name_len, 1); zend_hash_add_mem(prop_handler, str, &hnd, sizeof(dom_prop_handler)); - zend_string_release(str); + zend_string_release_ex(str, 1); } /* }}} */ @@ -323,7 +323,7 @@ static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, void retval = std_hnd->get_property_ptr_ptr(object, member, type, cache_slot); } - zend_string_release(member_str); + zend_string_release_ex(member_str, 0); return retval; } /* }}} */ @@ -354,7 +354,7 @@ zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot, retval = std_hnd->read_property(object, member, type, cache_slot, rv); } - zend_string_release(member_str); + zend_string_release_ex(member_str, 0); return retval; } /* }}} */ @@ -376,7 +376,7 @@ void dom_write_property(zval *object, zval *member, zval *value, void **cache_sl std_hnd->write_property(object, member, value, cache_slot); } - zend_string_release(member_str); + zend_string_release_ex(member_str, 0); } /* }}} */ @@ -409,7 +409,7 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, void retval = std_hnd->has_property(object, member, check_empty, cache_slot); } - zend_string_release(member_str); + zend_string_release_ex(member_str, 0); return retval; } /* }}} */ @@ -451,7 +451,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ * zend_hash_add(debug_info, string_key, &value); } ZEND_HASH_FOREACH_END(); - zend_string_release(object_str); + zend_string_release_ex(object_str, 0); return debug_info; } diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c index dca6c2e8f7..f8fde2b807 100644 --- a/ext/dom/processinginstruction.c +++ b/ext/dom/processinginstruction.c @@ -145,7 +145,7 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval) xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1); - zend_string_release(str); + zend_string_release_ex(str, 0); return SUCCESS; } diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 27d88055d0..a63abaf6cd 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -221,12 +221,12 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, } else { zend_string *str = zval_get_string(&retval); valuePush(ctxt, xmlXPathNewString((xmlChar *) ZSTR_VAL(str))); - zend_string_release(str); + zend_string_release_ex(str, 0); } zval_ptr_dtor(&retval); } } - zend_string_release(callable); + zend_string_release_ex(callable, 0); zval_dtor(&fci.function_name); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { @@ -520,7 +520,7 @@ PHP_FUNCTION(dom_xpath_register_php_functions) zend_string *str = zval_get_string(entry); ZVAL_LONG(&new_string,1); zend_hash_update(intern->registered_phpfunctions, str, &new_string); - zend_string_release(str); + zend_string_release_ex(str, 0); } ZEND_HASH_FOREACH_END(); intern->registerPhpFunctions = 2; RETURN_TRUE; diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 3671c892b3..6562e04ba8 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -4308,7 +4308,7 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i base = php_basename(stream->orig_path, strlen(stream->orig_path), NULL, 0); ImageInfo->FileName = estrndup(ZSTR_VAL(base), ZSTR_LEN(base)); - zend_string_release(base); + zend_string_release_ex(base, 0); /* Store file date/time. */ ImageInfo->FileDateTime = st.st_mtime; diff --git a/ext/fileinfo/libmagic/funcs.c b/ext/fileinfo/libmagic/funcs.c index 6e12bf6338..972d8d6c40 100644 --- a/ext/fileinfo/libmagic/funcs.c +++ b/ext/fileinfo/libmagic/funcs.c @@ -486,7 +486,7 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep) repl = zend_string_init(rep, strlen(rep), 0); res = php_pcre_replace_impl(pce, NULL, ms->o.buf, strlen(ms->o.buf), repl, -1, &rep_cnt); - zend_string_release(repl); + zend_string_release_ex(repl, 0); if (NULL == res) { rep_cnt = -1; goto out; @@ -495,7 +495,7 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep) strncpy(ms->o.buf, ZSTR_VAL(res), ZSTR_LEN(res)); ms->o.buf[ZSTR_LEN(res)] = '\0'; - zend_string_release(res); + zend_string_release_ex(res, 0); out: (void)setlocale(LC_CTYPE, ""); diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c index d444115255..816482bc2d 100644 --- a/ext/fileinfo/libmagic/softmagic.c +++ b/ext/fileinfo/libmagic/softmagic.c @@ -441,7 +441,7 @@ check_fmt(struct magic_set *ms, const char *fmt) php_pcre_free_match_data(match_data); } } - zend_string_release(pattern); + zend_string_release_ex(pattern, 0); (void)setlocale(LC_CTYPE, ""); return rv; } diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index 4dec0bba14..0fe324268d 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -644,11 +644,10 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ sregexp = zend_string_init(regexp, regexp_len, 0); re = pcre_get_compiled_regex(sregexp, &capture_count, &preg_options); + zend_string_release_ex(sregexp, 0); if (!re) { - zend_string_release(sregexp); RETURN_VALIDATION_FAILED } - zend_string_release(sregexp); match_data = php_pcre_create_match_data(capture_count, re); if (!match_data) { RETURN_VALIDATION_FAILED diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 9579410899..08e06e29a7 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -2426,7 +2426,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, io_ctx = gdNewDynamicCtxEx(ZSTR_LEN(buff), pstr, 0); if (!io_ctx) { pefree(pstr, 1); - zend_string_release(buff); + zend_string_release_ex(buff, 0); php_error_docref(NULL, E_WARNING,"Cannot allocate GD IO context"); goto out_err; } @@ -2438,7 +2438,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, } io_ctx->gd_free(io_ctx); pefree(pstr, 1); - zend_string_release(buff); + zend_string_release_ex(buff, 0); } else if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO)) { /* try and force the stream to be FILE* */ @@ -2723,7 +2723,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char fclose(tmp); VCWD_UNLINK((const char *)ZSTR_VAL(path)); /* make sure that the temporary file is removed */ - zend_string_release(path); + zend_string_release_ex(path, 0); } RETURN_TRUE; } diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index dc2b649746..1f496e8469 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -585,7 +585,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, PHP_VAR_SERIALIZE_DESTROY(serialize_data); *buffer = (unsigned char *) estrndup(ZSTR_VAL(buf.s), ZSTR_LEN(buf.s)); *buf_len = ZSTR_LEN(buf.s); - zend_string_release(buf.s); + zend_string_release_ex(buf.s, 0); return SUCCESS; } diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 25d022a6e3..6819b32c82 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -172,7 +172,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_ php_hash_bin2hex(ZSTR_VAL(hex_digest), (unsigned char *) ZSTR_VAL(digest), ops->digest_size); ZSTR_VAL(hex_digest)[2 * ops->digest_size] = 0; - zend_string_release(digest); + zend_string_release_ex(digest, 0); RETURN_NEW_STR(hex_digest); } } @@ -307,7 +307,7 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename, php_hash_bin2hex(ZSTR_VAL(hex_digest), (unsigned char *) ZSTR_VAL(digest), ops->digest_size); ZSTR_VAL(hex_digest)[2 * ops->digest_size] = 0; - zend_string_release(digest); + zend_string_release_ex(digest, 0); RETURN_NEW_STR(hex_digest); } } @@ -561,7 +561,7 @@ PHP_FUNCTION(hash_final) php_hash_bin2hex(ZSTR_VAL(hex_digest), (unsigned char *) ZSTR_VAL(digest), digest_len); ZSTR_VAL(hex_digest)[2 * digest_len] = 0; - zend_string_release(digest); + zend_string_release_ex(digest, 0); RETURN_NEW_STR(hex_digest); } } diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 34641d882c..7070454433 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -1340,7 +1340,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn smart_str_appendl(pretval, "?=", sizeof("?=") - 1); char_cnt -= 2; - zend_string_release(encoded); + zend_string_release_ex(encoded, 0); encoded = NULL; } break; /* case PHP_ICONV_ENC_SCHEME_BASE64: */ @@ -1462,7 +1462,7 @@ out: iconv_close(cd_pl); } if (encoded != NULL) { - zend_string_release(encoded); + zend_string_release_ex(encoded, 0); } if (buf != NULL) { efree(buf); @@ -1844,7 +1844,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st } err = _php_iconv_appendl(pretval, ZSTR_VAL(decoded_text), ZSTR_LEN(decoded_text), cd); - zend_string_release(decoded_text); + zend_string_release_ex(decoded_text, 0); if (err != PHP_ICONV_ERR_SUCCESS) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { @@ -2298,7 +2298,7 @@ PHP_FUNCTION(iconv_mime_encode) } if (tmp_str) { - zend_string_release(tmp_str); + zend_string_release_ex(tmp_str, 0); } } /* }}} */ @@ -2501,7 +2501,7 @@ PHP_FUNCTION(iconv_set_encoding) } retval = zend_alter_ini_entry(name, charset, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - zend_string_release(name); + zend_string_release_ex(name, 0); if (retval == SUCCESS) { RETURN_TRUE; diff --git a/ext/interbase/ibase_events.c b/ext/interbase/ibase_events.c index d1f01f342f..b96e0b820a 100644 --- a/ext/interbase/ibase_events.c +++ b/ext/interbase/ibase_events.c @@ -320,7 +320,7 @@ PHP_FUNCTION(ibase_set_event_handler) if (!zend_is_callable(cb_arg, 0, NULL)) { zend_string *cb_name = zend_get_callable_name(cb_arg); _php_ibase_module_error("Callback argument %s is not a callable function", ZSTR_VAL(cb_name)); - zend_string_release(cb_name); + zend_string_release_ex(cb_name, 0); RETURN_FALSE; } diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index e26173b10a..3d1d12dacc 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -1061,7 +1061,7 @@ static zend_object *php_converter_clone_object(zval *object) { err_msg = intl_error_get_message(&oldobj->error); zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0); - zend_string_release(err_msg); + zend_string_release_ex(err_msg, 0); return retval; } diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index f08e0ed3f3..b85f10ecc9 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -218,7 +218,7 @@ U_CFUNC PHP_METHOD( IntlDateFormatter, __construct ) if (!EG(exception)) { zend_string *err = intl_error_get_message(NULL); zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL)); - zend_string_release(err); + zend_string_release_ex(err, 0); } } zend_restore_error_handling(&error_handling); diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index f80eea106a..d802eb9c26 100644 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -280,7 +280,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) } else { smart_str_append( &ret, u8str ); - zend_string_release( u8str ); + zend_string_release_ex( u8str, 0 ); } smart_str_appends( &ret, "\"" ); any = 1; @@ -300,7 +300,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) else { smart_str_append( &ret, u8str ); - zend_string_release( u8str ); + zend_string_release_ex( u8str, 0 ); } smart_str_appends( &ret, "\"" ); any = 1; diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index f300fa88ff..437b9e404d 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -242,9 +242,9 @@ PHP_NAMED_FUNCTION(zif_locale_set_default) ini_name = zend_string_init(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0); zend_alter_ini_entry(ini_name, locale_name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); if (default_locale != NULL) { - zend_string_release(locale_name); + zend_string_release_ex(locale_name, 0); } RETURN_TRUE; @@ -345,7 +345,7 @@ static zend_string* get_icu_value_internal( const char* loc_name , char* tag_nam /* Error in retriving data */ *result = 0; if( tag_value ){ - zend_string_release( tag_value ); + zend_string_release_ex( tag_value, 0 ); } if( mod_loc_name ){ efree( mod_loc_name); @@ -358,7 +358,7 @@ static zend_string* get_icu_value_internal( const char* loc_name , char* tag_nam /* No value found */ *result = -1; if( tag_value ){ - zend_string_release( tag_value ); + zend_string_release_ex( tag_value, 0 ); } if( mod_loc_name ){ efree( mod_loc_name); @@ -419,7 +419,7 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) /* No value found */ if( result == -1 ) { if( tag_value){ - zend_string_release( tag_value); + zend_string_release_ex( tag_value, 0 ); } RETURN_STRING( empty_result); } @@ -1074,14 +1074,14 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name) */ } if (key_value) { - zend_string_release(key_value); + zend_string_release_ex(key_value, 0); } } else { if( result == 1 ){ add_assoc_str( hash_arr, key_name , key_value); cur_result = 1; } else if (key_value) { - zend_string_release(key_value); + zend_string_release_ex(key_value, 0); } } @@ -1192,7 +1192,7 @@ PHP_FUNCTION(locale_get_all_variants) } } if( variant ){ - zend_string_release( variant ); + zend_string_release_ex( variant, 0 ); } } @@ -1308,7 +1308,7 @@ PHP_FUNCTION(locale_filter_matches) result = strToMatch( can_lang_tag->val , cur_lang_tag); if( result == 0) { efree( cur_lang_tag ); - zend_string_release( can_lang_tag ); + zend_string_release_ex( can_lang_tag, 0 ); RETURN_FALSE; } @@ -1316,9 +1316,9 @@ PHP_FUNCTION(locale_filter_matches) result = strToMatch( can_loc_range->val , cur_loc_range ); if( result == 0) { efree( cur_lang_tag ); - zend_string_release( can_lang_tag ); + zend_string_release_ex( can_lang_tag, 0 ); efree( cur_loc_range ); - zend_string_release( can_loc_range ); + zend_string_release_ex( can_loc_range, 0 ); RETURN_FALSE; } @@ -1332,10 +1332,10 @@ PHP_FUNCTION(locale_filter_matches) efree( cur_lang_tag ); efree( cur_loc_range ); if( can_lang_tag){ - zend_string_release( can_lang_tag ); + zend_string_release_ex( can_lang_tag, 0 ); } if( can_loc_range){ - zend_string_release( can_loc_range ); + zend_string_release_ex( can_loc_range, 0 ); } RETURN_TRUE; } @@ -1349,10 +1349,10 @@ PHP_FUNCTION(locale_filter_matches) efree( cur_loc_range ); } if( can_lang_tag){ - zend_string_release( can_lang_tag ); + zend_string_release_ex( can_lang_tag, 0 ); } if( can_loc_range){ - zend_string_release( can_loc_range ); + zend_string_release_ex( can_loc_range, 0 ); } RETURN_FALSE; @@ -1455,14 +1455,14 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr, lang_tag = get_icu_value_internal(cur_arr[i*2], LOC_CANONICALIZE_TAG, &result, 0); if(result != 1 || lang_tag == NULL || !lang_tag->val[0]) { if(lang_tag) { - zend_string_release(lang_tag); + zend_string_release_ex(lang_tag, 0); } intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag" , 0); LOOKUP_CLEAN_RETURN(NULL); } cur_arr[i*2] = erealloc(cur_arr[i*2], lang_tag->len+1); result = strToMatch(lang_tag->val, cur_arr[i*2]); - zend_string_release(lang_tag); + zend_string_release_ex(lang_tag, 0); if(result == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag" , 0); LOOKUP_CLEAN_RETURN(NULL); @@ -1478,7 +1478,7 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr, /* Error */ intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize loc_range" , 0 ); if(can_loc_range) { - zend_string_release(can_loc_range); + zend_string_release_ex(can_loc_range, 0); } LOOKUP_CLEAN_RETURN(NULL); } else { @@ -1490,7 +1490,7 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr, /* convert to lower and replace hyphens */ result = strToMatch(loc_range, cur_loc_range); if(can_loc_range) { - zend_string_release(can_loc_range); + zend_string_release_ex(can_loc_range, 0); } if(result == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag" , 0); diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index 90d60acbd2..65a00289b5 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -548,7 +548,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, spprintf(&message, 0, "The argument for key '%s' " "cannot be used as a date or time", ZSTR_VAL(u8key)); intl_errors_set(&err, err.code, message, 1); - zend_string_release(u8key); + zend_string_release_ex(u8key, 0); efree(message); } continue; @@ -594,7 +594,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, "is available", ZSTR_VAL(u8key)); intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, message, 1); - zend_string_release(u8key); + zend_string_release_ex(u8key, 0); efree(message); } } diff --git a/ext/json/json_parser.tab.c b/ext/json/json_parser.tab.c index 08e3e2b768..c165a19e53 100644 --- a/ext/json/json_parser.tab.c +++ b/ext/json/json_parser.tab.c @@ -139,8 +139,8 @@ int json_yydebug = 1; /* In a future release of Bison, this section will be replaced by #include "json_parser.tab.h". */ -#ifndef YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED -# define YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED +#ifndef YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED +# define YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -201,7 +201,7 @@ typedef union YYSTYPE YYSTYPE; int php_json_yyparse (php_json_parser *parser); -#endif /* !YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */ +#endif /* !YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */ /* Copy the second part of user declarations. */ @@ -1140,7 +1140,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, php_json_parser *p case 25: /* pair */ - { zend_string_release(((*yyvaluep).pair).key); zval_dtor(&((*yyvaluep).pair).val); } + { zend_string_release_ex(((*yyvaluep).pair).key, 0); zval_dtor(&((*yyvaluep).pair).val); } break; @@ -1885,7 +1885,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object, zval zkey; if (ZSTR_LEN(key) > 0 && ZSTR_VAL(key)[0] == '\0') { parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME; - zend_string_release(key); + zend_string_release_ex(key, 0); zval_dtor(zvalue); zval_dtor(object); return FAILURE; @@ -1894,7 +1894,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object, zend_std_write_property(object, &zkey, zvalue, NULL); Z_TRY_DELREF_P(zvalue); } - zend_string_release(key); + zend_string_release_ex(key, 0); return SUCCESS; } diff --git a/ext/json/json_parser.tab.h b/ext/json/json_parser.tab.h index 3f126dc9c7..4349b70406 100644 --- a/ext/json/json_parser.tab.h +++ b/ext/json/json_parser.tab.h @@ -30,8 +30,8 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED -# define YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED +#ifndef YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED +# define YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -92,4 +92,4 @@ typedef union YYSTYPE YYSTYPE; int php_json_yyparse (php_json_parser *parser); -#endif /* !YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */ +#endif /* !YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */ diff --git a/ext/json/json_parser.y b/ext/json/json_parser.y index 4c0dfa67d7..489cec1a5e 100644 --- a/ext/json/json_parser.y +++ b/ext/json/json_parser.y @@ -75,7 +75,7 @@ int json_yydebug = 1; %type <pair> pair %destructor { zval_dtor(&$$); } <value> -%destructor { zend_string_release($$.key); zval_dtor(&$$.val); } <pair> +%destructor { zend_string_release_ex($$.key, 0); zval_dtor(&$$.val); } <pair> %code { static int php_json_yylex(union YYSTYPE *value, php_json_parser *parser); @@ -277,7 +277,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object, zval zkey; if (ZSTR_LEN(key) > 0 && ZSTR_VAL(key)[0] == '\0') { parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME; - zend_string_release(key); + zend_string_release_ex(key, 0); zval_dtor(zvalue); zval_dtor(object); return FAILURE; @@ -286,7 +286,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object, zend_std_write_property(object, &zkey, zvalue, NULL); Z_TRY_DELREF_P(zvalue); } - zend_string_release(key); + zend_string_release_ex(key, 0); return SUCCESS; } diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 15f7adf571..cc2c6a7bd7 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -3759,7 +3759,7 @@ PHP_FUNCTION(ldap_set_rebind_proc) if (!zend_is_callable(callback, 0, NULL)) { zend_string *callback_name = zend_get_callable_name(callback); php_error_docref(NULL, E_WARNING, "Two arguments expected for '%s' to be a valid callback", ZSTR_VAL(callback_name)); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); RETURN_FALSE; } diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c index 582a29f865..a77df00e24 100644 --- a/ext/mbstring/mb_gpc.c +++ b/ext/mbstring/mb_gpc.c @@ -379,7 +379,7 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler) post_data_str = php_stream_copy_to_mem(SG(request_info).request_body, PHP_STREAM_COPY_ALL, 0); detected = _php_mb_encoding_handler_ex(&info, arg, post_data_str ? ZSTR_VAL(post_data_str) : NULL); if (post_data_str) { - zend_string_release(post_data_str); + zend_string_release_ex(post_data_str, 0); } MBSTRG(http_input_identify) = detected; diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 171430f778..8ed185c76a 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -1451,7 +1451,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes) if (ZSTR_LEN(tmp) > 0) { if (!(re = _php_mb_compile_regex(ZSTR_VAL(tmp)))) { - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); return FAILURE; } } @@ -1462,7 +1462,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes) MBSTRG(http_output_conv_mimetypes) = re; - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); return SUCCESS; } /* }}} */ @@ -1624,12 +1624,12 @@ ZEND_TSRMLS_CACHE_UPDATE(); ZEND_ASSERT(orig->type == ZEND_INTERNAL_FUNCTION); str = zend_string_init_interned(p->save_func, strlen(p->save_func), 1); zend_hash_add_mem(CG(function_table), str, orig, sizeof(zend_internal_function)); - zend_string_release(str); + zend_string_release_ex(str, 1); function_add_ref(orig); str = zend_string_init_interned(p->orig_func, strlen(p->orig_func), 1); ret = zend_hash_update_mem(CG(function_table), str, func, sizeof(zend_internal_function)); - zend_string_release(str); + zend_string_release_ex(str, 1); if (ret == NULL) { php_error_docref("ref.mbstring", E_WARNING, "mbstring couldn't replace function %s.", p->orig_func); return FAILURE; @@ -1792,7 +1792,7 @@ PHP_FUNCTION(mb_language) } else { RETVAL_TRUE; } - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } } /* }}} */ @@ -4113,7 +4113,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t zend_hash_update(ht, fld_name, &val); - zend_string_release(fld_name); + zend_string_release_ex(fld_name, 0); } fld_name = fld_val = NULL; @@ -4161,7 +4161,7 @@ out: zend_hash_update(ht, fld_name, &val); - zend_string_release(fld_name); + zend_string_release_ex(fld_name, 0); } } return state; @@ -4231,7 +4231,7 @@ PHP_FUNCTION(mb_send_mail) tmp_headers = zend_string_init(Z_STRVAL_P(headers), Z_STRLEN_P(headers), 0); MAIL_ASCIIZ_CHECK_MBSTRING(ZSTR_VAL(tmp_headers), ZSTR_LEN(tmp_headers)); str_headers = php_trim(tmp_headers, NULL, 0, 2); - zend_string_release(tmp_headers); + zend_string_release_ex(tmp_headers, 0); break; case IS_ARRAY: str_headers = php_mail_build_headers(headers); @@ -4382,7 +4382,7 @@ PHP_FUNCTION(mb_send_mail) if (n > 0 && p[n - 1] != '\n') { mbfl_memory_device_strncat(&device, "\n", 1); } - zend_string_release(str_headers); + zend_string_release_ex(str_headers, 0); } if (!zend_hash_str_exists(&ht_headers, "MIME-VERSION", sizeof("MIME-VERSION") - 1)) { @@ -4427,7 +4427,7 @@ PHP_FUNCTION(mb_send_mail) } if (extra_cmd) { - zend_string_release(extra_cmd); + zend_string_release_ex(extra_cmd, 0); } if (to_r != to) { @@ -4442,7 +4442,7 @@ PHP_FUNCTION(mb_send_mail) mbfl_memory_device_clear(&device); zend_hash_destroy(&ht_headers); if (str_headers) { - zend_string_release(str_headers); + zend_string_release_ex(str_headers, 0); } } diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 0c97ec33e8..60d9631d30 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -185,7 +185,7 @@ void php_clear_stmt_bind(MY_STMT *stmt) /* {{{ php_clear_mysql */ void php_clear_mysql(MY_MYSQL *mysql) { if (mysql->hash_key) { - zend_string_release(mysql->hash_key); + zend_string_release_ex(mysql->hash_key, 0); mysql->hash_key = NULL; } if (!Z_ISUNDEF(mysql->li_read)) { @@ -372,7 +372,7 @@ void mysqli_add_property(HashTable *h, const char *pname, size_t pname_len, mysq p.read_func = (r_func) ? r_func : mysqli_read_na; p.write_func = (w_func) ? w_func : mysqli_write_na; zend_hash_add_mem(h, p.name, &p, sizeof(mysqli_prop_handler)); - zend_string_release(p.name); + zend_string_release_ex(p.name, 1); } /* }}} */ diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 3de335cf2c..12b6ad5449 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -290,7 +290,7 @@ end: err: if (mysql->hash_key) { - zend_string_release(mysql->hash_key); + zend_string_release_ex(mysql->hash_key, 0); mysql->hash_key = NULL; mysql->persistent = FALSE; } diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c index c5d610c1eb..e56ea20380 100644 --- a/ext/mysqlnd/mysqlnd_auth.c +++ b/ext/mysqlnd/mysqlnd_auth.c @@ -734,7 +734,7 @@ mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn, BIO_free(bio); DBG_INF("Successfully loaded"); DBG_INF_FMT("Public key:%*.s", ZSTR_LEN(key_str), ZSTR_VAL(key_str)); - zend_string_release(key_str); + zend_string_release_ex(key_str, 0); } php_stream_close(stream); } diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c index 1e21e46ed0..9f8e1fb5b9 100644 --- a/ext/mysqlnd/mysqlnd_connection.c +++ b/ext/mysqlnd/mysqlnd_connection.c @@ -1805,7 +1805,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons if (!conn->options->connect_attr) { goto oom; } - zend_hash_init(conn->options->connect_attr, 0, NULL, ZVAL_PTR_DTOR, conn->persistent); + zend_hash_init(conn->options->connect_attr, 0, NULL, conn->persistent ? ZVAL_INTERNAL_PTR_DTOR : ZVAL_PTR_DTOR, conn->persistent); } DBG_INF_FMT("Adding [%s][%s]", key, value); { @@ -1815,7 +1815,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons ZVAL_NEW_STR(&attrz, zend_string_init(value, strlen(value), conn->persistent)); GC_MAKE_PERSISTENT_LOCAL(Z_COUNTED(attrz)); zend_hash_update(conn->options->connect_attr, str, &attrz); - zend_string_release(str); + zend_string_release_ex(str, 1); } break; default: diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index afc9839a49..6fb9c5fde2 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -206,7 +206,7 @@ MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const cha UNKNOWN_SQLSTATE, errstr? ZSTR_VAL(errstr):"Unknown error while connecting"); if (errstr) { - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); } DBG_RETURN(NULL); } diff --git a/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c index 5aa8b0d23d..0141cec4f0 100644 --- a/ext/mysqlnd/mysqlnd_result_meta.c +++ b/ext/mysqlnd/mysqlnd_result_meta.c @@ -36,7 +36,7 @@ php_mysqlnd_free_field_metadata(MYSQLND_FIELD *meta) meta->root = NULL; meta->def = NULL; if (meta->sname) { - zend_string_release(meta->sname); + zend_string_release_ex(meta->sname, 0); } } } diff --git a/ext/mysqlnd/mysqlnd_vio.c b/ext/mysqlnd/mysqlnd_vio.c index a6a7f5c4d1..997fbd4d68 100644 --- a/ext/mysqlnd/mysqlnd_vio.c +++ b/ext/mysqlnd/mysqlnd_vio.c @@ -196,7 +196,7 @@ MYSQLND_METHOD(mysqlnd_vio, open_tcp_or_unix)(MYSQLND_VIO * const vio, const MYS UNKNOWN_SQLSTATE, errstr? ZSTR_VAL(errstr):"Unknown error while connecting"); if (errstr) { - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); } DBG_RETURN(NULL); } diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index cd17386b5f..ceeaefeb77 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -60,16 +60,16 @@ PHP_FUNCTION(oci_register_taf_callback) if (!zend_is_callable(callback, 0, 0)) { callback_name = zend_get_callable_name(callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name)); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); RETURN_FALSE; } #else if (!zend_is_callable(callback, 0, &callback_name)) { php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name)); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); RETURN_FALSE; } - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); #endif } @@ -141,10 +141,10 @@ PHP_FUNCTION(oci_define_by_name) /* if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) { */ zvtmp = zend_string_init(name, name_len, 0); if ((define = zend_hash_add_new_ptr(statement->defines, zvtmp, define)) != NULL) { - zend_string_release(zvtmp); + zend_string_release_ex(zvtmp, 0); } else { efree(define); - zend_string_release(zvtmp); + zend_string_release_ex(zvtmp, 0); RETURN_FALSE; } @@ -1472,7 +1472,7 @@ PHP_FUNCTION(oci_fetch_all) zend_string *zvtmp; zvtmp = zend_string_init(columns[ i ]->name, columns[ i ]->name_len, 0); zend_symtable_update(Z_ARRVAL(row), zvtmp, &element); - zend_string_release(zvtmp); + zend_string_release_ex(zvtmp, 0); } } @@ -1507,7 +1507,7 @@ PHP_FUNCTION(oci_fetch_all) array_init(&tmp); zvtmp = zend_string_init(columns[ i ]->name, columns[ i ]->name_len, 0); outarrs[ i ] = zend_symtable_update(Z_ARRVAL_P(array), zvtmp, &tmp); - zend_string_release(zvtmp); + zend_string_release_ex(zvtmp, 0); } } diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 743561428c..8d259eebfa 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -1256,7 +1256,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l zvtmp = zend_string_init(name, name_len, 0); bindp = (php_oci_bind *) ecalloc(1, sizeof(php_oci_bind)); bindp = zend_hash_update_ptr(statement->binds, zvtmp, bindp); - zend_string_release(zvtmp); + zend_string_release_ex(zvtmp, 0); } /* Make sure the minimum of value_sz is 1 to avoid ORA-3149 @@ -1702,7 +1702,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t zvtmp = zend_string_init(name, name_len, 0); zend_hash_update_ptr(statement->binds, zvtmp, bind); - zend_string_release(zvtmp); + zend_string_release_ex(zvtmp, 0); statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index d2db5181dd..621236fc08 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -704,7 +704,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array Z_TYPE_INFO(ZEND_OP2_LITERAL(src)) = IS_STRING_EX; memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0'; - zend_string_release(Z_STR(ZEND_OP2_LITERAL(opline))); + zend_string_release_ex(Z_STR(ZEND_OP2_LITERAL(opline)), 0); ZVAL_STR(&ZEND_OP2_LITERAL(opline), zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)))); ZVAL_NULL(&ZEND_OP2_LITERAL(src)); MAKE_NOP(src); diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index b2f463c65a..d9e5f919e9 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -111,7 +111,7 @@ static uint32_t add_static_slot(HashTable *hash, ZVAL_LONG(&tmp, ret); zend_hash_add(hash, key, &tmp); } - zend_string_release(key); + zend_string_release_ex(key, 0); return ret; } @@ -379,7 +379,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx (LITERAL_NUM_RELATED(info[i].flags) != 2 || ((info[i].flags & LITERAL_KIND_MASK) != LITERAL_VALUE && (info[Z_LVAL_P(pos)].flags & LITERAL_KIND_MASK) != LITERAL_VALUE))) { - zend_string_release(key); + zend_string_release_ex(key, 0); map[i] = Z_LVAL_P(pos); zval_ptr_dtor_nogc(&op_array->literals[i]); n = LITERAL_NUM_RELATED(info[i].flags); @@ -392,7 +392,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx map[i] = j; ZVAL_LONG(&zv, j); zend_hash_add_new(&hash, key, &zv); - zend_string_release(key); + zend_string_release_ex(key, 0); if (i != j) { op_array->literals[j] = op_array->literals[i]; info[j] = info[i]; diff --git a/ext/opcache/Optimizer/compact_vars.c b/ext/opcache/Optimizer/compact_vars.c index ab4dd12614..c7bda48c88 100644 --- a/ext/opcache/Optimizer/compact_vars.c +++ b/ext/opcache/Optimizer/compact_vars.c @@ -112,14 +112,14 @@ void zend_optimizer_compact_vars(zend_op_array *op_array) { if (vars_map[i] != (uint32_t) -1) { names[vars_map[i]] = op_array->vars[i]; } else { - zend_string_release(op_array->vars[i]); + zend_string_release_ex(op_array->vars[i], 0); } } efree(op_array->vars); op_array->vars = names; } else { for (i = 0; i < op_array->last_var; i++) { - zend_string_release(op_array->vars[i]); + zend_string_release_ex(op_array->vars[i], 0); } efree(op_array->vars); op_array->vars = NULL; diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 7eb80317e2..8a157c447d 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -175,7 +175,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx) } else { /* ZEND_ADD_STRING */ memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); ptr += Z_STRLEN(ZEND_OP2_LITERAL(opline)); - zend_string_release(Z_STR(ZEND_OP2_LITERAL(opline))); + zend_string_release_ex(Z_STR(ZEND_OP2_LITERAL(opline)), 0); ZVAL_NEW_STR(&ZEND_OP2_LITERAL(opline), str); } next_op = opline + 1; @@ -451,7 +451,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx) zend_optimizer_update_op1_const(op_array, opline, &t); } } - zend_string_release(lc_name); + zend_string_release_ex(lc_name, 0); break; } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("extension_loaded")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)), @@ -463,7 +463,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx) zend_module_entry *m = zend_hash_find_ptr(&module_registry, lc_name); - zend_string_release(lc_name); + zend_string_release_ex(lc_name, 0); if (!m) { if (PG(enable_dl)) { break; @@ -541,7 +541,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx) zend_optimizer_update_op1_const(op_array, opline, &t); } } else { - zend_string_release(dirname); + zend_string_release_ex(dirname, 0); } break; } diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index 5f5f7da3d8..23c5d5ac53 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -547,7 +547,7 @@ static inline int ct_eval_assign_dim(zval *result, zval *value, zval *key) { value_str = zval_get_string(value); ZVAL_STR(result, new_str); Z_STRVAL_P(result)[index] = ZSTR_VAL(value_str)[0]; - zend_string_release(value_str); + zend_string_release_ex(value_str, 0); #endif return FAILURE; default: diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 8ec9195511..e823f8859b 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -1762,7 +1762,7 @@ int zend_func_info_startup(void) if (zend_hash_add_ptr(&func_info, key, (void**)&func_infos[i]) == NULL) { fprintf(stderr, "ERROR: Duplicate function info for \"%s\"\n", func_infos[i].name); } - zend_string_release(key); + zend_string_release_ex(key, 1); } } diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index c3cbef84cd..4414fb78d8 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2237,7 +2237,7 @@ static uint32_t zend_fetch_arg_info(const zend_script *script, zend_arg_info *ar zend_string *lcname = zend_string_tolower(ZEND_TYPE_NAME(arg_info->type)); tmp |= MAY_BE_OBJECT; *pce = get_class_entry(script, lcname); - zend_string_release(lcname); + zend_string_release_ex(lcname, 0); } else if (ZEND_TYPE_IS_CODE(arg_info->type)) { zend_uchar type_hint = ZEND_TYPE_CODE(arg_info->type); diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index c70f55ec27..acec6aabf6 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -173,12 +173,12 @@ static ZEND_FUNCTION(accel_chdir) orig_chdir(INTERNAL_FUNCTION_PARAM_PASSTHRU); if (VCWD_GETCWD(cwd, MAXPATHLEN)) { if (ZCG(cwd)) { - zend_string_release(ZCG(cwd)); + zend_string_release_ex(ZCG(cwd), 0); } ZCG(cwd) = zend_string_init(cwd, strlen(cwd), 0); } else { if (ZCG(cwd)) { - zend_string_release(ZCG(cwd)); + zend_string_release_ex(ZCG(cwd), 0); ZCG(cwd) = NULL; } } @@ -1045,7 +1045,7 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri if (full_path_ptr && persistent_script->script.filename != full_path_ptr && !zend_string_equal_content(persistent_script->script.filename, full_path_ptr)) { - zend_string_release(full_path_ptr); + zend_string_release_ex(full_path_ptr, 0); return FAILURE; } file_handle->opened_path = full_path_ptr; @@ -1053,7 +1053,7 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri if (persistent_script->timestamp == 0) { if (full_path_ptr) { - zend_string_release(full_path_ptr); + zend_string_release_ex(full_path_ptr, 0); file_handle->opened_path = NULL; } return FAILURE; @@ -1061,13 +1061,13 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri if (zend_get_file_handle_timestamp(file_handle, NULL) == persistent_script->timestamp) { if (full_path_ptr) { - zend_string_release(full_path_ptr); + zend_string_release_ex(full_path_ptr, 0); file_handle->opened_path = NULL; } return SUCCESS; } if (full_path_ptr) { - zend_string_release(full_path_ptr); + zend_string_release_ex(full_path_ptr, 0); file_handle->opened_path = NULL; } @@ -1156,7 +1156,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l zend_shared_alloc_lock(); str = accel_new_interned_string(zend_string_copy(cwd_str)); if (str == cwd_str) { - zend_string_release(str); + zend_string_release_ex(str, 0); str = NULL; } zend_shared_alloc_unlock(); @@ -1317,7 +1317,7 @@ int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool f } accelerator_shm_read_unlock(); - zend_string_release(realpath); + zend_string_release_ex(realpath, 0); return SUCCESS; } @@ -2311,7 +2311,7 @@ static void accel_activate(void) if (ZCG(root_hash) != buf.st_ino) { zend_string *key = zend_string_init("opcache.enable", sizeof("opcache.enable")-1, 0); zend_alter_ini_entry_chars(key, "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME); - zend_string_release(key); + zend_string_release_ex(key, 0); zend_accel_error(ACCEL_LOG_WARNING, "Can't cache files in chroot() directory with too big inode"); return; } @@ -2413,7 +2413,7 @@ static void accel_deactivate(void) */ if (ZCG(cwd)) { - zend_string_release(ZCG(cwd)); + zend_string_release_ex(ZCG(cwd), 0); ZCG(cwd) = NULL; } diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index a6d9b543a6..1fc8c5a8b9 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -94,7 +94,7 @@ void free_persistent_script(zend_persistent_script *persistent_script, int destr zend_hash_destroy(&persistent_script->script.class_table); if (persistent_script->script.filename) { - zend_string_release(persistent_script->script.filename); + zend_string_release_ex(persistent_script->script.filename, 0); } efree(persistent_script); @@ -824,7 +824,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, if (!zend_hash_exists(EG(zend_constants), name)) { zend_register_long_constant(ZSTR_VAL(name), ZSTR_LEN(name), persistent_script->compiler_halt_offset, CONST_CS, 0); } - zend_string_release(name); + zend_string_release_ex(name, 0); } zend_hash_destroy(&ZCG(bind_hash)); diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index ca7b9cf92e..05ec90ad2f 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -877,7 +877,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm) if (writev(fd, vec, 3) != (ssize_t)(sizeof(info) + script->size + info.str_size)) { zend_accel_error(ACCEL_LOG_WARNING, "opcache cannot write to file '%s'\n", filename); - zend_string_release((zend_string*)ZCG(mem)); + zend_string_release_ex((zend_string*)ZCG(mem), 0); close(fd); efree(mem); unlink(filename); @@ -891,7 +891,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm) write(fd, ((zend_string*)ZCG(mem))->val, info.str_size) != info.str_size ) { zend_accel_error(ACCEL_LOG_WARNING, "opcache cannot write to file '%s'\n", filename); - zend_string_release((zend_string*)ZCG(mem)); + zend_string_release_ex((zend_string*)ZCG(mem), 0); close(fd); efree(mem); unlink(filename); @@ -900,7 +900,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm) } #endif - zend_string_release((zend_string*)ZCG(mem)); + zend_string_release_ex((zend_string*)ZCG(mem), 0); efree(mem); if (zend_file_cache_flock(fd, LOCK_UN) != 0) { zend_accel_error(ACCEL_LOG_WARNING, "opcache cannot unlock file '%s'\n", filename); diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index d40f1886e4..231c509571 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -50,11 +50,11 @@ #define zend_accel_store_string(str) do { \ zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \ if (new_str) { \ - zend_string_release(str); \ + zend_string_release_ex(str, 0); \ str = new_str; \ } else { \ new_str = zend_accel_memdup((void*)str, _ZSTR_STRUCT_SIZE(ZSTR_LEN(str))); \ - zend_string_release(str); \ + zend_string_release_ex(str, 0); \ str = new_str; \ zend_string_hash_val(str); \ zend_set_str_gc_flags(str); \ @@ -572,7 +572,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc } } else { if (!already_stored) { - zend_string_release(op_array->doc_comment); + zend_string_release_ex(op_array->doc_comment, 0); } op_array->doc_comment = NULL; } @@ -661,7 +661,7 @@ static void zend_persist_property_info(zval *zv) if (!zend_shared_alloc_get_xlat_entry(prop->doc_comment)) { zend_shared_alloc_register_xlat_entry(prop->doc_comment, prop->doc_comment); } - zend_string_release(prop->doc_comment); + zend_string_release_ex(prop->doc_comment, 0); prop->doc_comment = NULL; } } @@ -693,7 +693,7 @@ static void zend_persist_class_constant(zval *zv) zend_string *doc_comment = zend_shared_alloc_get_xlat_entry(c->doc_comment); if (!doc_comment) { zend_shared_alloc_register_xlat_entry(c->doc_comment, c->doc_comment); - zend_string_release(c->doc_comment); + zend_string_release_ex(c->doc_comment, 0); } c->doc_comment = NULL; } @@ -741,7 +741,7 @@ static void zend_persist_class_entry(zval *zv) } else { if (!zend_shared_alloc_get_xlat_entry(ce->info.user.doc_comment)) { zend_shared_alloc_register_xlat_entry(ce->info.user.doc_comment, ce->info.user.doc_comment); - zend_string_release(ce->info.user.doc_comment); + zend_string_release_ex(ce->info.user.doc_comment, 0); } ce->info.user.doc_comment = NULL; } diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 4dee76b3a3..6feedc6e6f 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -39,9 +39,6 @@ } else if (!IS_ACCEL_INTERNED(str)) { \ zend_string *tmp = accel_new_interned_string(str); \ if (tmp != (str)) { \ - if (do_free) { \ - /*zend_string_release(str);*/ \ - } \ (str) = tmp; \ } else { \ ADD_STRING(str); \ diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index c2cd1d32fb..4aae81dbd7 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1897,7 +1897,7 @@ cleanup: } if (keyresource == NULL && s != NULL) { - zend_string_release(s); + zend_string_release_ex(s, 0); } } /* }}} */ @@ -4930,10 +4930,10 @@ PHP_FUNCTION(openssl_dh_compute_key) if (len >= 0) { ZSTR_LEN(data) = len; ZSTR_VAL(data)[len] = 0; - RETVAL_STR(data); + RETVAL_NEW_STR(data); } else { php_openssl_store_errors(); - zend_string_release(data); + zend_string_release_ex(data, 0); RETVAL_FALSE; } @@ -4975,10 +4975,10 @@ PHP_FUNCTION(openssl_pkey_derive) if (EVP_PKEY_derive(ctx, (unsigned char*)ZSTR_VAL(result), &key_size) > 0) { ZSTR_LEN(result) = key_size; ZSTR_VAL(result)[key_size] = 0; - RETVAL_STR(result); + RETVAL_NEW_STR(result); } else { php_openssl_store_errors(); - zend_string_release(result); + zend_string_release_ex(result, 0); RETVAL_FALSE; } } else { @@ -5039,7 +5039,7 @@ PHP_FUNCTION(openssl_pbkdf2) RETURN_NEW_STR(out_buffer); } else { php_openssl_store_errors(); - zend_string_release(out_buffer); + zend_string_release_ex(out_buffer, 0); RETURN_FALSE; } } @@ -5681,7 +5681,7 @@ PHP_FUNCTION(openssl_private_encrypt) php_openssl_store_errors(); } if (cryptedbuf) { - zend_string_release(cryptedbuf); + zend_string_release_ex(cryptedbuf, 0); } if (keyresource == NULL) { EVP_PKEY_free(pkey); @@ -5754,7 +5754,7 @@ PHP_FUNCTION(openssl_private_decrypt) EVP_PKEY_free(pkey); } if (cryptedbuf) { - zend_string_release(cryptedbuf); + zend_string_release_ex(cryptedbuf, 0); } } /* }}} */ @@ -5815,7 +5815,7 @@ PHP_FUNCTION(openssl_public_encrypt) EVP_PKEY_free(pkey); } if (cryptedbuf) { - zend_string_release(cryptedbuf); + zend_string_release_ex(cryptedbuf, 0); } } /* }}} */ @@ -5884,7 +5884,7 @@ PHP_FUNCTION(openssl_public_decrypt) } if (cryptedbuf) { - zend_string_release(cryptedbuf); + zend_string_release_ex(cryptedbuf, 0); } if (keyresource == NULL) { EVP_PKEY_free(pkey); @@ -6371,12 +6371,12 @@ PHP_FUNCTION(openssl_digest) make_digest_ex(ZSTR_VAL(digest_str), (unsigned char*)ZSTR_VAL(sigbuf), siglen); ZSTR_VAL(digest_str)[digest_str_len] = '\0'; - zend_string_release(sigbuf); - RETVAL_STR(digest_str); + zend_string_release_ex(sigbuf, 0); + RETVAL_NEW_STR(digest_str); } } else { php_openssl_store_errors(); - zend_string_release(sigbuf); + zend_string_release_ex(sigbuf, 0); RETVAL_FALSE; } @@ -6572,7 +6572,7 @@ static int php_openssl_cipher_update(const EVP_CIPHER *cipher_type, } */ php_openssl_store_errors(); - zend_string_release(*poutbuf); + zend_string_release_ex(*poutbuf, 0); return FAILURE; } @@ -6636,7 +6636,7 @@ PHP_FUNCTION(openssl_encrypt) zend_string *base64_str; base64_str = php_base64_encode((unsigned char*)ZSTR_VAL(outbuf), outlen); - zend_string_release(outbuf); + zend_string_release_ex(outbuf, 0); outbuf = base64_str; RETVAL_STR(base64_str); } @@ -6650,8 +6650,8 @@ PHP_FUNCTION(openssl_encrypt) ZVAL_NEW_STR(tag, tag_str); } else { php_error_docref(NULL, E_WARNING, "Retrieving verification tag failed"); - zend_string_release(tag_str); - zend_string_release(outbuf); + zend_string_release_ex(tag_str, 0); + zend_string_release_ex(outbuf, 0); RETVAL_FALSE; } } else if (tag) { @@ -6661,12 +6661,12 @@ PHP_FUNCTION(openssl_encrypt) "The authenticated tag cannot be provided for cipher that doesn not support AEAD"); } else if (mode.is_aead) { php_error_docref(NULL, E_WARNING, "A tag should be provided when using AEAD mode"); - zend_string_release(outbuf); + zend_string_release_ex(outbuf, 0); RETVAL_FALSE; } } else { php_openssl_store_errors(); - zend_string_release(outbuf); + zend_string_release_ex(outbuf, 0); RETVAL_FALSE; } @@ -6750,7 +6750,7 @@ PHP_FUNCTION(openssl_decrypt) RETVAL_STR(outbuf); } else { php_openssl_store_errors(); - zend_string_release(outbuf); + zend_string_release_ex(outbuf, 0); RETVAL_FALSE; } @@ -6761,7 +6761,7 @@ PHP_FUNCTION(openssl_decrypt) efree(iv); } if (base64_str) { - zend_string_release(base64_str); + zend_string_release_ex(base64_str, 0); } EVP_CIPHER_CTX_cleanup(cipher_ctx); EVP_CIPHER_CTX_free(cipher_ctx); @@ -6824,7 +6824,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes) #ifdef PHP_WIN32 /* random/urandom equivalent on Windows */ if (php_win32_get_random_bytes((unsigned char*)buffer->val, (size_t) buffer_length) == FAILURE){ - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); if (zstrong_result_returned) { ZVAL_FALSE(zstrong_result_returned); } @@ -6836,7 +6836,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes) PHP_OPENSSL_RAND_ADD_TIME(); /* FIXME loop if requested size > INT_MAX */ if (RAND_bytes((unsigned char*)ZSTR_VAL(buffer), (int)buffer_length) <= 0) { - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); if (zstrong_result_returned) { ZVAL_FALSE(zstrong_result_returned); } @@ -6847,7 +6847,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes) #endif ZSTR_VAL(buffer)[buffer_length] = 0; - RETVAL_STR(buffer); + RETVAL_NEW_STR(buffer); if (zstrong_result_returned) { ZVAL_BOOL(zstrong_result_returned, 1); diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 9225f67668..0d5027f41e 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -313,7 +313,7 @@ static int php_openssl_x509_fingerprint_cmp(X509 *peer, const char *method, cons fingerprint = php_openssl_x509_fingerprint(peer, method, 0); if (fingerprint) { result = strcasecmp(expected, ZSTR_VAL(fingerprint)); - zend_string_release(fingerprint); + zend_string_release_ex(fingerprint, 0); } return result; diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 82a4a454e2..c65e1ecd66 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -972,7 +972,7 @@ PHP_FUNCTION(pcntl_exec) strlcat(*pair, Z_STRVAL_P(element), pair_length); /* Cleanup */ - zend_string_release(key); + zend_string_release_ex(key, 0); envi++; pair++; } ZEND_HASH_FOREACH_END(); @@ -1049,7 +1049,7 @@ PHP_FUNCTION(pcntl_signal) zend_string *func_name = zend_get_callable_name(handle); PCNTL_G(last_error) = EINVAL; php_error_docref(NULL, E_WARNING, "%s is not a callable function name error", ZSTR_VAL(func_name)); - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); RETURN_FALSE; } diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 350b7c3565..ffecc39422 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -558,7 +558,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) if (zv) { #if HAVE_SETLOCALE if (key != regex) { - zend_string_release(key); + zend_string_release_ex(key, 0); } #endif return (pcre_cache_entry*)Z_PTR_P(zv); @@ -572,7 +572,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) if (*p == 0) { #if HAVE_SETLOCALE if (key != regex) { - zend_string_release(key); + zend_string_release_ex(key, 0); } #endif php_error_docref(NULL, E_WARNING, @@ -587,7 +587,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) if (isalnum((int)*(unsigned char *)&delimiter) || delimiter == '\\') { #if HAVE_SETLOCALE if (key != regex) { - zend_string_release(key); + zend_string_release_ex(key, 0); } #endif php_error_docref(NULL,E_WARNING, "Delimiter must not be alphanumeric or backslash"); @@ -632,7 +632,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) if (*pp == 0) { #if HAVE_SETLOCALE if (key != regex) { - zend_string_release(key); + zend_string_release_ex(key, 0); } #endif if (pp < ZSTR_VAL(regex) + ZSTR_LEN(regex)) { @@ -696,7 +696,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) efree(pattern); #if HAVE_SETLOCALE if (key != regex) { - zend_string_release(key); + zend_string_release_ex(key, 0); } #endif return NULL; @@ -732,7 +732,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) if (re == NULL) { #if HAVE_SETLOCALE if (key != regex) { - zend_string_release(key); + zend_string_release_ex(key, 0); } #endif pcre2_get_error_message(errnumber, error, sizeof(error)); @@ -787,7 +787,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) if (rc < 0) { #if HAVE_SETLOCALE if (key != regex) { - zend_string_release(key); + zend_string_release_ex(key, 0); } #endif php_error_docref(NULL, E_WARNING, "Internal pcre2_pattern_info() error %d", rc); @@ -799,7 +799,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) if (rc < 0) { #if HAVE_SETLOCALE if (key != regex) { - zend_string_release(key); + zend_string_release_ex(key, 0); } #endif php_error_docref(NULL, E_WARNING, "Internal pcre_pattern_info() error %d", rc); @@ -821,7 +821,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) GC_MAKE_PERSISTENT_LOCAL(str); #if HAVE_SETLOCALE if (key != regex) { - zend_string_release(key); + zend_string_release_ex(key, 0); } #endif key = str; @@ -1717,7 +1717,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su } else { pcre_handle_exec_error(count); if (result) { - zend_string_release(result); + zend_string_release_ex(result, 0); result = NULL; } break; @@ -1866,7 +1866,7 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin /* If using custom function, copy result to the buffer and clean up. */ memcpy(ZSTR_VAL(result) + result_len, ZSTR_VAL(eval_result), ZSTR_LEN(eval_result)); result_len += ZSTR_LEN(eval_result); - zend_string_release(eval_result); + zend_string_release_ex(eval_result, 0); if (limit) { limit--; @@ -1917,7 +1917,7 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin } else { pcre_handle_exec_error(count); if (result) { - zend_string_release(result); + zend_string_release_ex(result, 0); result = NULL; } break; @@ -2004,7 +2004,7 @@ static zend_string *php_pcre_replace_array(HashTable *regex, zval *replace, zend replace_count); zend_tmp_string_release(tmp_replace_str); zend_tmp_string_release(tmp_regex_str); - zend_string_release(subject_str); + zend_string_release_ex(subject_str, 0); subject_str = result; if (UNEXPECTED(result == NULL)) { break; @@ -2030,7 +2030,7 @@ static zend_string *php_pcre_replace_array(HashTable *regex, zval *replace, zend limit, replace_count); zend_tmp_string_release(tmp_regex_str); - zend_string_release(subject_str); + zend_string_release_ex(subject_str, 0); subject_str = result; if (UNEXPECTED(result == NULL)) { @@ -2058,7 +2058,7 @@ static zend_always_inline zend_string *php_replace_in_subject(zval *regex, zval Z_STR_P(replace), limit, replace_count); - zend_string_release(subject_str); + zend_string_release_ex(subject_str, 0); } else { result = php_pcre_replace_array(Z_ARRVAL_P(regex), replace, @@ -2083,7 +2083,7 @@ static zend_string *php_replace_in_subject_func(zval *regex, zend_fcall_info *fc fci, fcc, limit, replace_count); - zend_string_release(subject_str); + zend_string_release_ex(subject_str, 0); return result; } else { zval *regex_entry; @@ -2104,7 +2104,7 @@ static zend_string *php_replace_in_subject_func(zval *regex, zend_fcall_info *fc limit, replace_count); zend_tmp_string_release(tmp_regex_str); - zend_string_release(subject_str); + zend_string_release_ex(subject_str, 0); subject_str = result; if (UNEXPECTED(result == NULL)) { break; @@ -2205,7 +2205,7 @@ static void preg_replace_common(INTERNAL_FUNCTION_PARAMETERS, int is_filter) if (!is_filter || replace_count > old_replace_count) { RETVAL_STR(result); } else { - zend_string_release(result); + zend_string_release_ex(result, 0); RETVAL_NULL(); } } else { @@ -2238,7 +2238,7 @@ static void preg_replace_common(INTERNAL_FUNCTION_PARAMETERS, int is_filter) zend_hash_index_add_new(Z_ARRVAL_P(return_value), num_key, &zv); } } else { - zend_string_release(result); + zend_string_release_ex(result, 0); } } } ZEND_HASH_FOREACH_END(); @@ -2282,7 +2282,7 @@ static PHP_FUNCTION(preg_replace_callback) if (!zend_is_callable_ex(replace, NULL, 0, NULL, &fcc, NULL)) { zend_string *callback_name = zend_get_callable_name(replace); php_error_docref(NULL, E_WARNING, "Requires argument 2, '%s', to be a valid callback", ZSTR_VAL(callback_name)); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); ZVAL_STR(return_value, zval_get_string(subject)); return; } @@ -2334,7 +2334,7 @@ static PHP_FUNCTION(preg_replace_callback_array) if (!zend_is_callable_ex(replace, NULL, 0, NULL, &fcc, NULL)) { zend_string *callback_name = zend_get_callable_name(replace); php_error_docref(NULL, E_WARNING, "'%s' is not a valid callback", ZSTR_VAL(callback_name)); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); zval_ptr_dtor(®ex); zval_ptr_dtor(return_value); ZVAL_COPY(return_value, subject); @@ -2789,7 +2789,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return count = num_subpats; } else if (count < 0 && count != PCRE2_ERROR_NOMATCH) { pcre_handle_exec_error(count); - zend_string_release(subject_str); + zend_string_release_ex(subject_str, 0); break; } @@ -2805,7 +2805,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return } } - zend_string_release(subject_str); + zend_string_release_ex(subject_str, 0); } ZEND_HASH_FOREACH_END(); if (match_data != mdata) { pcre2_match_data_free(match_data); diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index e78baea762..3428b6386c 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -169,7 +169,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt) /* {{{ */ } if (message) { - zend_string_release(message); + zend_string_release_ex(message, 0); } if (supp) { @@ -1253,7 +1253,7 @@ const zend_function_entry pdo_dbh_functions[] = /* {{{ */ { static void cls_method_dtor(zval *el) /* {{{ */ { zend_function *func = (zend_function*)Z_PTR_P(el); if (func->common.function_name) { - zend_string_release(func->common.function_name); + zend_string_release_ex(func->common.function_name, 0); } efree(func); } @@ -1262,7 +1262,7 @@ static void cls_method_dtor(zval *el) /* {{{ */ { static void cls_method_pdtor(zval *el) /* {{{ */ { zend_function *func = (zend_function*)Z_PTR_P(el); if (func->common.function_name) { - zend_string_release(func->common.function_name); + zend_string_release_ex(func->common.function_name, 1); } pefree(func, 1); } @@ -1356,7 +1356,7 @@ static union _zend_function *dbh_method_get(zend_object **object, zend_string *m lc_method_name = zend_string_tolower(method_name); fbc = zend_hash_find_ptr(dbh_obj->inner->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_DBH], lc_method_name); - zend_string_release(lc_method_name); + zend_string_release_ex(lc_method_name, 0); } out: diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c index a1aabf7d86..2a2cff7946 100644 --- a/ext/pdo/pdo_sql_parser.c +++ b/ext/pdo/pdo_sql_parser.c @@ -1,4 +1,4 @@ -/* Generated by re2c 1.0.3 */ +/* Generated by re2c 0.16 */ #line 1 "ext/pdo/pdo_sql_parser.re" /* +----------------------------------------------------------------------+ @@ -111,7 +111,7 @@ yy8: if (yych <= 0x00) goto yy7; goto yy21; yy9: - ++YYCURSOR; + yych = *++YYCURSOR; goto yy7; yy10: yych = *++YYCURSOR; @@ -120,7 +120,7 @@ yy10: default: goto yy7; } yy11: - yych = *++YYCURSOR; + yych = *(YYMARKER = ++YYCURSOR); switch (yych) { case '*': goto yy28; default: goto yy7; @@ -195,8 +195,8 @@ yy12: default: goto yy7; } yy13: - yych = *++YYCURSOR; - switch (yych) { + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { case '?': goto yy36; default: goto yy14; } @@ -374,6 +374,7 @@ yy38: } yy40: ++YYCURSOR; + yych = *YYCURSOR; goto yy27; } #line 66 "ext/pdo/pdo_sql_parser.re" @@ -540,12 +541,12 @@ safe: ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); if (buf) { - zend_string_release(buf); + zend_string_release_ex(buf, 0); } goto clean_up; } if (buf) { - zend_string_release(buf); + zend_string_release_ex(buf, 0); } } else { pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource"); @@ -592,7 +593,7 @@ safe: ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); if (buf) { - zend_string_release(buf); + zend_string_release_ex(buf, 0); } goto clean_up; } @@ -600,7 +601,7 @@ safe: } if (buf) { - zend_string_release(buf); + zend_string_release_ex(buf, 0); } } } else { diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index 76e4190ac4..648358180c 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -226,12 +226,12 @@ safe: ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); if (buf) { - zend_string_release(buf); + zend_string_release_ex(buf, 0); } goto clean_up; } if (buf) { - zend_string_release(buf); + zend_string_release_ex(buf, 0); } } else { pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource"); @@ -278,7 +278,7 @@ safe: ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); if (buf) { - zend_string_release(buf); + zend_string_release_ex(buf, 0); } goto clean_up; } @@ -286,7 +286,7 @@ safe: } if (buf) { - zend_string_release(buf); + zend_string_release_ex(buf, 0); } } } else { diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 01c429c8ce..b1b58b4cc6 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -263,7 +263,7 @@ static void param_dtor(zval *el) /* {{{ */ } if (param->name) { - zend_string_release(param->name); + zend_string_release_ex(param->name, 0); } if (!Z_ISUNDEF(param->parameter)) { @@ -359,7 +359,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s if (is_param && !rewrite_name_to_position(stmt, param)) { if (param->name) { - zend_string_release(param->name); + zend_string_release_ex(param->name, 0); param->name = NULL; } return 0; @@ -373,7 +373,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s if (!stmt->methods->param_hook(stmt, param, PDO_PARAM_EVT_NORMALIZE )) { if (param->name) { - zend_string_release(param->name); + zend_string_release_ex(param->name, 0); param->name = NULL; } return 0; @@ -2016,7 +2016,7 @@ static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt) for (i = 0; i < stmt->column_count; i++) { if (cols[i].name) { - zend_string_release(cols[i].name); + zend_string_release_ex(cols[i].name, 0); } } efree(stmt->columns); @@ -2246,7 +2246,7 @@ static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_str } out: - zend_string_release(lc_method_name); + zend_string_release_ex(lc_method_name, 0); if (!fbc) { fbc = std_object_handlers.get_method(object_pp, method_name, key); } @@ -2340,7 +2340,7 @@ PDO_API void php_pdo_free_statement(pdo_stmt_t *stmt) for (i = 0; i < stmt->column_count; i++) { if (cols[i].name) { - zend_string_release(cols[i].name); + zend_string_release_ex(cols[i].name, 0); cols[i].name = NULL; } } @@ -2637,11 +2637,11 @@ static union _zend_function *row_method_get( lc_method_name = zend_string_tolower(method_name); if ((fbc = zend_hash_find_ptr(&pdo_row_ce->function_table, lc_method_name)) == NULL) { - zend_string_release(lc_method_name); + zend_string_release_ex(lc_method_name, 0); return NULL; } - zend_string_release(lc_method_name); + zend_string_release_ex(lc_method_name, 0); return fbc; } diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index 9b12527968..6138c5aee7 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -470,7 +470,7 @@ static int firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *v efree(H->date_format); } spprintf(&H->date_format, 0, "%s", ZSTR_VAL(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } return 1; @@ -481,7 +481,7 @@ static int firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *v efree(H->time_format); } spprintf(&H->time_format, 0, "%s", ZSTR_VAL(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } return 1; @@ -492,7 +492,7 @@ static int firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *v efree(H->timestamp_format); } spprintf(&H->timestamp_format, 0, "%s", ZSTR_VAL(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } return 1; } diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index d9c05302ad..3cfd32f6ad 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -662,31 +662,31 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) init_cmd = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_INIT_COMMAND, NULL); if (init_cmd) { if (mysql_options(H->server, MYSQL_INIT_COMMAND, (const char *)ZSTR_VAL(init_cmd))) { - zend_string_release(init_cmd); + zend_string_release_ex(init_cmd, 0); pdo_mysql_error(dbh); goto cleanup; } - zend_string_release(init_cmd); + zend_string_release_ex(init_cmd, 0); } #ifndef PDO_USE_MYSQLND default_file = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_READ_DEFAULT_FILE, NULL); if (default_file) { if (mysql_options(H->server, MYSQL_READ_DEFAULT_FILE, (const char *)ZSTR_VAL(default_file))) { - zend_string_release(default_file); + zend_string_release_ex(default_file, 0); pdo_mysql_error(dbh); goto cleanup; } - zend_string_release(default_file); + zend_string_release_ex(default_file, 0); } default_group = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_READ_DEFAULT_GROUP, NULL); if (default_group) { if (mysql_options(H->server, MYSQL_READ_DEFAULT_GROUP, (const char *)ZSTR_VAL(default_group))) { - zend_string_release(default_group); + zend_string_release_ex(default_group, 0); pdo_mysql_error(dbh); goto cleanup; } - zend_string_release(default_group); + zend_string_release_ex(default_group, 0); } #endif compress = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0); @@ -711,19 +711,19 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) ssl_capath? ZSTR_VAL(ssl_capath) : NULL, ssl_cipher? ZSTR_VAL(ssl_cipher) : NULL); if (ssl_key) { - zend_string_release(ssl_key); + zend_string_release_ex(ssl_key, 0); } if (ssl_cert) { - zend_string_release(ssl_cert); + zend_string_release_ex(ssl_cert, 0); } if (ssl_ca) { - zend_string_release(ssl_ca); + zend_string_release_ex(ssl_ca, 0); } if (ssl_capath) { - zend_string_release(ssl_capath); + zend_string_release_ex(ssl_capath, 0); } if (ssl_cipher) { - zend_string_release(ssl_cipher); + zend_string_release_ex(ssl_cipher, 0); } } @@ -733,10 +733,10 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) if (public_key) { if (mysql_options(H->server, MYSQL_SERVER_PUBLIC_KEY, ZSTR_VAL(public_key))) { pdo_mysql_error(dbh); - zend_string_release(public_key); + zend_string_release_ex(public_key, 0); goto cleanup; } - zend_string_release(public_key); + zend_string_release_ex(public_key, 0); } } #endif diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 7d7b5e034d..4c067b3092 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -1229,10 +1229,10 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ H->server = PQconnectdb(conn_str); if (tmp_user) { - zend_string_release(tmp_user); + zend_string_release_ex(tmp_user, 0); } if (tmp_pass) { - zend_string_release(tmp_pass); + zend_string_release_ex(tmp_pass, 0); } efree(conn_str); diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 6ab6f9eb77..ab696d8211 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -537,7 +537,7 @@ static PHP_METHOD(SQLite, sqliteCreateFunction) if (!zend_is_callable(callback, 0, NULL)) { zend_string *cbname = zend_get_callable_name(callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); - zend_string_release(cbname); + zend_string_release_ex(cbname, 0); RETURN_FALSE; } @@ -609,14 +609,14 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate) if (!zend_is_callable(step_callback, 0, NULL)) { zend_string *cbname = zend_get_callable_name(step_callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); - zend_string_release(cbname); + zend_string_release_ex(cbname, 0); RETURN_FALSE; } if (!zend_is_callable(fini_callback, 0, NULL)) { zend_string *cbname = zend_get_callable_name(fini_callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); - zend_string_release(cbname); + zend_string_release_ex(cbname, 0); RETURN_FALSE; } @@ -669,7 +669,7 @@ static PHP_METHOD(SQLite, sqliteCreateCollation) if (!zend_is_callable(callback, 0, NULL)) { zend_string *cbname = zend_get_callable_name(callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); - zend_string_release(cbname); + zend_string_release_ex(cbname, 0); RETURN_FALSE; } diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c index e82a75721d..01004a7611 100644 --- a/ext/phar/func_interceptors.c +++ b/ext/phar/func_interceptors.c @@ -190,7 +190,7 @@ phar_it: } stream = php_stream_open_wrapper_ex(name, "rb", 0 | REPORT_ERRORS, NULL, context); if (entry_str) { - zend_string_release(entry_str); + zend_string_release_ex(entry_str, 0); } else { efree(name); } @@ -210,7 +210,7 @@ phar_it: if (contents && ZSTR_LEN(contents) > 0) { RETVAL_STR(contents); } else if (contents) { - zend_string_release(contents); + zend_string_release_ex(contents, 0); RETVAL_EMPTY_STRING(); } else { RETVAL_FALSE; @@ -308,7 +308,7 @@ notfound: context = php_stream_context_from_zval(zcontext, 0); stream = php_stream_open_wrapper_ex(name, "rb", 0 | REPORT_ERRORS, NULL, context); if (entry_str) { - zend_string_release(entry_str); + zend_string_release_ex(entry_str, 0); } else { efree(name); } @@ -410,7 +410,7 @@ notfound: context = php_stream_context_from_zval(zcontext, 0); stream = php_stream_open_wrapper_ex(name, mode, 0 | REPORT_ERRORS, NULL, context); if (entry_str) { - zend_string_release(entry_str); + zend_string_release_ex(entry_str, 0); } else { efree(name); } diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 2a3fcb2161..21f08c7b04 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1365,20 +1365,20 @@ int phar_create_or_parse_filename(char *fname, size_t fname_len, char *alias, si (*pphar)->is_writeable = 1; } if (actual) { - zend_string_release(actual); + zend_string_release_ex(actual, 0); } return SUCCESS; } else { /* file exists, but is either corrupt or not a phar archive */ if (actual) { - zend_string_release(actual); + zend_string_release_ex(actual, 0); } return FAILURE; } } if (actual) { - zend_string_release(actual); + zend_string_release_ex(actual, 0); } if (PHAR_G(readonly) && !is_data) { @@ -1519,7 +1519,7 @@ int phar_open_from_filename(char *fname, size_t fname_len, char *alias, size_t a } } if (actual) { - zend_string_release(actual); + zend_string_release_ex(actual, 0); } return FAILURE; } @@ -1532,7 +1532,7 @@ int phar_open_from_filename(char *fname, size_t fname_len, char *alias, size_t a ret = phar_open_from_fp(fp, fname, fname_len, alias, alias_len, options, pphar, is_data, error); if (actual) { - zend_string_release(actual); + zend_string_release_ex(actual, 0); } return ret; @@ -2314,7 +2314,7 @@ int phar_open_executed_filename(char *alias, size_t alias_len, char **error) /* spprintf(error, 0, "unable to open phar for reading \"%s\"", fname); } if (actual) { - zend_string_release(actual); + zend_string_release_ex(actual, 0); } return FAILURE; } @@ -2327,7 +2327,7 @@ int phar_open_executed_filename(char *alias, size_t alias_len, char **error) /* ret = phar_open_from_fp(fp, fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, 0, error); if (actual) { - zend_string_release(actual); + zend_string_release_ex(actual, 0); } return ret; diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 41fb6b4e01..32a7a31e7f 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1632,7 +1632,7 @@ after_open_fp: } if (opened) { - zend_string_release(opened); + zend_string_release_ex(opened, 0); } if (close_fp) { @@ -1651,7 +1651,7 @@ after_open_fp: } if (opened) { - zend_string_release(opened); + zend_string_release_ex(opened, 0); } if (temp) { @@ -3963,7 +3963,7 @@ carry_on: } zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Unable to read stub"); - zend_string_release(buf); + zend_string_release_ex(buf, 0); return; } diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 4e17e3a543..b1ccd53cc3 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -907,7 +907,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from entry->filename = estrndup(ZSTR_VAL(new_str_key), ZSTR_LEN(new_str_key)); entry->filename_len = ZSTR_LEN(new_str_key); - zend_string_release(str_key); + zend_string_release_ex(str_key, 0); b->h = zend_string_hash_val(new_str_key); b->key = new_str_key; } @@ -925,7 +925,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from memcpy(ZSTR_VAL(new_str_key) + to_len, ZSTR_VAL(str_key) + from_len, ZSTR_LEN(str_key) - from_len); ZSTR_VAL(new_str_key)[ZSTR_LEN(new_str_key)] = 0; - zend_string_release(str_key); + zend_string_release_ex(str_key, 0); b->h = zend_string_hash_val(new_str_key); b->key = new_str_key; } @@ -943,7 +943,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from memcpy(ZSTR_VAL(new_str_key) + to_len, ZSTR_VAL(str_key) + from_len, ZSTR_LEN(str_key) - from_len); ZSTR_VAL(new_str_key)[ZSTR_LEN(new_str_key)] = 0; - zend_string_release(str_key); + zend_string_release_ex(str_key, 0); b->h = zend_string_hash_val(new_str_key); b->key = new_str_key; } diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 6385483914..d673cc0f68 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -1036,7 +1036,7 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int if (str) { len = ZSTR_LEN(str); user_stub = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } else { user_stub = NULL; len = 0; diff --git a/ext/phar/util.c b/ext/phar/util.c index 349fc6be57..7652846eca 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -1523,7 +1523,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t sig_type, if (FAILURE == phar_call_openssl_signverify(0, fp, end_of_phar, pubkey ? ZSTR_VAL(pubkey) : NULL, pubkey ? ZSTR_LEN(pubkey) : 0, &sig, &tempsig)) { if (pubkey) { - zend_string_release(pubkey); + zend_string_release_ex(pubkey, 0); } if (error) { @@ -1534,7 +1534,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t sig_type, } if (pubkey) { - zend_string_release(pubkey); + zend_string_release_ex(pubkey, 0); } sig_len = tempsig; @@ -1542,7 +1542,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t sig_type, in = BIO_new_mem_buf(pubkey ? ZSTR_VAL(pubkey) : NULL, pubkey ? ZSTR_LEN(pubkey) : 0); if (NULL == in) { - zend_string_release(pubkey); + zend_string_release_ex(pubkey, 0); if (error) { spprintf(error, 0, "openssl signature could not be processed"); } @@ -1551,7 +1551,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t sig_type, key = PEM_read_bio_PUBKEY(in, NULL,NULL, NULL); BIO_free(in); - zend_string_release(pubkey); + zend_string_release_ex(pubkey, 0); if (NULL == key) { if (error) { diff --git a/ext/phar/zip.c b/ext/phar/zip.c index ae99154241..40171203d5 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -589,7 +589,7 @@ foundit: if (str) { entry.uncompressed_filesize = ZSTR_LEN(str); actual_alias = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } else { actual_alias = NULL; entry.uncompressed_filesize = 0; @@ -621,7 +621,7 @@ foundit: if (str) { entry.uncompressed_filesize = ZSTR_LEN(str); actual_alias = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } else { actual_alias = NULL; entry.uncompressed_filesize = 0; @@ -643,7 +643,7 @@ foundit: if (str) { entry.uncompressed_filesize = ZSTR_LEN(str); actual_alias = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } else { actual_alias = NULL; entry.uncompressed_filesize = 0; @@ -1276,7 +1276,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int if (str) { len = ZSTR_LEN(str); user_stub = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } else { user_stub = NULL; len = 0; diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 7026b020f6..1067ef3f28 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -550,7 +550,7 @@ PHP_FUNCTION(readline_completion_function) if (!zend_is_callable(arg, 0, NULL)) { zend_string *name = zend_get_callable_name(arg); php_error_docref(NULL, E_WARNING, "%s is not callable", ZSTR_VAL(name)); - zend_string_release(name); + zend_string_release_ex(name, 0); RETURN_FALSE; } @@ -598,7 +598,7 @@ PHP_FUNCTION(readline_callback_handler_install) if (!zend_is_callable(callback, 0, NULL)) { zend_string *name = zend_get_callable_name(callback); php_error_docref(NULL, E_WARNING, "%s is not callable", ZSTR_VAL(name)); - zend_string_release(name); + zend_string_release_ex(name, 0); RETURN_FALSE; } diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c index 66cb34c900..eb5c78ee28 100644 --- a/ext/readline/readline_cli.c +++ b/ext/readline/readline_cli.c @@ -529,7 +529,7 @@ TODO: class_name = zend_string_alloc(class_name_len, 0); zend_str_tolower_copy(ZSTR_VAL(class_name), text, class_name_len); if ((ce = zend_lookup_class(class_name)) == NULL) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return NULL; } lc_text = zend_str_tolower_dup(class_name_end + 2, textlen - 2 - class_name_len); @@ -560,7 +560,7 @@ TODO: } efree(lc_text); if (class_name_end) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); } if (ce && retval) { int len = class_name_len + 2 + strlen(retval) + 1; @@ -637,10 +637,10 @@ static int readline_shell_run(void) /* {{{ */ cmd = zend_string_init(&line[1], param - &line[1] - 1, 0); zend_alter_ini_entry_chars_ex(cmd, param, strlen(param), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release(cmd); + zend_string_release_ex(cmd, 0); add_history(line); - zend_string_release(prompt); + zend_string_release_ex(prompt, 0); /* TODO: This might be wrong! */ prompt = cli_get_prompt("php", '>'); continue; @@ -662,7 +662,7 @@ static int readline_shell_run(void) /* {{{ */ } free(line); - zend_string_release(prompt); + zend_string_release_ex(prompt, 0); if (!cli_is_valid_code(code, pos, &prompt)) { continue; @@ -704,7 +704,7 @@ static int readline_shell_run(void) /* {{{ */ free(history_file); #endif efree(code); - zend_string_release(prompt); + zend_string_release_ex(prompt, 0); return EG(exit_status); } /* }}} */ diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 87ffeba666..0364c06441 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -211,7 +211,7 @@ static void _free_function(zend_function *fptr) /* {{{ */ if (fptr && (fptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) { - zend_string_release(fptr->internal_function.function_name); + zend_string_release_ex(fptr->internal_function.function_name, 0); zend_free_trampoline(fptr); } } @@ -244,7 +244,7 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */ break; case REF_TYPE_DYNAMIC_PROPERTY: prop_reference = (property_reference*)intern->ptr; - zend_string_release(prop_reference->prop.name); + zend_string_release_ex(prop_reference->prop.name, 0); efree(intern->ptr); break; case REF_TYPE_GENERATOR: @@ -528,7 +528,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char smart_str_append_printf(str, "%s }\n", indent); smart_str_append_printf(str, "%s}\n", indent); - zend_string_release(sub_indent); + zend_string_release_ex(sub_indent, 0); } /* }}} */ @@ -760,7 +760,7 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent smart_str_append_printf(str, ", overwrites %s", ZSTR_VAL(overwrites->common.scope->name)); } } - zend_string_release(lc_name); + zend_string_release_ex(lc_name, 0); } } if (fptr->common.prototype && fptr->common.prototype->common.scope) { @@ -1060,7 +1060,7 @@ static void _extension_string(smart_str *str, zend_module_entry *module, char *i smart_str_append_printf(str, "%s }\n", indent); } smart_str_free(&str_classes); - zend_string_release(sub_indent); + zend_string_release_ex(sub_indent, 0); } smart_str_append_printf(str, "%s}\n", indent); @@ -2391,7 +2391,7 @@ ZEND_METHOD(reflection_parameter, __construct) if (position < 0 || (uint32_t)position >= num_args) { if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { if (fptr->type != ZEND_OVERLOADED_FUNCTION) { - zend_string_release(fptr->common.function_name); + zend_string_release_ex(fptr->common.function_name, 0); } zend_free_trampoline(fptr); } @@ -2430,7 +2430,7 @@ ZEND_METHOD(reflection_parameter, __construct) if (position == -1) { if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { if (fptr->type != ZEND_OVERLOADED_FUNCTION) { - zend_string_release(fptr->common.function_name); + zend_string_release_ex(fptr->common.function_name, 0); } zend_free_trampoline(fptr); } @@ -4337,10 +4337,10 @@ ZEND_METHOD(reflection_class, getProperty) if (!EG(exception)) { zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", ZSTR_VAL(classname)); } - zend_string_release(classname); + zend_string_release_ex(classname, 0); return; } - zend_string_release(classname); + zend_string_release_ex(classname, 0); if (!instanceof_function(ce, ce2)) { zend_throw_exception_ex(reflection_exception_ptr, -1, "Fully qualified property name %s::%s does not specify a base class of %s", ZSTR_VAL(ce2->name), str_name, ZSTR_VAL(ce->name)); diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 1c87018043..cec67df148 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -528,7 +528,7 @@ PS_READ_FUNC(files) } else { php_error_docref(NULL, E_WARNING, "read returned less bytes than requested"); } - zend_string_release(*val); + zend_string_release_ex(*val, 0); *val = ZSTR_EMPTY_ALLOC(); return FAILURE; } @@ -692,7 +692,7 @@ PS_CREATE_SID_FUNC(files) /* FIXME: mod_data(data) should not be NULL (User handler could be NULL) */ if (data && ps_files_key_exists(data, ZSTR_VAL(sid)) == SUCCESS) { if (sid) { - zend_string_release(sid); + zend_string_release_ex(sid, 0); sid = NULL; } if (--maxfail < 0) { diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c index 2c2fd224cf..e1e3c54d20 100644 --- a/ext/session/mod_mm.c +++ b/ext/session/mod_mm.c @@ -482,7 +482,7 @@ PS_CREATE_SID_FUNC(mm) /* Check collision */ if (ps_mm_key_exists(data, sid->val) == SUCCESS) { if (sid) { - zend_string_release(sid); + zend_string_release_ex(sid, 0); sid = NULL; } if (!(maxfail--)) { diff --git a/ext/session/session.c b/ext/session/session.c index 4e5985e7ad..3482768781 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -140,12 +140,12 @@ static inline void php_rshutdown_session_globals(void) /* {{{ */ } zend_end_try(); } if (PS(id)) { - zend_string_release(PS(id)); + zend_string_release_ex(PS(id), 0); PS(id) = NULL; } if (PS(session_vars)) { - zend_string_release(PS(session_vars)); + zend_string_release_ex(PS(session_vars), 0); PS(session_vars) = NULL; } @@ -225,7 +225,7 @@ static void php_session_track_init(void) /* {{{ */ ZVAL_NEW_REF(&PS(http_session_vars), &session_vars); Z_ADDREF_P(&PS(http_session_vars)); zend_hash_update_ind(&EG(symbol_table), var_name, &PS(http_session_vars)); - zend_string_release(var_name); + zend_string_release_ex(var_name, 0); } /* }}} */ @@ -406,7 +406,7 @@ static int php_session_initialize(void) /* {{{ */ /* If there is no ID, use session module to create one */ if (!PS(id) || !ZSTR_VAL(PS(id))[0]) { if (PS(id)) { - zend_string_release(PS(id)); + zend_string_release_ex(PS(id), 0); } PS(id) = PS(mod)->s_create_sid(&PS(mod_data)); if (!PS(id)) { @@ -420,7 +420,7 @@ static int php_session_initialize(void) /* {{{ */ } else if (PS(use_strict_mode) && PS(mod)->s_validate_sid && PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE) { if (PS(id)) { - zend_string_release(PS(id)); + zend_string_release_ex(PS(id), 0); } PS(id) = PS(mod)->s_create_sid(&PS(mod_data)); if (!PS(id)) { @@ -449,7 +449,7 @@ static int php_session_initialize(void) /* {{{ */ php_session_gc(0); if (PS(session_vars)) { - zend_string_release(PS(session_vars)); + zend_string_release_ex(PS(session_vars), 0); PS(session_vars) = NULL; } if (val) { @@ -457,7 +457,7 @@ static int php_session_initialize(void) /* {{{ */ PS(session_vars) = zend_string_copy(val); } php_session_decode(val); - zend_string_release(val); + zend_string_release_ex(val, 0); } return SUCCESS; } @@ -484,7 +484,7 @@ static void php_session_save_current_state(int write) /* {{{ */ } else { ret = PS(mod)->s_write(&PS(mod_data), PS(id), val, PS(gc_maxlifetime)); } - zend_string_release(val); + zend_string_release_ex(val, 0); } else { ret = PS(mod)->s_write(&PS(mod_data), PS(id), ZSTR_EMPTY_ALLOC(), PS(gc_maxlifetime)); } @@ -877,7 +877,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */ ZVAL_NEW_REF(&PS(http_session_vars), &session_vars); Z_ADDREF_P(&PS(http_session_vars)); zend_hash_update_ind(&EG(symbol_table), var_name, &PS(http_session_vars)); - zend_string_release(var_name); + zend_string_release_ex(var_name, 0); return SUCCESS; } /* }}} */ @@ -935,12 +935,12 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */ ZVAL_PTR(&rv, current); php_set_session_var(name, &rv, &var_hash); } else { - zend_string_release(name); + zend_string_release_ex(name, 0); php_session_normalize_vars(); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); return FAILURE; } - zend_string_release(name); + zend_string_release_ex(name, 0); } php_session_normalize_vars(); @@ -1007,11 +1007,11 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */ ZVAL_PTR(&rv, current); php_set_session_var(name, &rv, &var_hash); } else { - zend_string_release(name); + zend_string_release_ex(name, 0); retval = FAILURE; goto break_outer_loop; } - zend_string_release(name); + zend_string_release_ex(name, 0); p = q; } @@ -1323,8 +1323,8 @@ static int php_session_send_cookie(void) /* {{{ */ smart_str_appendc(&ncookie, '='); smart_str_appendl(&ncookie, ZSTR_VAL(e_id), ZSTR_LEN(e_id)); - zend_string_release(e_session_name); - zend_string_release(e_id); + zend_string_release_ex(e_session_name, 0); + zend_string_release_ex(e_id, 0); if (PS(cookie_lifetime) > 0) { struct timeval tv; @@ -1337,7 +1337,7 @@ static int php_session_send_cookie(void) /* {{{ */ date_fmt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, t, 0); smart_str_appends(&ncookie, COOKIE_EXPIRES); smart_str_appendl(&ncookie, ZSTR_VAL(date_fmt), ZSTR_LEN(date_fmt)); - zend_string_release(date_fmt); + zend_string_release_ex(date_fmt, 0); smart_str_appends(&ncookie, COOKIE_MAX_AGE); smart_str_append_long(&ncookie, PS(cookie_lifetime)); @@ -1446,7 +1446,7 @@ PHPAPI int php_session_reset_id(void) /* {{{ */ smart_str_appends(&var, ZSTR_VAL(PS(id))); smart_str_0(&var); if (sid) { - zend_string_release(Z_STR_P(sid)); + zend_string_release_ex(Z_STR_P(sid), 0); ZVAL_NEW_STR(sid, var.s); } else { REGISTER_STRINGL_CONSTANT("SID", ZSTR_VAL(var.s), ZSTR_LEN(var.s), 0); @@ -1454,7 +1454,7 @@ PHPAPI int php_session_reset_id(void) /* {{{ */ } } else { if (sid) { - zend_string_release(Z_STR_P(sid)); + zend_string_release_ex(Z_STR_P(sid), 0); ZVAL_EMPTY_STRING(sid); } else { REGISTER_STRINGL_CONSTANT("SID", "", 0, 0); @@ -1479,7 +1479,7 @@ PHPAPI int php_session_reset_id(void) /* {{{ */ zend_string *sname; sname = zend_string_init(PS(session_name), strlen(PS(session_name)), 0); php_url_scanner_reset_session_var(sname, 1); /* This may fail when session name has changed */ - zend_string_release(sname); + zend_string_release_ex(sname, 0); php_url_scanner_add_session_var(PS(session_name), strlen(PS(session_name)), ZSTR_VAL(PS(id)), ZSTR_LEN(PS(id)), 1); } return SUCCESS; @@ -1584,7 +1584,7 @@ PHPAPI int php_session_start(void) /* {{{ */ Z_STRLEN_P(data) != 0 && strstr(Z_STRVAL_P(data), PS(extern_referer_chk)) == NULL ) { - zend_string_release(PS(id)); + zend_string_release_ex(PS(id), 0); PS(id) = NULL; } } @@ -1593,7 +1593,7 @@ PHPAPI int php_session_start(void) /* {{{ */ /* Finally check session id for dangerous characters * Security note: session id may be embedded in HTML pages.*/ if (PS(id) && strpbrk(ZSTR_VAL(PS(id)), "\r\n\t <>'\"\\")) { - zend_string_release(PS(id)); + zend_string_release_ex(PS(id), 0); PS(id) = NULL; } @@ -1601,7 +1601,7 @@ PHPAPI int php_session_start(void) /* {{{ */ || php_session_cache_limiter() == -2) { PS(session_status) = php_session_none; if (PS(id)) { - zend_string_release(PS(id)); + zend_string_release_ex(PS(id), 0); PS(id) = NULL; } return FAILURE; @@ -1690,43 +1690,43 @@ static PHP_FUNCTION(session_set_cookie_params) ini_name = zend_string_init("session.cookie_lifetime", sizeof("session.cookie_lifetime") - 1, 0); if (zend_alter_ini_entry(ini_name, Z_STR_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == FAILURE) { - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); RETURN_FALSE; } - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); if (path) { ini_name = zend_string_init("session.cookie_path", sizeof("session.cookie_path") - 1, 0); if (zend_alter_ini_entry(ini_name, path, PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == FAILURE) { - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); RETURN_FALSE; } - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } if (domain) { ini_name = zend_string_init("session.cookie_domain", sizeof("session.cookie_domain") - 1, 0); if (zend_alter_ini_entry(ini_name, domain, PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == FAILURE) { - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); RETURN_FALSE; } - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } if (argc > 3) { ini_name = zend_string_init("session.cookie_secure", sizeof("session.cookie_secure") - 1, 0); if (zend_alter_ini_entry_chars(ini_name, secure ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == FAILURE) { - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); RETURN_FALSE; } - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } if (argc > 4) { ini_name = zend_string_init("session.cookie_httponly", sizeof("session.cookie_httponly") - 1, 0); if (zend_alter_ini_entry_chars(ini_name, httponly ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == FAILURE) { - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); RETURN_FALSE; } - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } RETURN_TRUE; @@ -1777,7 +1777,7 @@ static PHP_FUNCTION(session_name) if (name) { ini_name = zend_string_init("session.name", sizeof("session.name") - 1, 0); zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } } /* }}} */ @@ -1824,7 +1824,7 @@ static PHP_FUNCTION(session_module_name) ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0); zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } } /* }}} */ @@ -1943,8 +1943,8 @@ static PHP_FUNCTION(session_set_save_handler) PS(set_handler) = 1; zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); PS(set_handler) = 0; - zend_string_release(ini_val); - zend_string_release(ini_name); + zend_string_release_ex(ini_val, 0); + zend_string_release_ex(ini_name, 0); } RETURN_TRUE; @@ -1967,7 +1967,7 @@ static PHP_FUNCTION(session_set_save_handler) if (!zend_is_callable(&args[i], 0, NULL)) { zend_string *name = zend_get_callable_name(&args[i]); php_error_docref(NULL, E_WARNING, "Argument %d is not a valid callback", i+1); - zend_string_release(name); + zend_string_release_ex(name, 0); RETURN_FALSE; } } @@ -1978,8 +1978,8 @@ static PHP_FUNCTION(session_set_save_handler) PS(set_handler) = 1; zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); PS(set_handler) = 0; - zend_string_release(ini_val); - zend_string_release(ini_name); + zend_string_release_ex(ini_val, 0); + zend_string_release_ex(ini_name, 0); } for (i = 0; i < argc; i++) { @@ -2024,7 +2024,7 @@ static PHP_FUNCTION(session_save_path) } ini_name = zend_string_init("session.save_path", sizeof("session.save_path") - 1, 0); zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } } /* }}} */ @@ -2065,7 +2065,7 @@ static PHP_FUNCTION(session_id) if (name) { if (PS(id)) { - zend_string_release(PS(id)); + zend_string_release_ex(PS(id), 0); } PS(id) = zend_string_copy(name); } @@ -2106,7 +2106,7 @@ static PHP_FUNCTION(session_regenerate_id) data = php_session_encode(); if (data) { ret = PS(mod)->s_write(&PS(mod_data), PS(id), data, PS(gc_maxlifetime)); - zend_string_release(data); + zend_string_release_ex(data, 0); } else { ret = PS(mod)->s_write(&PS(mod_data), PS(id), ZSTR_EMPTY_ALLOC(), PS(gc_maxlifetime)); } @@ -2121,10 +2121,10 @@ static PHP_FUNCTION(session_regenerate_id) /* New session data */ if (PS(session_vars)) { - zend_string_release(PS(session_vars)); + zend_string_release_ex(PS(session_vars), 0); PS(session_vars) = NULL; } - zend_string_release(PS(id)); + zend_string_release_ex(PS(id), 0); PS(id) = NULL; if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) { @@ -2141,7 +2141,7 @@ static PHP_FUNCTION(session_regenerate_id) } if (PS(use_strict_mode) && PS(mod)->s_validate_sid && PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE) { - zend_string_release(PS(id)); + zend_string_release_ex(PS(id), 0); PS(id) = PS(mod)->s_create_sid(&PS(mod_data)); if (!PS(id)) { PS(mod)->s_close(&PS(mod_data)); @@ -2158,7 +2158,7 @@ static PHP_FUNCTION(session_regenerate_id) RETURN_FALSE; } if (data) { - zend_string_release(data); + zend_string_release_ex(data, 0); } if (PS(use_cookies)) { @@ -2203,7 +2203,7 @@ static PHP_FUNCTION(session_create_id) } else { /* Detect collision and retry */ if (PS(mod)->s_validate_sid(&PS(mod_data), new_id) == FAILURE) { - zend_string_release(new_id); + zend_string_release_ex(new_id, 0); continue; } break; @@ -2215,7 +2215,7 @@ static PHP_FUNCTION(session_create_id) if (new_id) { smart_str_append(&id, new_id); - zend_string_release(new_id); + zend_string_release_ex(new_id, 0); } else { smart_str_free(&id); php_error_docref(NULL, E_WARNING, "Failed to create new ID"); @@ -2252,7 +2252,7 @@ static PHP_FUNCTION(session_cache_limiter) if (limiter) { ini_name = zend_string_init("session.cache_limiter", sizeof("session.cache_limiter") - 1, 0); zend_alter_ini_entry(ini_name, limiter, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } } /* }}} */ @@ -2284,7 +2284,7 @@ static PHP_FUNCTION(session_cache_expire) convert_to_string_ex(expires); ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0); zend_alter_ini_entry(ini_name, Z_STR_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - zend_string_release(ini_name); + zend_string_release_ex(ini_name, 0); } } /* }}} */ diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index d7a482a055..605c9e883e 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -465,7 +465,7 @@ long_dim: if (Z_TYPE_P(member) != IS_STRING) { trim_str = zval_get_string_func(member); ZVAL_STR(&tmp_zv, php_trim(trim_str, NULL, 0, 3)); - zend_string_release(trim_str); + zend_string_release_ex(trim_str, 0); member = &tmp_zv; } @@ -1013,7 +1013,7 @@ static void sxe_properties_add(HashTable *rv, char *name, int namelen, zval *val } else { zend_hash_add_new(rv, key, value); } - zend_string_release(key); + zend_string_release_ex(key, 0); } /* }}} */ @@ -1506,7 +1506,7 @@ static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns) /* {{ ZVAL_STRING(&zv, (char*)ns->href); zend_hash_add_new(Z_ARRVAL_P(return_value), key, &zv); } - zend_string_release(key); + zend_string_release_ex(key, 0); } /* }}} */ diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 59c820a8be..0bdbcdf80b 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1907,7 +1907,7 @@ void php_snmp_add_property(HashTable *h, const char *name, size_t name_length, p p.write_func = (write_func) ? write_func : NULL; str = zend_string_init_interned(name, name_length, 1); zend_hash_add_mem(h, str, &p, sizeof(php_snmp_prop_handler)); - zend_string_release(str); + zend_string_release_ex(str, 1); } /* }}} */ diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 8ab613ac11..c2aaf36797 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -848,7 +848,7 @@ static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNo zend_string *tmp = zval_get_string_func(data); str = estrndup(ZSTR_VAL(tmp), ZSTR_LEN(tmp)); new_len = ZSTR_LEN(tmp); - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); } if (SOAP_GLOBAL(encoding) != NULL) { @@ -930,12 +930,12 @@ static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNo } else { zend_string *tmp = zval_get_string_func(data); str = php_base64_encode((unsigned char*) ZSTR_VAL(tmp), ZSTR_LEN(tmp)); - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); } text = xmlNewTextLen(BAD_CAST(ZSTR_VAL(str)), ZSTR_LEN(str)); xmlAddChild(ret, text); - zend_string_release(str); + zend_string_release_ex(str, 0); if (style == SOAP_ENCODED) { set_ns_and_type(ret, type); @@ -1066,7 +1066,7 @@ static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style, xmlNode } else { zend_string *str = zend_long_to_str(zval_get_long(data)); xmlNodeSetContentLen(ret, BAD_CAST(ZSTR_VAL(str)), ZSTR_LEN(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } if (style == SOAP_ENCODED) { @@ -3142,7 +3142,7 @@ static xmlNodePtr to_xml_any(encodeTypePtr type, zval *data, int style, xmlNodeP } else { zend_string *tmp = zval_get_string_func(data); ret = xmlNewTextLen(BAD_CAST(ZSTR_VAL(tmp)), ZSTR_LEN(tmp)); - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); } ret->name = xmlStringTextNoenc; diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 3be02235a6..e2095621d0 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -52,7 +52,7 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers) smart_str_append_const(soap_headers, "Proxy-Authorization: Basic "); smart_str_appendl(soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf)); smart_str_append_const(soap_headers, "\r\n"); - zend_string_release(buf); + zend_string_release_ex(buf, 0); smart_str_free(&auth); return 1; } @@ -81,7 +81,7 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers) smart_str_append_const(soap_headers, "Authorization: Basic "); smart_str_appendl(soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf)); smart_str_append_const(soap_headers, "\r\n"); - zend_string_release(buf); + zend_string_release_ex(buf, 0); smart_str_free(&auth); return 1; } @@ -408,7 +408,7 @@ int make_http_soap_request(zval *this_ptr, zval_ptr_dtor(¶ms[0]); zval_ptr_dtor(&func); if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } smart_str_free(&soap_headers_z); return FALSE; @@ -446,7 +446,7 @@ try_again: if (phpurl == NULL || phpurl->host == NULL) { if (phpurl != NULL) {php_url_free(phpurl);} if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } add_soap_fault(this_ptr, "HTTP", "Unable to parse URL", NULL, NULL); smart_str_free(&soap_headers_z); @@ -459,7 +459,7 @@ try_again: } else if (phpurl->scheme == NULL || !zend_string_equals_literal(phpurl->scheme, "http")) { php_url_free(phpurl); if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } add_soap_fault(this_ptr, "HTTP", "Unknown protocol. Only http and https are allowed.", NULL, NULL); smart_str_free(&soap_headers_z); @@ -471,7 +471,7 @@ try_again: if (use_ssl && php_stream_locate_url_wrapper("https://", NULL, STREAM_LOCATE_WRAPPERS_ONLY) == NULL) { php_url_free(phpurl); if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } add_soap_fault(this_ptr, "HTTP", "SSL support is not available in this build", NULL, NULL); PG(allow_url_fopen) = old_allow_url_fopen; @@ -524,7 +524,7 @@ try_again: } else { php_url_free(phpurl); if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } add_soap_fault(this_ptr, "HTTP", "Could not connect to host", NULL, NULL); PG(allow_url_fopen) = old_allow_url_fopen; @@ -800,7 +800,7 @@ try_again: smart_str_append_const(&soap_headers, "Authorization: Basic "); smart_str_appendl(&soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf)); smart_str_append_const(&soap_headers, "\r\n"); - zend_string_release(buf); + zend_string_release_ex(buf, 0); smart_str_free(&auth); } } @@ -867,7 +867,7 @@ try_again: err = php_stream_write(stream, ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s)); if (err != ZSTR_LEN(soap_headers.s)) { if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } php_stream_close(stream); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1); @@ -896,7 +896,7 @@ try_again: http_headers = get_http_headers(stream); if (!http_headers) { if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } php_stream_close(stream); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1); @@ -939,7 +939,7 @@ try_again: /* Try and get headers again */ if (http_status == 100) { - zend_string_release(http_headers); + zend_string_release_ex(http_headers, 0); } } } while (http_status == 100); @@ -1072,10 +1072,10 @@ try_again: http_body = get_http_body(stream, http_close, ZSTR_VAL(http_headers)); if (!http_body) { if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } php_stream_close(stream); - zend_string_release(http_headers); + zend_string_release_ex(http_headers, 0); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1); add_soap_fault(this_ptr, "HTTP", "Error Fetching http body, No Content-Length, connection closed or chunked data", NULL, NULL); @@ -1087,7 +1087,7 @@ try_again: } if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } if (http_close) { @@ -1105,8 +1105,8 @@ try_again: php_url *new_url = php_url_parse(loc); if (new_url != NULL) { - zend_string_release(http_headers); - zend_string_release(http_body); + zend_string_release_ex(http_headers, 0); + zend_string_release_ex(http_body, 0); efree(loc); if (new_url->scheme == NULL && new_url->path != NULL) { new_url->scheme = phpurl->scheme ? zend_string_copy(phpurl->scheme) : NULL; @@ -1121,7 +1121,7 @@ try_again: strncpy(ZSTR_VAL(s), t, (p - t) + 1); ZSTR_VAL(s)[(p - t) + 1] = 0; strcat(ZSTR_VAL(s), ZSTR_VAL(new_url->path)); - zend_string_release(new_url->path); + zend_string_release_ex(new_url->path, 0); new_url->path = s; } } else { @@ -1129,7 +1129,7 @@ try_again: ZSTR_VAL(s)[0] = '/'; ZSTR_VAL(s)[1] = 0; strcat(ZSTR_VAL(s), ZSTR_VAL(new_url->path)); - zend_string_release(new_url->path); + zend_string_release_ex(new_url->path, 0); new_url->path = s; } } @@ -1214,8 +1214,8 @@ try_again: phpurl = new_url; efree(auth); - zend_string_release(http_headers); - zend_string_release(http_body); + zend_string_release_ex(http_headers, 0); + zend_string_release_ex(http_body, 0); goto try_again; } @@ -1245,7 +1245,7 @@ try_again: ZVAL_STRINGL(err, http_body, http_body_size, 1); add_soap_fault(this_ptr, "HTTP", "Didn't receive an xml document", NULL, err); efree(content_type); - zend_string_release(http_headers); + zend_string_release_ex(http_headers, 0); efree(http_body); return FALSE; } @@ -1272,8 +1272,8 @@ try_again: ZVAL_STR_COPY(¶ms[0], http_body); } else { efree(content_encoding); - zend_string_release(http_headers); - zend_string_release(http_body); + zend_string_release_ex(http_headers, 0); + zend_string_release_ex(http_body, 0); if (http_msg) { efree(http_msg); } @@ -1284,14 +1284,14 @@ try_again: Z_TYPE(retval) == IS_STRING) { zval_ptr_dtor(¶ms[0]); zval_ptr_dtor(&func); - zend_string_release(http_body); + zend_string_release_ex(http_body, 0); ZVAL_COPY_VALUE(return_value, &retval); } else { zval_ptr_dtor(¶ms[0]); zval_ptr_dtor(&func); efree(content_encoding); - zend_string_release(http_headers); - zend_string_release(http_body); + zend_string_release_ex(http_headers, 0); + zend_string_release_ex(http_body, 0); add_soap_fault(this_ptr, "HTTP", "Can't uncompress compressed response", NULL, NULL); if (http_msg) { efree(http_msg); @@ -1303,7 +1303,7 @@ try_again: ZVAL_STR(return_value, http_body); } - zend_string_release(http_headers); + zend_string_release_ex(http_headers, 0); if (http_status >= 400) { int error = 0; @@ -1420,7 +1420,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers) if (http_buf_size + buf_size + 1 < 0) { if (http_buf) { - zend_string_release(http_buf); + zend_string_release_ex(http_buf, 0); } return NULL; } @@ -1450,7 +1450,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers) if (ch != '\n') { /* Somthing wrong in chunked encoding */ if (http_buf) { - zend_string_release(http_buf); + zend_string_release_ex(http_buf, 0); } return NULL; } @@ -1458,7 +1458,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers) } else { /* Somthing wrong in chunked encoding */ if (http_buf) { - zend_string_release(http_buf); + zend_string_release_ex(http_buf, 0); } return NULL; } diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c index 9da58ea17a..b72bde97f5 100644 --- a/ext/soap/php_packet_soap.c +++ b/ext/soap/php_packet_soap.c @@ -236,10 +236,10 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction } add_soap_fault(this_ptr, faultcode, faultstring ? ZSTR_VAL(faultstring) : NULL, faultactor ? ZSTR_VAL(faultactor) : NULL, &details); if (faultstring) { - zend_string_release(faultstring); + zend_string_release_ex(faultstring, 0); } if (faultactor) { - zend_string_release(faultactor); + zend_string_release_ex(faultactor, 0); } if (Z_REFCOUNTED(details)) { Z_DELREF(details); diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 394a96b392..fae7d2a444 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -962,9 +962,9 @@ PHP_METHOD(SoapFault, __toString) ZSTR_VAL(faultcode_val), ZSTR_VAL(faultstring_val), ZSTR_VAL(file_val), line_val, Z_STRLEN(trace) ? Z_STRVAL(trace) : "#0 {main}\n"); - zend_string_release(file_val); - zend_string_release(faultstring_val); - zend_string_release(faultcode_val); + zend_string_release_ex(file_val, 0); + zend_string_release_ex(faultstring_val, 0); + zend_string_release_ex(faultcode_val, 0); zval_ptr_dtor(&trace); RETVAL_STR(str); @@ -1433,7 +1433,7 @@ PHP_METHOD(SoapServer, addFunction) ZVAL_STR_COPY(&function_copy, f->common.function_name); zend_hash_update(service->soap_functions.ft, key, &function_copy); - zend_string_release(key); + zend_string_release_ex(key, 0); } ZEND_HASH_FOREACH_END(); } } else if (Z_TYPE_P(function_name) == IS_STRING) { @@ -1453,7 +1453,7 @@ PHP_METHOD(SoapServer, addFunction) ZVAL_STR_COPY(&function_copy, f->common.function_name); zend_hash_update(service->soap_functions.ft, key, &function_copy); - zend_string_release(key); + zend_string_release_ex(key, 0); } else if (Z_TYPE_P(function_name) == IS_LONG) { if (Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL) { if (service->soap_functions.ft != NULL) { @@ -1484,7 +1484,7 @@ static void _soap_server_exception(soapServicePtr service, sdlFunctionPtr functi zval rv; zend_string *msg = zval_get_string(zend_read_property(zend_ce_error, &exception_object, "message", sizeof("message")-1, 0, &rv)); add_soap_fault_ex(&exception_object, this_ptr, "Server", ZSTR_VAL(msg), NULL, NULL); - zend_string_release(msg); + zend_string_release_ex(msg, 0); } else { add_soap_fault_ex(&exception_object, this_ptr, "Server", "Internal Error", NULL, NULL); } @@ -1607,16 +1607,16 @@ PHP_METHOD(SoapServer, handle) php_stream_filter_append(&SG(request_info).request_body->readfilters, zf); } else { php_error_docref(NULL, E_WARNING,"Can't uncompress compressed request"); - zend_string_release(server); + zend_string_release_ex(server, 0); return; } } else { php_error_docref(NULL, E_WARNING,"Request is compressed with unknown compression '%s'",Z_STRVAL_P(encoding)); - zend_string_release(server); + zend_string_release_ex(server, 0); return; } } - zend_string_release(server); + zend_string_release_ex(server, 0); doc_request = soap_xmlParseFile("php://input"); @@ -2550,7 +2550,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act /* change class */ EG(exception)->ce = soap_fault_class_entry; set_soap_fault(&exception_object, NULL, "Client", ZSTR_VAL(msg), NULL, NULL, NULL); - zend_string_release(msg); + zend_string_release_ex(msg, 0); } else if ((fault = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault")-1)) == NULL) { add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() returned non string value", NULL, NULL); } @@ -3957,7 +3957,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } else { xmlNodeSetContentLen(node, BAD_CAST(ZSTR_VAL(str)), (int)ZSTR_LEN(str)); } - zend_string_release(str); + zend_string_release_ex(str, 0); } if ((tmp = zend_hash_str_find(prop, "faultstring", sizeof("faultstring")-1)) != NULL) { xmlNodePtr node = master_to_xml(get_conversion(IS_STRING), tmp, SOAP_LITERAL, param); @@ -3982,7 +3982,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } else { xmlNodeSetContentLen(node, BAD_CAST(ZSTR_VAL(str)), (int)ZSTR_LEN(str)); } - zend_string_release(str); + zend_string_release_ex(str, 0); } if ((tmp = zend_hash_str_find(prop, "faultstring", sizeof("faultstring")-1)) != NULL) { xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Reason"), NULL); diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 7d918602bf..5b5525f622 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -2861,7 +2861,7 @@ PHP_FUNCTION(socket_wsaprotocol_info_export) DWORD err = GetLastError(); php_error_docref(NULL, E_WARNING, "Unable to create file mapping [0x%08lx]", err); } - zend_string_release(seg_name); + zend_string_release_ex(seg_name, 0); RETURN_FALSE; } diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 2ae1d0de9a..5287bc2745 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -281,7 +281,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha new_op_array = NULL; zend_file_handle_dtor(&file_handle); } - zend_string_release(opened_path); + zend_string_release_ex(opened_path, 0); if (new_op_array) { ZVAL_UNDEF(&result); zend_execute(new_op_array, &result); @@ -348,7 +348,7 @@ PHP_FUNCTION(spl_autoload_extensions) } if (file_exts) { if (SPL_G(autoload_extensions)) { - zend_string_release(SPL_G(autoload_extensions)); + zend_string_release_ex(SPL_G(autoload_extensions), 0); } SPL_G(autoload_extensions) = zend_string_copy(file_exts); } @@ -376,7 +376,7 @@ static void autoload_func_info_dtor(zval *element) } if (alfi->func_ptr && UNEXPECTED(alfi->func_ptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) { - zend_string_release(alfi->func_ptr->common.function_name); + zend_string_release_ex(alfi->func_ptr->common.function_name, 0); zend_free_trampoline(alfi->func_ptr); } if (!Z_ISUNDEF(alfi->closure)) { @@ -457,7 +457,7 @@ PHP_FUNCTION(spl_autoload_call) } zend_hash_move_forward_ex(SPL_G(autoload_functions), &pos); } - zend_string_release(lc_name); + zend_string_release_ex(lc_name, 0); SPL_G(autoload_running) = l_autoload_running; } else { /* do not use or overwrite &EG(autoload_func) here */ @@ -506,7 +506,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); RETURN_FALSE; } else if (do_throw) { zend_throw_exception_ex(spl_ce_LogicException, 0, "Passed array does not specify %s %smethod (%s)", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : "", error); @@ -514,7 +514,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); RETURN_FALSE; } else if (Z_TYPE_P(zcallable) == IS_STRING) { if (do_throw) { @@ -523,7 +523,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); RETURN_FALSE; } else { if (do_throw) { @@ -532,7 +532,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); RETURN_FALSE; } } else if (fcc.function_handler->type == ZEND_INTERNAL_FUNCTION && @@ -543,7 +543,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); RETURN_FALSE; } alfi.ce = fcc.calling_scope; @@ -570,7 +570,7 @@ PHP_FUNCTION(spl_autoload_register) lc_name = zend_string_tolower(func_name); } } - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); if (SPL_G(autoload_functions) && zend_hash_exists(SPL_G(autoload_functions), lc_name)) { if (!Z_ISUNDEF(alfi.closure)) { @@ -627,7 +627,7 @@ PHP_FUNCTION(spl_autoload_register) Z_DELREF(alfi.closure); } if (UNEXPECTED(alfi.func_ptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) { - zend_string_release(alfi.func_ptr->common.function_name); + zend_string_release_ex(alfi.func_ptr->common.function_name, 0); zend_free_trampoline(alfi.func_ptr); } } @@ -636,7 +636,7 @@ PHP_FUNCTION(spl_autoload_register) HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions)); } skip: - zend_string_release(lc_name); + zend_string_release_ex(lc_name, 0); } if (SPL_G(autoload_functions)) { @@ -671,7 +671,7 @@ PHP_FUNCTION(spl_autoload_unregister) efree(error); } if (func_name) { - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); } RETURN_FALSE; } @@ -694,7 +694,7 @@ PHP_FUNCTION(spl_autoload_unregister) lc_name = zend_string_tolower(func_name); } } - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); if (SPL_G(autoload_functions)) { if (ZSTR_LEN(lc_name) == sizeof("spl_autoload_call") - 1 && !strcmp(ZSTR_VAL(lc_name), "spl_autoload_call")) { @@ -728,7 +728,7 @@ PHP_FUNCTION(spl_autoload_unregister) } } - zend_string_release(lc_name); + zend_string_release_ex(lc_name, 0); RETURN_BOOL(success == SUCCESS); } /* }}} */ @@ -995,7 +995,7 @@ PHP_RINIT_FUNCTION(spl) /* {{{ */ PHP_RSHUTDOWN_FUNCTION(spl) /* {{{ */ { if (SPL_G(autoload_extensions)) { - zend_string_release(SPL_G(autoload_extensions)); + zend_string_release_ex(SPL_G(autoload_extensions), 0); SPL_G(autoload_extensions) = NULL; } if (SPL_G(autoload_functions)) { diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index ec6d7d5fb1..2b4e5b8098 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -852,7 +852,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */ ? spl_ce_ArrayIterator : spl_ce_ArrayObject; zname = spl_gen_private_prop_name(base, "storage", sizeof("storage")-1); zend_symtable_update(debug_info, zname, storage); - zend_string_release(zname); + zend_string_release_ex(zname, 0); return debug_info; } diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 56e51dfe5b..54bd6762bc 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -615,7 +615,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem path = spl_filesystem_object_get_pathname(intern, &path_len); ZVAL_STRINGL(&tmp, path, path_len); zend_symtable_update(rv, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); if (intern->file_name) { pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, "fileName", sizeof("fileName")-1); @@ -627,7 +627,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem ZVAL_STRINGL(&tmp, intern->file_name, intern->file_name_len); } zend_symtable_update(rv, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); } if (intern->type == SPL_FS_DIR) { #ifdef HAVE_GLOB @@ -638,7 +638,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem ZVAL_FALSE(&tmp); } zend_symtable_update(rv, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); #endif pnstr = spl_gen_private_prop_name(spl_ce_RecursiveDirectoryIterator, "subPathName", sizeof("subPathName")-1); if (intern->u.dir.sub_path) { @@ -647,24 +647,24 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem ZVAL_EMPTY_STRING(&tmp); } zend_symtable_update(rv, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); } if (intern->type == SPL_FS_FILE) { pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "openMode", sizeof("openMode")-1); ZVAL_STRINGL(&tmp, intern->u.file.open_mode, intern->u.file.open_mode_len); zend_symtable_update(rv, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); stmp[1] = '\0'; stmp[0] = intern->u.file.delimiter; pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "delimiter", sizeof("delimiter")-1); ZVAL_STRINGL(&tmp, stmp, 1); zend_symtable_update(rv, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); stmp[0] = intern->u.file.enclosure; pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "enclosure", sizeof("enclosure")-1); ZVAL_STRINGL(&tmp, stmp, 1); zend_symtable_update(rv, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); } return rv; @@ -679,7 +679,7 @@ zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend zend_function *func; zend_string *tmp = zend_string_init("_bad_state_ex", sizeof("_bad_state_ex") - 1, 0); func = zend_get_std_object_handlers()->get_method(object, tmp, NULL); - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); return func; } @@ -958,10 +958,10 @@ SPL_METHOD(SplFileInfo, getExtension) if (p) { idx = p - ZSTR_VAL(ret); RETVAL_STRINGL(ZSTR_VAL(ret) + idx + 1, ZSTR_LEN(ret) - idx - 1); - zend_string_release(ret); + zend_string_release_ex(ret, 0); return; } else { - zend_string_release(ret); + zend_string_release_ex(ret, 0); RETURN_EMPTY_STRING(); } } @@ -986,9 +986,9 @@ SPL_METHOD(DirectoryIterator, getExtension) if (p) { idx = p - ZSTR_VAL(fname); RETVAL_STRINGL(ZSTR_VAL(fname) + idx + 1, ZSTR_LEN(fname) - idx - 1); - zend_string_release(fname); + zend_string_release_ex(fname, 0); } else { - zend_string_release(fname); + zend_string_release_ex(fname, 0); RETURN_EMPTY_STRING(); } } diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 03a4f4b5fe..b0ce0e508f 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -512,7 +512,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* { pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "flags", sizeof("flags")-1); ZVAL_LONG(&tmp, intern->flags); zend_hash_add(debug_info, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); array_init(&dllist_array); @@ -530,7 +530,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* { pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "dllist", sizeof("dllist")-1); zend_hash_add(debug_info, pnstr, &dllist_array); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); return debug_info; } diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 6429a892ea..3031a5028b 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -494,12 +494,12 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv pnstr = spl_gen_private_prop_name(ce, "flags", sizeof("flags")-1); ZVAL_LONG(&tmp, intern->flags); zend_hash_update(debug_info, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); pnstr = spl_gen_private_prop_name(ce, "isCorrupted", sizeof("isCorrupted")-1); ZVAL_BOOL(&tmp, intern->heap->flags&SPL_HEAP_CORRUPTED); zend_hash_update(debug_info, pnstr, &tmp); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); array_init(&heap_array); @@ -512,7 +512,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv pnstr = spl_gen_private_prop_name(ce, "heap", sizeof("heap")-1); zend_hash_update(debug_info, pnstr, &heap_array); - zend_string_release(pnstr); + zend_string_release_ex(pnstr, 0); return debug_info; } diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 2cf658af29..2cea85549b 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -2117,7 +2117,7 @@ SPL_METHOD(RegexIterator, accept) if (intern->u.regex.flags & REGIT_INVERTED) { RETVAL_BOOL(Z_TYPE_P(return_value) != IS_TRUE); } - zend_string_release(subject); + zend_string_release_ex(subject, 0); } /* }}} */ /* {{{ proto string RegexIterator::getRegex() @@ -2338,7 +2338,7 @@ static void spl_dual_it_free_storage(zend_object *_object) php_pcre_pce_decref(object->u.regex.pce); } if (object->u.regex.regex) { - zend_string_release(object->u.regex.regex); + zend_string_release_ex(object->u.regex.regex, 0); } } #endif diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 1c3911a25e..9a92a0e53d 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -143,7 +143,7 @@ static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage static void spl_object_storage_free_hash(spl_SplObjectStorage *intern, zend_hash_key *key) { if (key->key) { - zend_string_release(key->key); + zend_string_release_ex(key->key, 0); } } @@ -309,12 +309,12 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{ add_assoc_zval_ex(&tmp, "obj", sizeof("obj") - 1, &element->obj); add_assoc_zval_ex(&tmp, "inf", sizeof("inf") - 1, &element->inf); zend_hash_update(Z_ARRVAL(storage), md5str, &tmp); - zend_string_release(md5str); + zend_string_release_ex(md5str, 0); } ZEND_HASH_FOREACH_END(); zname = spl_gen_private_prop_name(spl_ce_SplObjectStorage, "storage", sizeof("storage")-1); zend_symtable_update(debug_info, zname, &storage); - zend_string_release(zname); + zend_string_release_ex(zname, 0); return debug_info; } diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index eb87a5eef1..1327c2056a 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -929,7 +929,7 @@ PHP_METHOD(sqlite3, createFunction) if (!zend_is_callable(callback_func, 0, NULL)) { zend_string *callback_name = zend_get_callable_name(callback_func); php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); RETURN_FALSE; } @@ -978,14 +978,14 @@ PHP_METHOD(sqlite3, createAggregate) if (!zend_is_callable(step_callback, 0, NULL)) { zend_string *callback_name = zend_get_callable_name(step_callback); php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); RETURN_FALSE; } if (!zend_is_callable(fini_callback, 0, NULL)) { zend_string *callback_name = zend_get_callable_name(fini_callback); php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); RETURN_FALSE; } @@ -1034,7 +1034,7 @@ PHP_METHOD(sqlite3, createCollation) if (!zend_is_callable(callback_func, 0, NULL)) { zend_string *callback_name = zend_get_callable_name(callback_func); php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); RETURN_FALSE; } @@ -1429,7 +1429,7 @@ static int register_bound_parameter_to_sqlite(struct php_sqlite3_bound_param *pa if (param->param_number < 1) { if (param->name) { - zend_string_release(param->name); + zend_string_release_ex(param->name, 0); } return 0; } @@ -1614,7 +1614,7 @@ PHP_METHOD(sqlite3stmt, execute) if (buffer) { sqlite3_bind_blob(stmt_obj->stmt, param->param_number, ZSTR_VAL(buffer), ZSTR_LEN(buffer), SQLITE_TRANSIENT); - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); } else { sqlite3_bind_null(stmt_obj->stmt, param->param_number); } @@ -2253,7 +2253,7 @@ static void sqlite3_param_dtor(zval *data) /* {{{ */ struct php_sqlite3_bound_param *param = (struct php_sqlite3_bound_param*)Z_PTR_P(data); if (param->name) { - zend_string_release(param->name); + zend_string_release_ex(param->name, 0); } if (!Z_ISNULL(param->parameter)) { diff --git a/ext/standard/array.c b/ext/standard/array.c index 7621b0616a..55d338faad 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1966,7 +1966,7 @@ static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *s count++; } } - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); } } ZEND_HASH_FOREACH_END(); @@ -2019,7 +2019,7 @@ static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbo count++; } } - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); } } ZEND_HASH_FOREACH_END(); @@ -2081,7 +2081,7 @@ static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol count++; } } - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); } else { if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) { continue; @@ -2155,7 +2155,7 @@ static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_tab count++; } } - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); } else { if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) { continue; @@ -2195,7 +2195,7 @@ static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_ } else { zend_string *str = zend_long_to_str(num_key); php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1); - zend_string_release(str); + zend_string_release_ex(str, 0); } if (php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { if (zend_string_equals_literal(Z_STR(final_name), "this")) { @@ -2221,7 +2221,7 @@ static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_ count++; } } - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); } ZEND_HASH_FOREACH_END(); return count; @@ -2245,7 +2245,7 @@ static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_tabl } else { zend_string *str = zend_long_to_str(num_key); php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1); - zend_string_release(str); + zend_string_release_ex(str, 0); } if (php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { if (zend_string_equals_literal(Z_STR(final_name), "this")) { @@ -2269,7 +2269,7 @@ static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_tabl count++; } } - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); } ZEND_HASH_FOREACH_END(); return count; @@ -2289,7 +2289,7 @@ static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *sym if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) { php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1); if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); continue; } } else { @@ -2298,9 +2298,9 @@ static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *sym } else { zend_string *str = zend_long_to_str(num_key); php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1); - zend_string_release(str); + zend_string_release_ex(str, 0); if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); continue; } } @@ -2326,7 +2326,7 @@ static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *sym } count++; } - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); } ZEND_HASH_FOREACH_END(); return count; @@ -2346,7 +2346,7 @@ static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) { php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1); if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); continue; } } else { @@ -2355,9 +2355,9 @@ static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_ } else { zend_string *str = zend_long_to_str(num_key); php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1); - zend_string_release(str); + zend_string_release_ex(str, 0); if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); continue; } } @@ -2381,7 +2381,7 @@ static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_ } count++; } - zend_string_release(Z_STR(final_name)); + zend_string_release_ex(Z_STR(final_name), 0); } ZEND_HASH_FOREACH_END(); return count; @@ -3040,7 +3040,7 @@ static void php_array_data_shuffle(zval *array) /* {{{ */ for (j = 0; j < n_elems; j++) { p = hash->arData + j; if (p->key) { - zend_string_release(p->key); + zend_string_release_ex(p->key, 0); } p->h = j; p->key = NULL; @@ -4445,7 +4445,7 @@ PHP_FUNCTION(array_change_key_case) new_key = php_string_tolower(string_key); } entry = zend_hash_update(Z_ARRVAL_P(return_value), new_key, entry); - zend_string_release(new_key); + zend_string_release_ex(new_key, 0); } zval_add_ref(entry); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 3cf3a02830..4f343379e0 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -188,7 +188,7 @@ PHP_FUNCTION(assert) } else { zend_string *str = zval_get_string(description); zend_throw_error(NULL, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval); - zend_string_release(str); + zend_string_release_ex(str, 0); } if (ASSERTG(bail)) { zend_bailout(); @@ -255,7 +255,7 @@ PHP_FUNCTION(assert) } else { zend_string *str = zval_get_string(description); zend_throw_exception(assertion_error_ce, ZSTR_VAL(str), E_ERROR); - zend_string_release(str); + zend_string_release_ex(str, 0); } } else if (ASSERTG(warning)) { if (!description) { @@ -271,7 +271,7 @@ PHP_FUNCTION(assert) } else { php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str)); } - zend_string_release(str); + zend_string_release_ex(str, 0); } } @@ -306,8 +306,8 @@ PHP_FUNCTION(assert_options) zend_string *value_str = zval_get_string(value); key = zend_string_init("assert.active", sizeof("assert.active")-1, 0); zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release(key); - zend_string_release(value_str); + zend_string_release_ex(key, 0); + zend_string_release_ex(value_str, 0); } RETURN_LONG(oldint); break; @@ -318,8 +318,8 @@ PHP_FUNCTION(assert_options) zend_string *value_str = zval_get_string(value); key = zend_string_init("assert.bail", sizeof("assert.bail")-1, 0); zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release(key); - zend_string_release(value_str); + zend_string_release_ex(key, 0); + zend_string_release_ex(value_str, 0); } RETURN_LONG(oldint); break; @@ -330,8 +330,8 @@ PHP_FUNCTION(assert_options) zend_string *value_str = zval_get_string(value); key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0); zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release(key); - zend_string_release(value_str); + zend_string_release_ex(key, 0); + zend_string_release_ex(value_str, 0); } RETURN_LONG(oldint); break; @@ -342,8 +342,8 @@ PHP_FUNCTION(assert_options) zend_string *value_str = zval_get_string(value); key = zend_string_init("assert.warning", sizeof("assert.warning")-1, 0); zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release(key); - zend_string_release(value_str); + zend_string_release_ex(key, 0); + zend_string_release_ex(value_str, 0); } RETURN_LONG(oldint); break; @@ -368,8 +368,8 @@ PHP_FUNCTION(assert_options) zend_string *key = zend_string_init("assert.exception", sizeof("assert.exception")-1, 0); zend_string *val = zval_get_string(value); zend_alter_ini_entry_ex(key, val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release(val); - zend_string_release(key); + zend_string_release_ex(val, 0); + zend_string_release_ex(key, 0); } RETURN_LONG(oldint); break; diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 85aa81f873..5a4c1f4a2d 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3848,7 +3848,7 @@ PHP_RSHUTDOWN_FUNCTION(basic) /* {{{ */ setlocale(LC_CTYPE, ""); zend_update_current_locale(); if (BG(locale_string)) { - zend_string_release(BG(locale_string)); + zend_string_release_ex(BG(locale_string), 0); BG(locale_string) = NULL; } } @@ -5044,7 +5044,7 @@ static int user_shutdown_function_call(zval *zv) /* {{{ */ zend_string *function_name = zend_get_callable_name(&shutdown_function_entry->arguments[0]); php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name)); - zend_string_release(function_name); + zend_string_release_ex(function_name, 0); return 0; } @@ -5180,7 +5180,7 @@ PHP_FUNCTION(register_shutdown_function) = zend_get_callable_name(&shutdown_function_entry.arguments[0]); php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", ZSTR_VAL(callback_name)); efree(shutdown_function_entry.arguments); - zend_string_release(callback_name); + zend_string_release_ex(callback_name, 0); RETVAL_FALSE; } else { if (!BG(user_shutdown_function_names)) { @@ -5579,11 +5579,11 @@ PHP_FUNCTION(set_include_path) key = zend_string_init("include_path", sizeof("include_path") - 1, 0); if (zend_alter_ini_entry_ex(key, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == FAILURE) { - zend_string_release(key); + zend_string_release_ex(key, 0); zval_dtor(return_value); RETURN_FALSE; } - zend_string_release(key); + zend_string_release_ex(key, 0); } /* }}} */ @@ -5677,7 +5677,7 @@ PHP_FUNCTION(ignore_user_abort) if (ZEND_NUM_ARGS()) { zend_string *key = zend_string_init("ignore_user_abort", sizeof("ignore_user_abort") - 1, 0); zend_alter_ini_entry_chars(key, arg ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - zend_string_release(key); + zend_string_release_ex(key, 0); } RETURN_LONG(old_setting); @@ -5825,10 +5825,10 @@ PHP_FUNCTION(register_tick_function) if (!zend_is_callable(&tick_fe.arguments[0], 0, &function_name)) { efree(tick_fe.arguments); php_error_docref(NULL, E_WARNING, "Invalid tick callback '%s' passed", ZSTR_VAL(function_name)); - zend_string_release(function_name); + zend_string_release_ex(function_name, 0); RETURN_FALSE; } else if (function_name) { - zend_string_release(function_name); + zend_string_release_ex(function_name, 0); } if (Z_TYPE(tick_fe.arguments[0]) != IS_ARRAY && Z_TYPE(tick_fe.arguments[0]) != IS_OBJECT) { diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 60c012707d..4753adfb78 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -72,9 +72,9 @@ ZEND_DECLARE_MODULE_GLOBALS(browscap) static void browscap_entry_dtor(zval *zvalue) { browscap_entry *entry = Z_PTR_P(zvalue); - zend_string_release(entry->pattern); + zend_string_release_ex(entry->pattern, 0); if (entry->parent) { - zend_string_release(entry->parent); + zend_string_release_ex(entry->parent, 0); } efree(entry); } @@ -82,9 +82,9 @@ static void browscap_entry_dtor(zval *zvalue) static void browscap_entry_dtor_persistent(zval *zvalue) { browscap_entry *entry = Z_PTR_P(zvalue); - zend_string_release(entry->pattern); + zend_string_release_ex(entry->pattern, 1); if (entry->parent) { - zend_string_release(entry->parent); + zend_string_release_ex(entry->parent, 1); } pefree(entry, 1); } @@ -788,7 +788,7 @@ PHP_FUNCTION(get_browser) efree(agent_ht); } - zend_string_release(lookup_browser_name); + zend_string_release_ex(lookup_browser_name, 0); } /* }}} */ diff --git a/ext/standard/exec.c b/ext/standard/exec.c index b748e173ce..b6302a0f87 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -372,7 +372,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str) if (y > cmd_max_len + 1) { php_error_docref(NULL, E_ERROR, "Escaped command exceeds the allowed length of %zu bytes", cmd_max_len); - zend_string_release(cmd); + zend_string_release_ex(cmd, 0); return ZSTR_EMPTY_ALLOC(); } @@ -459,7 +459,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str) if (y > cmd_max_len + 1) { php_error_docref(NULL, E_ERROR, "Escaped argument exceeds the allowed length of %zu bytes", cmd_max_len); - zend_string_release(cmd); + zend_string_release_ex(cmd, 0); return ZSTR_EMPTY_ALLOC(); } diff --git a/ext/standard/file.c b/ext/standard/file.c index 096d70e12c..baefafc735 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -843,7 +843,7 @@ PHP_FUNCTION(tempnam) close(fd); RETVAL_STR(opened_path); } - zend_string_release(p); + zend_string_release_ex(p, 0); } /* }}} */ diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 5444994aba..0c3aa4c47b 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -114,14 +114,14 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) zval_ptr_dtor(zerrstr); ZVAL_STR(zerrstr, errstr); } else if (!zerrstr && errstr) { - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); } RETURN_FALSE; } if (errstr) { - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); } php_stream_to_zval(stream, return_value); diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index eed81e900f..d49cebf579 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -632,7 +632,7 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count tmp_len = MIN(sizeof(ent->d_name), ZSTR_LEN(basename) - 1); memcpy(ent->d_name, ZSTR_VAL(basename), tmp_len); ent->d_name[tmp_len - 1] = '\0'; - zend_string_release(basename); + zend_string_release_ex(basename, 0); /* Trim off trailing whitespace characters */ while (tmp_len > 0 && diff --git a/ext/standard/head.c b/ext/standard/head.c index 5e21638adf..1ddbc187a0 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -157,7 +157,7 @@ PHPAPI int php_setcookie(zend_string *name, zend_string *value, time_t expires, if (!p || *(p + 5) != ' ') { zend_string_free(dt); efree(cookie); - zend_string_release(encoded_value); + zend_string_release_ex(encoded_value, 0); zend_error(E_WARNING, "Expiry date cannot have a year greater than 9999"); return FAILURE; } @@ -175,7 +175,7 @@ PHPAPI int php_setcookie(zend_string *name, zend_string *value, time_t expires, } if (encoded_value) { - zend_string_release(encoded_value); + zend_string_release_ex(encoded_value, 0); } if (path && ZSTR_LEN(path)) { diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index b94cdd672b..a1d4729117 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -224,7 +224,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, if (errstr) { php_stream_wrapper_log_error(wrapper, options, "%s", ZSTR_VAL(errstr)); - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); errstr = NULL; } @@ -520,7 +520,7 @@ finish: } if (tmp) { - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); } } @@ -864,7 +864,7 @@ finish: if (!s) { s = ZSTR_VAL(resource->path); if (!ZSTR_LEN(resource->path)) { - zend_string_release(resource->path); + zend_string_release_ex(resource->path, 0); resource->path = zend_string_init("/", 1, 0); s = ZSTR_VAL(resource->path); } else { diff --git a/ext/standard/image.c b/ext/standard/image.c index 189295aa4c..e34f5c79e8 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -249,7 +249,7 @@ static struct gfxinfo *php_handle_swc(php_stream * stream) } while ((status==Z_BUF_ERROR)&&(factor<maxfactor)); if (bufz) { - zend_string_release(bufz); + zend_string_release_ex(bufz, 0); } if (status == Z_OK) { diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index b41ab8572f..0e34b0aa26 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -42,7 +42,7 @@ static void incomplete_class_message(zval *object, int error_type) if (class_name) { php_error_docref(NULL, error_type, INCOMPLETE_CLASS_MSG, ZSTR_VAL(class_name)); - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); } else { php_error_docref(NULL, error_type, INCOMPLETE_CLASS_MSG, "unknown"); } diff --git a/ext/standard/info.c b/ext/standard/info.c index 5c5892e6b6..8a9d053bf2 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -230,7 +230,7 @@ static void php_print_gpcse_array(char *name, uint32_t name_length) php_info_print("<pre>"); php_info_print_html_esc(ZSTR_VAL(str), ZSTR_LEN(str)); php_info_print("</pre>"); - zend_string_release(str); + zend_string_release_ex(str, 0); } else { zend_print_zval_r(tmp, 0); } diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 446534b336..b774922c56 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -314,7 +314,7 @@ PHP_FUNCTION(mail) tmp_headers = zend_string_init(Z_STRVAL_P(headers), Z_STRLEN_P(headers), 0); MAIL_ASCIIZ_CHECK(ZSTR_VAL(tmp_headers), ZSTR_LEN(tmp_headers)); str_headers = php_trim(tmp_headers, NULL, 0, 2); - zend_string_release(tmp_headers); + zend_string_release_ex(tmp_headers, 0); break; case IS_ARRAY: str_headers = php_mail_build_headers(headers); @@ -381,11 +381,11 @@ PHP_FUNCTION(mail) } if (str_headers) { - zend_string_release(str_headers); + zend_string_release_ex(str_headers, 0); } if (extra_cmd) { - zend_string_release(extra_cmd); + zend_string_release_ex(extra_cmd, 0); } if (to_r != to) { efree(to_r); @@ -531,7 +531,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char } else { spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s", php_getuid(), ZSTR_VAL(f)); } - zend_string_release(f); + zend_string_release_ex(f, 0); } if (hdr && php_mail_detect_multiple_crlf(hdr)) { diff --git a/ext/standard/math.c b/ext/standard/math.c index e6f3bab87f..56d6f85ace 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -1232,7 +1232,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin } ZSTR_LEN(res) = reslen; - zend_string_release(tmpbuf); + zend_string_release_ex(tmpbuf, 0); return res; } diff --git a/ext/standard/password.c b/ext/standard/password.c index 105abbc565..d5bbd18fbd 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -112,7 +112,7 @@ static int php_password_salt_to64(const char *str, const size_t str_len, const s buffer = php_base64_encode((unsigned char*) str, str_len); if (ZSTR_LEN(buffer) < out_len) { /* Too short of an encoded string generated */ - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); return FAILURE; } for (pos = 0; pos < out_len; pos++) { @@ -142,18 +142,18 @@ static zend_string* php_password_make_salt(size_t length) /* {{{ */ buffer = zend_string_alloc(length * 3 / 4 + 1, 0); if (FAILURE == php_random_bytes_silent(ZSTR_VAL(buffer), ZSTR_LEN(buffer))) { php_error_docref(NULL, E_WARNING, "Unable to generate salt"); - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); return NULL; } ret = zend_string_alloc(length, 0); if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), length, ZSTR_VAL(ret)) == FAILURE) { php_error_docref(NULL, E_WARNING, "Generated salt too short"); - zend_string_release(buffer); - zend_string_release(ret); + zend_string_release_ex(buffer, 0); + zend_string_release_ex(ret, 0); return NULL; } - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); ZSTR_VAL(ret)[length] = 0; return ret; } @@ -379,13 +379,13 @@ static zend_string* php_password_get_salt(zval *return_value, size_t required_sa the > INT_MAX check. */ if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(buffer))) { php_error_docref(NULL, E_WARNING, "Supplied salt is too long"); - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); return NULL; } if (ZSTR_LEN(buffer) < required_salt_len) { php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd expecting %zd", ZSTR_LEN(buffer), required_salt_len); - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); return NULL; } @@ -393,16 +393,16 @@ static zend_string* php_password_get_salt(zval *return_value, size_t required_sa zend_string *salt = zend_string_alloc(required_salt_len, 0); if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), required_salt_len, ZSTR_VAL(salt)) == FAILURE) { php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd", ZSTR_LEN(buffer)); - zend_string_release(salt); - zend_string_release(buffer); + zend_string_release_ex(salt, 0); + zend_string_release_ex(buffer, 0); return NULL; } - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); return salt; } else { zend_string *salt = zend_string_alloc(required_salt_len, 0); memcpy(ZSTR_VAL(salt), ZSTR_VAL(buffer), required_salt_len); - zend_string_release(buffer); + zend_string_release_ex(buffer, 0); return salt; } } @@ -450,11 +450,11 @@ PHP_FUNCTION(password_hash) sprintf(ZSTR_VAL(hash), "%s%s", hash_format, ZSTR_VAL(salt)); ZSTR_VAL(hash)[hash_format_len + ZSTR_LEN(salt)] = 0; - zend_string_release(salt); + zend_string_release_ex(salt, 0); /* This cast is safe, since both values are defined here in code and cannot overflow */ result = php_crypt(ZSTR_VAL(password), (int)ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1); - zend_string_release(hash); + zend_string_release_ex(hash, 0); if (!result) { RETURN_FALSE; @@ -540,8 +540,8 @@ PHP_FUNCTION(password_hash) ARGON2_VERSION_NUMBER ); - zend_string_release(out); - zend_string_release(salt); + zend_string_release_ex(out, 0); + zend_string_release_ex(salt, 0); if (status != ARGON2_OK) { zend_string_efree(encoded); diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index 33969e3ca4..d494c250a6 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -39,7 +39,7 @@ } #define PHP_CLEANUP_CLASS_ATTRIBUTES() \ - zend_string_release(class_name) + zend_string_release_ex(class_name, 0) #define PHP_CLASS_ATTRIBUTES \ zend_string *class_name; \ diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 370ceee9cc..85c703b475 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -104,7 +104,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent str = zval_get_string(element); if (ZSTR_LEN(str) == 0) { - zend_string_release(str); + zend_string_release_ex(str, 0); continue; } @@ -143,7 +143,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent #endif p += ZSTR_LEN(str) + 1; } - zend_string_release(str); + zend_string_release_ex(str, 0); } ZEND_HASH_FOREACH_END(); assert((uint32_t)(p - env.envp) <= sizeenv); diff --git a/ext/standard/random.c b/ext/standard/random.c index 627df9bdb8..691fd9a394 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -201,7 +201,7 @@ PHP_FUNCTION(random_bytes) bytes = zend_string_alloc(size, 0); if (php_random_bytes_throw(ZSTR_VAL(bytes), size) == FAILURE) { - zend_string_release(bytes); + zend_string_release_ex(bytes, 0); return; } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index d3f0c1cd7c..047a99892f 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -151,7 +151,7 @@ PHP_FUNCTION(stream_socket_client) zend_string *quoted_host = php_addslashes(host, 0); php_error_docref(NULL, E_WARNING, "unable to connect to %s (%s)", ZSTR_VAL(quoted_host), errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr)); - zend_string_release(quoted_host); + zend_string_release_ex(quoted_host, 0); } if (hashkey) { @@ -167,13 +167,13 @@ PHP_FUNCTION(stream_socket_client) zval_ptr_dtor(zerrstr); ZVAL_STR(zerrstr, errstr); } else if (errstr) { - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); } RETURN_FALSE; } if (errstr) { - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); } php_stream_to_zval(stream, return_value); @@ -237,13 +237,13 @@ PHP_FUNCTION(stream_socket_server) zval_ptr_dtor(zerrstr); ZVAL_STR(zerrstr, errstr); } else if (errstr) { - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); } RETURN_FALSE; } if (errstr) { - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); } php_stream_to_zval(stream, return_value); @@ -302,7 +302,7 @@ PHP_FUNCTION(stream_socket_accept) } if (errstr) { - zend_string_release(errstr); + zend_string_release_ex(errstr, 0); } } /* }}} */ @@ -331,7 +331,7 @@ PHP_FUNCTION(stream_socket_get_name) } if ((ZSTR_LEN(name) == 0) || (ZSTR_VAL(name)[0] == 0)) { - zend_string_release(name); + zend_string_release_ex(name, 0); RETURN_FALSE; } diff --git a/ext/standard/string.c b/ext/standard/string.c index f43d44929b..ca432c76d6 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1263,7 +1263,7 @@ PHPAPI void php_implode(const zend_string *glue, zval *pieces, zval *return_valu cptr -= ZSTR_LEN(ptr->str); memcpy(cptr, ZSTR_VAL(ptr->str), ZSTR_LEN(ptr->str)); if (ptr->lval) { - zend_string_release(ptr->str); + zend_string_release_ex(ptr->str, 0); } } else { char *oldPtr = cptr; @@ -1750,7 +1750,7 @@ PHP_FUNCTION(pathinfo) } if (ret) { - zend_string_release(ret); + zend_string_release_ex(ret, 0); } if (opt == PHP_PATHINFO_ALL) { @@ -2064,9 +2064,9 @@ PHP_FUNCTION(stripos) RETVAL_FALSE; } - zend_string_release(haystack_dup); + zend_string_release_ex(haystack_dup, 0); if (needle_dup) { - zend_string_release(needle_dup); + zend_string_release_ex(needle_dup, 0); } } /* }}} */ @@ -2205,7 +2205,7 @@ PHP_FUNCTION(strripos) haystack_dup = php_string_tolower(haystack); if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { - zend_string_release(haystack_dup); + zend_string_release_ex(haystack_dup, 0); ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; @@ -2214,7 +2214,7 @@ PHP_FUNCTION(strripos) e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack); } else { if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { - zend_string_release(haystack_dup); + zend_string_release_ex(haystack_dup, 0); ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; @@ -2230,12 +2230,12 @@ PHP_FUNCTION(strripos) needle_dup = php_string_tolower(needle); if ((found = (char *)zend_memnrstr(p, ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), e))) { RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); - zend_string_release(needle_dup); - zend_string_release(haystack_dup); + zend_string_release_ex(needle_dup, 0); + zend_string_release_ex(haystack_dup, 0); ZSTR_ALLOCA_FREE(ord_needle, use_heap); } else { - zend_string_release(needle_dup); - zend_string_release(haystack_dup); + zend_string_release_ex(needle_dup, 0); + zend_string_release_ex(haystack_dup, 0); ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } @@ -3061,7 +3061,7 @@ static void php_strtr_array(zval *return_value, zend_string *input, HashTable *p } zend_hash_add(&str_hash, key_used, entry); if (UNEXPECTED(!str_key)) { - zend_string_release(key_used); + zend_string_release_ex(key_used, 0); } } ZEND_HASH_FOREACH_END(); pats = &str_hash; @@ -3297,7 +3297,7 @@ static zend_string *php_str_to_str_i_ex(zend_string *haystack, const char *lc_ha memcpy(ZSTR_VAL(new_str) + (r - lc_haystack), str, str_len); (*replace_count)++; } - zend_string_release(lc_needle); + zend_string_release_ex(lc_needle, 0); if (!new_str) { goto nothing_todo; @@ -3318,7 +3318,7 @@ static zend_string *php_str_to_str_i_ex(zend_string *haystack, const char *lc_ha } if (count == 0) { /* Needle doesn't occur, shortcircuit the actual replacement. */ - zend_string_release(lc_needle); + zend_string_release_ex(lc_needle, 0); goto nothing_todo; } @@ -3345,7 +3345,7 @@ static zend_string *php_str_to_str_i_ex(zend_string *haystack, const char *lc_ha } *e = '\0'; - zend_string_release(lc_needle); + zend_string_release_ex(lc_needle, 0); return new_str; } @@ -3356,10 +3356,10 @@ nothing_todo: lc_needle = php_string_tolower(needle); if (memcmp(lc_haystack, ZSTR_VAL(lc_needle), ZSTR_LEN(lc_needle))) { - zend_string_release(lc_needle); + zend_string_release_ex(lc_needle, 0); goto nothing_todo; } - zend_string_release(lc_needle); + zend_string_release_ex(lc_needle, 0); new_str = zend_string_init(str, str_len, 0); @@ -3844,7 +3844,7 @@ PHPAPI zend_string *php_addcslashes(zend_string *str, int should_free, char *wha new_str = zend_string_truncate(new_str, newlen, 0); } if (should_free) { - zend_string_release(str); + zend_string_release_ex(str, 0); } return new_str; } @@ -4040,7 +4040,7 @@ do_escape: *target = '\0'; if (should_free) { - zend_string_release(str); + zend_string_release_ex(str, 0); } if (ZSTR_LEN(new_str) - (target - ZSTR_VAL(new_str)) > 16) { @@ -4119,7 +4119,7 @@ do_escape: *target = '\0'; if (should_free) { - zend_string_release(str); + zend_string_release_ex(str, 0); } if (ZSTR_LEN(new_str) - (target - ZSTR_VAL(new_str)) > 16) { @@ -4330,7 +4330,7 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s case_sensitivity, &replace_count); if (lc_subject_str && replace_count != old_replace_count) { - zend_string_release(lc_subject_str); + zend_string_release_ex(lc_subject_str, 0); lc_subject_str = NULL; } } else if (ZSTR_LEN(search_str) > 1) { @@ -4347,7 +4347,7 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s tmp_result = php_str_to_str_i_ex(Z_STR_P(result), ZSTR_VAL(lc_subject_str), search_str, replace_value, replace_len, &replace_count); if (replace_count != old_replace_count) { - zend_string_release(lc_subject_str); + zend_string_release_ex(lc_subject_str, 0); lc_subject_str = NULL; } } @@ -4356,22 +4356,22 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s zend_tmp_string_release(tmp_search_str); if (tmp_replace_entry_str) { - zend_string_release(tmp_replace_entry_str); + zend_string_release_ex(tmp_replace_entry_str, 0); tmp_replace_entry_str = NULL; } - zend_string_release(Z_STR_P(result)); + zend_string_release_ex(Z_STR_P(result), 0); ZVAL_STR(result, tmp_result); if (Z_STRLEN_P(result) == 0) { if (lc_subject_str) { - zend_string_release(lc_subject_str); + zend_string_release_ex(lc_subject_str, 0); } zend_tmp_string_release(tmp_subject_str); return replace_count; } } ZEND_HASH_FOREACH_END(); if (lc_subject_str) { - zend_string_release(lc_subject_str); + zend_string_release_ex(lc_subject_str, 0); } } else { ZEND_ASSERT(Z_TYPE_P(search) == IS_STRING); @@ -4393,7 +4393,7 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s ZVAL_STR(result, php_str_to_str_i_ex(subject_str, ZSTR_VAL(lc_subject_str), Z_STR_P(search), Z_STRVAL_P(replace), Z_STRLEN_P(replace), &replace_count)); - zend_string_release(lc_subject_str); + zend_string_release_ex(lc_subject_str, 0); } } else { ZVAL_STR_COPY(result, subject_str); @@ -4646,7 +4646,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) if (convert_newlines) { RETVAL_STR(php_char_to_str_ex(broken_str, '\n', "<br />\n", 7, 1, NULL)); - zend_string_release(broken_str); + zend_string_release_ex(broken_str, 0); } else { RETURN_NEW_STR(broken_str); } @@ -4819,12 +4819,12 @@ PHP_FUNCTION(setlocale) loc = zval_get_string(plocale); if (!strcmp("0", ZSTR_VAL(loc))) { - zend_string_release(loc); + zend_string_release_ex(loc, 0); loc = NULL; } else { if (ZSTR_LEN(loc) >= 255) { php_error_docref(NULL, E_WARNING, "Specified locale name is too long"); - zend_string_release(loc); + zend_string_release_ex(loc, 0); break; } } @@ -4839,25 +4839,25 @@ PHP_FUNCTION(setlocale) BG(locale_changed) = 1; if (cat == LC_CTYPE || cat == LC_ALL) { if (BG(locale_string)) { - zend_string_release(BG(locale_string)); + zend_string_release_ex(BG(locale_string), 0); } if (len == ZSTR_LEN(loc) && !memcmp(ZSTR_VAL(loc), retval, len)) { BG(locale_string) = zend_string_copy(loc); RETURN_STR(BG(locale_string)); } else { BG(locale_string) = zend_string_init(retval, len, 0); - zend_string_release(loc); + zend_string_release_ex(loc, 0); RETURN_STR_COPY(BG(locale_string)); } } else if (len == ZSTR_LEN(loc) && !memcmp(ZSTR_VAL(loc), retval, len)) { RETURN_STR(loc); } - zend_string_release(loc); + zend_string_release_ex(loc, 0); } RETURN_STRING(retval); } if (loc) { - zend_string_release(loc); + zend_string_release_ex(loc, 0); } if (Z_TYPE(args[0]) == IS_ARRAY) { diff --git a/ext/standard/url.c b/ext/standard/url.c index 58c5c4b91d..d5ca21b650 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -42,19 +42,19 @@ PHPAPI void php_url_free(php_url *theurl) { if (theurl->scheme) - zend_string_release(theurl->scheme); + zend_string_release_ex(theurl->scheme, 0); if (theurl->user) - zend_string_release(theurl->user); + zend_string_release_ex(theurl->user, 0); if (theurl->pass) - zend_string_release(theurl->pass); + zend_string_release_ex(theurl->pass, 0); if (theurl->host) - zend_string_release(theurl->host); + zend_string_release_ex(theurl->host, 0); if (theurl->path) - zend_string_release(theurl->path); + zend_string_release_ex(theurl->path, 0); if (theurl->query) - zend_string_release(theurl->query); + zend_string_release_ex(theurl->query, 0); if (theurl->fragment) - zend_string_release(theurl->fragment); + zend_string_release_ex(theurl->fragment, 0); efree(theurl); } /* }}} */ diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index 54995dc0b1..ace561cf30 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -99,7 +99,7 @@ static int php_ini_on_update_tags(zend_ini_entry *entry, zend_string *new_value, str = zend_string_init(key, keylen, 1); GC_MAKE_PERSISTENT_LOCAL(str); zend_hash_add_mem(ctx->tags, str, val, strlen(val)+1); - zend_string_release(str); + zend_string_release_ex(str, 1); } } @@ -148,7 +148,7 @@ static int php_ini_on_update_hosts(zend_ini_entry *entry, zend_string *new_value if (keylen > 0) { tmp_key = zend_string_init(key, keylen, 0); zend_hash_add_empty_element(hosts, tmp_key); - zend_string_release(tmp_key); + zend_string_release_ex(tmp_key, 0); } } efree(tmp); @@ -216,12 +216,12 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st if (url_parts->host) { zend_string *tmp = zend_string_tolower(url_parts->host); if (!zend_hash_exists(&BG(url_adapt_session_hosts_ht), tmp)) { - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); smart_str_append_smart_str(dest, url); php_url_free(url_parts); return; } - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); } /* @@ -366,10 +366,10 @@ static int check_http_host(char *target) ZSTR_VAL(host_tmp)[ZSTR_LEN(host_tmp)] = '\0'; } if (!strcasecmp(ZSTR_VAL(host_tmp), target)) { - zend_string_release(host_tmp); + zend_string_release_ex(host_tmp, 0); return SUCCESS; } - zend_string_release(host_tmp); + zend_string_release_ex(host_tmp, 0); } return FAILURE; } diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 68edab084a..f54cdfc907 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -97,7 +97,7 @@ static int php_ini_on_update_tags(zend_ini_entry *entry, zend_string *new_value, str = zend_string_init(key, keylen, 1); GC_MAKE_PERSISTENT_LOCAL(str); zend_hash_add_mem(ctx->tags, str, val, strlen(val)+1); - zend_string_release(str); + zend_string_release_ex(str, 1); } } @@ -146,7 +146,7 @@ static int php_ini_on_update_hosts(zend_ini_entry *entry, zend_string *new_value if (keylen > 0) { tmp_key = zend_string_init(key, keylen, 0); zend_hash_add_empty_element(hosts, tmp_key); - zend_string_release(tmp_key); + zend_string_release_ex(tmp_key, 0); } } efree(tmp); @@ -219,12 +219,12 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st if (url_parts->host) { zend_string *tmp = zend_string_tolower(url_parts->host); if (!zend_hash_exists(&BG(url_adapt_session_hosts_ht), tmp)) { - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); smart_str_append_smart_str(dest, url); php_url_free(url_parts); return; } - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); } /* @@ -369,10 +369,10 @@ static int check_http_host(char *target) ZSTR_VAL(host_tmp)[ZSTR_LEN(host_tmp)] = '\0'; } if (!strcasecmp(ZSTR_VAL(host_tmp), target)) { - zend_string_release(host_tmp); + zend_string_release_ex(host_tmp, 0); return SUCCESS; } - zend_string_release(host_tmp); + zend_string_release_ex(host_tmp, 0); } return FAILURE; } diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 01bc6e4021..ac7f40f374 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -387,7 +387,7 @@ static const php_stream_filter_factory user_filter_factory = { static void filter_item_dtor(zval *zv) { struct php_user_filter_data *fdat = Z_PTR_P(zv); - zend_string_release(fdat->classname); + zend_string_release_ex(fdat->classname, 0); efree(fdat); } @@ -590,7 +590,7 @@ PHP_FUNCTION(stream_filter_register) php_stream_filter_register_factory_volatile(filtername, &user_filter_factory) == SUCCESS) { RETVAL_TRUE; } else { - zend_string_release(classname); + zend_string_release_ex(classname, 0); efree(fdat); } } diff --git a/ext/standard/var.c b/ext/standard/var.c index 643e1eaf84..c6465fb893 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -150,7 +150,7 @@ again: myht = Z_OBJDEBUG_P(struc, is_temp); class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc)); php_printf("%sobject(%s)#%d (%d) {\n", COMMON, ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(struc), myht ? zend_array_count(myht) : 0); - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); if (myht) { zend_ulong num; @@ -321,7 +321,7 @@ again: } class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc)); php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", COMMON, ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(struc), myht ? zend_array_count(myht) : 0, Z_REFCOUNT_P(struc)); - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); if (myht) { ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, val) { zval_object_property_dump(val, index, key, level); @@ -425,7 +425,7 @@ static void php_object_element_export(zval *zv, zend_ulong index, zend_string *k smart_str_appendc(buf, '\''); smart_str_append(buf, pname_esc); smart_str_appendc(buf, '\''); - zend_string_release(pname_esc); + zend_string_release_ex(pname_esc, 0); } else { smart_str_append_long(buf, (zend_long) index); } @@ -1094,7 +1094,7 @@ PHP_FUNCTION(unserialize) convert_to_string_ex(entry); lcname = zend_string_tolower(Z_STR_P(entry)); zend_hash_add_empty_element(class_hash, lcname); - zend_string_release(lcname); + zend_string_release_ex(lcname, 0); } ZEND_HASH_FOREACH_END(); } php_var_unserialize_set_allowed_classes(var_hash, class_hash); diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index b6b3f57db1..e4b8321e63 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -458,7 +458,7 @@ string_key: if (existing_propinfo->flags & ZEND_ACC_PROTECTED) { new_key = zend_mangle_property_name( "*", 1, ZSTR_VAL(unmangled), ZSTR_LEN(unmangled), 0); - zend_string_release(unmangled); + zend_string_release_ex(unmangled, 0); } else if (existing_propinfo->flags & ZEND_ACC_PRIVATE) { if (unmangled_class != NULL && strcmp(unmangled_class, "*") != 0) { new_key = zend_mangle_property_name( @@ -471,15 +471,15 @@ string_key: ZSTR_VAL(unmangled), ZSTR_LEN(unmangled), 0); } - zend_string_release(unmangled); + zend_string_release_ex(unmangled, 0); } else { ZEND_ASSERT(existing_propinfo->flags & ZEND_ACC_PUBLIC); new_key = unmangled; } - zend_string_release(Z_STR(key)); + zend_string_release_ex(Z_STR(key), 0); ZVAL_STR(&key, new_key); } else { - zend_string_release(unmangled); + zend_string_release_ex(unmangled, 0); } } @@ -1231,7 +1231,7 @@ yy78: if (ce) { BG(serialize_lock)--; if (EG(exception)) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return 0; } break; @@ -1239,7 +1239,7 @@ yy78: BG(serialize_lock)--; if (EG(exception)) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return 0; } @@ -1258,7 +1258,7 @@ yy78: if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL) != SUCCESS) { BG(serialize_lock)--; if (EG(exception)) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); return 0; @@ -1273,7 +1273,7 @@ yy78: BG(serialize_lock)--; zval_ptr_dtor(&retval); if (EG(exception)) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); return 0; @@ -1303,21 +1303,21 @@ yy78: if (ret && incomplete_class) { php_store_class_name(rval, ZSTR_VAL(class_name), len2); } - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return ret; } elements = object_common1(UNSERIALIZE_PASSTHRU, ce); if (elements < 0) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return 0; } if (incomplete_class) { php_store_class_name(rval, ZSTR_VAL(class_name), len2); } - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return object_common2(UNSERIALIZE_PASSTHRU, elements); } diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 8e238dae6e..0af53592d4 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -462,7 +462,7 @@ string_key: if (existing_propinfo->flags & ZEND_ACC_PROTECTED) { new_key = zend_mangle_property_name( "*", 1, ZSTR_VAL(unmangled), ZSTR_LEN(unmangled), 0); - zend_string_release(unmangled); + zend_string_release_ex(unmangled, 0); } else if (existing_propinfo->flags & ZEND_ACC_PRIVATE) { if (unmangled_class != NULL && strcmp(unmangled_class, "*") != 0) { new_key = zend_mangle_property_name( @@ -475,15 +475,15 @@ string_key: ZSTR_VAL(unmangled), ZSTR_LEN(unmangled), 0); } - zend_string_release(unmangled); + zend_string_release_ex(unmangled, 0); } else { ZEND_ASSERT(existing_propinfo->flags & ZEND_ACC_PUBLIC); new_key = unmangled; } - zend_string_release(Z_STR(key)); + zend_string_release_ex(Z_STR(key), 0); ZVAL_STR(&key, new_key); } else { - zend_string_release(unmangled); + zend_string_release_ex(unmangled, 0); } } @@ -971,7 +971,7 @@ object ":" uiv ":" ["] { if (ce) { BG(serialize_lock)--; if (EG(exception)) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return 0; } break; @@ -979,7 +979,7 @@ object ":" uiv ":" ["] { BG(serialize_lock)--; if (EG(exception)) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return 0; } @@ -998,7 +998,7 @@ object ":" uiv ":" ["] { if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL) != SUCCESS) { BG(serialize_lock)--; if (EG(exception)) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); return 0; @@ -1013,7 +1013,7 @@ object ":" uiv ":" ["] { BG(serialize_lock)--; zval_ptr_dtor(&retval); if (EG(exception)) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); return 0; @@ -1043,21 +1043,21 @@ object ":" uiv ":" ["] { if (ret && incomplete_class) { php_store_class_name(rval, ZSTR_VAL(class_name), len2); } - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return ret; } elements = object_common1(UNSERIALIZE_PASSTHRU, ce); if (elements < 0) { - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return 0; } if (incomplete_class) { php_store_class_name(rval, ZSTR_VAL(class_name), len2); } - zend_string_release(class_name); + zend_string_release_ex(class_name, 0); return object_common2(UNSERIALIZE_PASSTHRU, elements); } diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 61fd0f32cb..365d037eb5 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -653,7 +653,7 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil } if (is_file) { - zend_string_release(data); + zend_string_release_ex(data, 0); } tidyBufFree(errbuf); @@ -1316,7 +1316,7 @@ static PHP_FUNCTION(tidy_parse_file) RETVAL_FALSE; } - zend_string_release(contents); + zend_string_release_ex(contents, 0); } /* }}} */ @@ -1635,7 +1635,7 @@ static TIDY_DOC_METHOD(__construct) php_tidy_parse_string(obj, ZSTR_VAL(contents), (uint32_t)ZSTR_LEN(contents), enc); - zend_string_release(contents); + zend_string_release_ex(contents, 0); } } @@ -1675,7 +1675,7 @@ static TIDY_DOC_METHOD(parseFile) RETVAL_TRUE; } - zend_string_release(contents); + zend_string_release_ex(contents, 0); } static TIDY_DOC_METHOD(parseString) diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index a4cc6dd293..dd16313bbb 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -318,7 +318,7 @@ PS_SERIALIZER_DECODE_FUNC(wddx) Z_TRY_ADDREF_P(ent); } PS_ADD_VAR(key); - zend_string_release(key); + zend_string_release_ex(key, 0); } ZEND_HASH_FOREACH_END(); } @@ -375,7 +375,7 @@ void php_wddx_packet_start(wddx_packet *packet, char *comment, size_t comment_le php_wddx_add_chunk_static(packet, WDDX_COMMENT_E); php_wddx_add_chunk_static(packet, WDDX_HEADER_E); - zend_string_release(escaped); + zend_string_release_ex(escaped, 0); } else { php_wddx_add_chunk_static(packet, WDDX_HEADER); } @@ -410,7 +410,7 @@ static void php_wddx_serialize_string(wddx_packet *packet, zval *var) php_wddx_add_chunk_ex(packet, ZSTR_VAL(buf), ZSTR_LEN(buf)); - zend_string_release(buf); + zend_string_release_ex(buf, 0); } php_wddx_add_chunk_static(packet, WDDX_STRING_E); } @@ -423,7 +423,7 @@ static void php_wddx_serialize_number(wddx_packet *packet, zval *var) char tmp_buf[WDDX_BUF_LEN], *dec_point; zend_string *str = zval_get_string_func(var); snprintf(tmp_buf, sizeof(tmp_buf), WDDX_NUMBER, ZSTR_VAL(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); dec_point = strchr(tmp_buf, ','); if (dec_point) { @@ -523,11 +523,11 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_name_len); tmp = zend_string_init(prop_name, prop_name_len, 0); php_wddx_serialize_var(packet, ent, tmp); - zend_string_release(tmp); + zend_string_release_ex(tmp, 0); } else { key = zend_long_to_str(idx); php_wddx_serialize_var(packet, ent, key); - zend_string_release(key); + zend_string_release_ex(key, 0); } } ZEND_HASH_FOREACH_END(); php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); @@ -584,7 +584,7 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) } else { key = zend_long_to_str(idx); php_wddx_serialize_var(packet, ent, key); - zend_string_release(key); + zend_string_release_ex(key, 0); } } else { php_wddx_serialize_var(packet, ent, NULL); @@ -612,7 +612,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name) snprintf(tmp_buf, ZSTR_LEN(name_esc) + sizeof(WDDX_VAR_S), WDDX_VAR_S, ZSTR_VAL(name_esc)); php_wddx_add_chunk(packet, tmp_buf); efree(tmp_buf); - zend_string_release(name_esc); + zend_string_release_ex(name_esc, 0); } if (Z_TYPE_P(var) == IS_INDIRECT) { @@ -1076,7 +1076,7 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) ZVAL_STR_COPY(&ent->data, str); } - zend_string_release(str); + zend_string_release_ex(str, 0); } break; diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 9f73be1a96..f927afd764 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -735,7 +735,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch attributes += 2; - zend_string_release(att); + zend_string_release_ex(att, 0); } xml_call_handler(parser, &parser->startElementHandler, parser->startElementPtr, 3, args, &retval); @@ -773,7 +773,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch atcnt++; attributes += 2; - zend_string_release(att); + zend_string_release_ex(att, 0); } if (atcnt) { @@ -788,7 +788,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch } } - zend_string_release(tag_name); + zend_string_release_ex(tag_name, 0); } } /* }}} */ @@ -831,7 +831,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name) parser->lastwasopen = 0; } - zend_string_release(tag_name); + zend_string_release_ex(tag_name, 0); if ((parser->ltags) && (parser->level <= XML_MAXLEVEL)) { efree(parser->ltags[parser->level-1]); @@ -887,7 +887,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) Z_STR_P(myval) = zend_string_extend(Z_STR_P(myval), newlen, 0); strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - ZSTR_LEN(decoded_value), ZSTR_VAL(decoded_value), ZSTR_LEN(decoded_value) + 1); - zend_string_release(decoded_value); + zend_string_release_ex(decoded_value, 0); } else { add_assoc_str(parser->ctag, "value", decoded_value); } @@ -904,7 +904,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) Z_STR_P(myval) = zend_string_extend(Z_STR_P(myval), newlen, 0); strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - ZSTR_LEN(decoded_value), ZSTR_VAL(decoded_value), ZSTR_LEN(decoded_value) + 1); - zend_string_release(decoded_value); + zend_string_release_ex(decoded_value, 0); return; } } @@ -928,7 +928,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) } } } else { - zend_string_release(decoded_value); + zend_string_release_ex(decoded_value, 0); } } } diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index c91ea2eaa9..a329cca29b 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -68,7 +68,7 @@ static void xmlreader_register_prop_handler(HashTable *prop_handler, char *name, hnd.type = rettype; str = zend_string_init_interned(name, strlen(name), 1); zend_hash_add_mem(prop_handler, str, &hnd, sizeof(xmlreader_prop_handler)); - zend_string_release(str); + zend_string_release_ex(str, 1); } /* }}} */ diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 96c5e1137d..0a35c5ea3f 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -518,7 +518,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep if (Z_TYPE(val) != IS_STRING) { zend_string *str = zval_get_string_func(&val); xReturn = XMLRPC_CreateValueBase64(key, ZSTR_VAL(str), ZSTR_LEN(str)); - zend_string_release(str); + zend_string_release_ex(str, 0); } else { xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRLEN(val)); } @@ -948,7 +948,7 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) } else { php_error_docref(NULL, E_WARNING, "Invalid callback '%s' passed", ZSTR_VAL(php_function_name)); } - zend_string_release(php_function_name); + zend_string_release_ex(php_function_name, 0); } ZEND_HASH_FOREACH_END(); /* so we don't call the same callbacks ever again */ diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index f155bda630..bde382ad1b 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -364,7 +364,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t zval_ptr_dtor(&retval); } } - zend_string_release(callable); + zend_string_release_ex(callable, 0); zval_ptr_dtor(&handler); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 815f64ecb4..a98c8cc555 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -191,7 +191,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname_fullpath)) { efree(file_dirname_fullpath); - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); CWD_STATE_FREE(new_state.cwd); return 0; } @@ -203,7 +203,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t if (!ret) { efree(file_dirname_fullpath); if (!is_dir_only) { - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); CWD_STATE_FREE(new_state.cwd); } return 0; @@ -220,13 +220,13 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t len = spprintf(&fullpath, 0, "%s/%s", file_dirname_fullpath, ZSTR_VAL(file_basename)); if (!len) { efree(file_dirname_fullpath); - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); CWD_STATE_FREE(new_state.cwd); return 0; } else if (len > MAXPATHLEN) { php_error_docref(NULL, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); efree(file_dirname_fullpath); - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); CWD_STATE_FREE(new_state.cwd); return 0; } @@ -238,7 +238,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t if (ZIP_OPENBASEDIR_CHECKPATH(fullpath)) { efree(fullpath); efree(file_dirname_fullpath); - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); CWD_STATE_FREE(new_state.cwd); return 0; } @@ -268,7 +268,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t done: efree(fullpath); - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); efree(file_dirname_fullpath); CWD_STATE_FREE(new_state.cwd); @@ -673,14 +673,14 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val if ((namelist_len == 1 && ZSTR_VAL(namelist[i])[0] == '.') || (namelist_len == 2 && ZSTR_VAL(namelist[i])[0] == '.' && ZSTR_VAL(namelist[i])[1] == '.')) { - zend_string_release(namelist[i]); + zend_string_release_ex(namelist[i], 0); continue; } if ((path_len + namelist_len + 1) >= MAXPATHLEN) { php_error_docref(NULL, E_WARNING, "add_path string too long (max: %u, %zu given)", MAXPATHLEN - 1, (path_len + namelist_len + 1)); - zend_string_release(namelist[i]); + zend_string_release_ex(namelist[i], 0); break; } @@ -688,31 +688,31 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val if (0 != VCWD_STAT(fullpath, &s)) { php_error_docref(NULL, E_WARNING, "Cannot read <%s>", fullpath); - zend_string_release(namelist[i]); + zend_string_release_ex(namelist[i], 0); continue; } if (S_IFDIR == (s.st_mode & S_IFMT)) { - zend_string_release(namelist[i]); + zend_string_release_ex(namelist[i], 0); continue; } match_data = php_pcre_create_match_data(capture_count, re); if (!match_data) { /* Allocation failed, but can proceed to the next pattern. */ - zend_string_release(namelist[i]); + zend_string_release_ex(namelist[i], 0); continue; } rc = pcre2_match(re, (PCRE2_SPTR)ZSTR_VAL(namelist[i]), ZSTR_LEN(namelist[i]), 0, preg_options, match_data, mctx); php_pcre_free_match_data(match_data); /* 0 means that the vector is too small to hold all the captured substring offsets */ if (rc < 0) { - zend_string_release(namelist[i]); + zend_string_release_ex(namelist[i], 0); continue; } add_next_index_string(return_value, fullpath); - zend_string_release(namelist[i]); + zend_string_release_ex(namelist[i], 0); } efree(namelist); } @@ -820,7 +820,7 @@ static void php_zip_register_prop_handler(HashTable *prop_handler, char *name, z /* Register for reflection */ ZVAL_NULL(&tmp); zend_declare_property_ex(zip_class_entry, str, &tmp, ZEND_ACC_PUBLIC, NULL); - zend_string_release(str); + zend_string_release_ex(str, 1); } /* }}} */ @@ -1760,7 +1760,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* entry_name = entry_name_buf; entry_name_len = strlen(entry_name); if (basename) { - zend_string_release(basename); + zend_string_release_ex(basename, 0); basename = NULL; } diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index 00caae6ccb..331ff4d9b1 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -161,7 +161,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ fragment++; if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) { - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); return -1; } @@ -170,7 +170,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ memset(ssb, 0, sizeof(php_stream_statbuf)); if (zip_stat(za, fragment, ZIP_FL_NOCASE, &sb) != 0) { zip_close(za); - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); return -1; } zip_close(za); @@ -194,7 +194,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ #endif ssb->sb.st_ino = -1; } - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); return 0; } /* }}} */ @@ -306,7 +306,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, fragment++; if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) { - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); return NULL; } @@ -338,7 +338,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, } } - zend_string_release(file_basename); + zend_string_release_ex(file_basename, 0); if (!stream) { return NULL; diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index dd38fa6857..a5028a72b0 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -811,7 +811,7 @@ static zend_bool zlib_create_dictionary_string(HashTable *options, char **dict, memcpy(dictptr, ZSTR_VAL(*ptr), ZSTR_LEN(*ptr)); dictptr += ZSTR_LEN(*ptr); *dictptr++ = 0; - zend_string_release(*ptr); + zend_string_release_ex(*ptr, 0); } while (++ptr != end); efree(strings); } @@ -995,7 +995,7 @@ PHP_FUNCTION(inflate_add) case Z_DATA_ERROR: php_error_docref(NULL, E_WARNING, "dictionary does not match expected dictionary (incorrect adler32 hash)"); efree(php_ctx->inflateDict); - zend_string_release(out); + zend_string_release_ex(out, 0); php_ctx->inflateDict = NULL; RETURN_FALSE; EMPTY_SWITCH_DEFAULT_CASE() @@ -1006,7 +1006,7 @@ PHP_FUNCTION(inflate_add) RETURN_FALSE; } default: - zend_string_release(out); + zend_string_release_ex(out, 0); php_error_docref(NULL, E_WARNING, "%s", zError(status)); RETURN_FALSE; } @@ -1238,7 +1238,7 @@ PHP_FUNCTION(deflate_add) RETURN_STR(out); break; default: - zend_string_release(out); + zend_string_release_ex(out, 0); php_error_docref(NULL, E_WARNING, "zlib error (%s)", zError(status)); RETURN_FALSE; } |