Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/Optimizer/compact_literals.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx

#if DEBUG_COMPACT_LITERALS
{
fprintf(stderr, "File %s func %s\n", op_array->filename->val,
op_array->function_name ? op_array->function_name->val : "main");
fprintf(stderr, "File %s func %s\n", ZSTR_VAL(op_array->filename),
op_array->function_name ? ZSTR_VAL(op_array->function_name) : "main");
fprintf(stderr, "Literals table size %d\n", op_array->last_literal);

for (uint32_t i = 0; i < op_array->last_literal; i++) {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static void gc_trace_ref(zend_refcounted *ref) {
fprintf(stderr, "[%p] rc=%d addr=%d %s object(%s)#%d ",
ref, GC_REFCOUNT(ref), GC_REF_ADDRESS(ref),
gc_color_name(GC_REF_COLOR(ref)),
obj->ce->name->val, obj->handle);
ZSTR_VAL(obj->ce->name), obj->handle);
} else if (GC_TYPE(ref) == IS_ARRAY) {
zend_array *arr = (zend_array *) ref;
fprintf(stderr, "[%p] rc=%d addr=%d %s array(%d) ",
Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ zend_result php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_fu
if (FAILED(hr)) {
char *msg = NULL;
char *winerr = php_win32_error_to_msg(hr);
spprintf(&msg, 0, "Unable to lookup `%s': %s", f->function_name->val, winerr);
spprintf(&msg, 0, "Unable to lookup `%s': %s", ZSTR_VAL(f->function_name), winerr);
php_win32_error_msg_free(winerr);
php_com_throw_exception(hr, msg);
efree(msg);
Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
char *typelib_name_buffer;
char *strtok_buf = NULL;

if (NULL == new_value || !new_value->val[0] || (typelib_file = VCWD_FOPEN(new_value->val, "r"))==NULL) {
if (NULL == new_value || !ZSTR_VAL(new_value)[0] || (typelib_file = VCWD_FOPEN(ZSTR_VAL(new_value), "r"))==NULL) {
return FAILURE;
}

Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
int i;

if (SUCCEEDED(ITypeInfo_GetTypeComp(obj->typeinfo, &comp))) {
olename = php_com_string_to_olestring(name->val, name->len, obj->code_page);
olename = php_com_string_to_olestring(ZSTR_VAL(name), ZSTR_LEN(name), obj->code_page);
lhash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, olename);

if (SUCCEEDED(ITypeComp_Bind(comp, olename, lhash, INVOKE_FUNC, &TI, &kind, &bindptr))) {
Expand Down
2 changes: 1 addition & 1 deletion ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, bool gmt)
/* VS2012 strftime() returns number of characters, not bytes.
See VC++11 bug id 766205. */
if (real_len > 0) {
real_len = strlen(buf->val);
real_len = strlen(ZSTR_VAL(buf));
}
#endif

Expand Down
24 changes: 12 additions & 12 deletions ext/intl/locale/locale_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, const char* key
if( result > 0 && key_value){
int cnt = 0;
/* Tokenize on the "_" or "-" */
token = php_strtok_r( key_value->val , DELIMITER ,&last_ptr);
token = php_strtok_r( ZSTR_VAL(key_value) , DELIMITER ,&last_ptr);
/* Over-allocates a few bytes for the integer so we don't have to reallocate. */
size_t cur_key_name_size = (sizeof("-2147483648") - 1) + strlen(key_name) + 1;
cur_key_name.reset(reinterpret_cast<char *>(emalloc(cur_key_name_size)));
Expand Down Expand Up @@ -1242,7 +1242,7 @@ PHP_INTL_FUNCTION_WITH_ERROR_RESET(locale_get_all_variants)
variant = get_icu_value_internal( loc_name , LOC_VARIANT_TAG , &result ,0);
if( result > 0 && variant){
/* Tokenize on the "_" or "-" */
token = php_strtok_r( variant->val , DELIMITER , &saved_ptr);
token = php_strtok_r( ZSTR_VAL(variant) , DELIMITER , &saved_ptr);
add_next_index_stringl( return_value, token , strlen(token));
/* tokenize on the "_" or "-" and stop at singleton if any */
while( (token = php_strtok_r(nullptr , DELIMITER, &saved_ptr)) && (strlen(token)>1) ){
Expand Down Expand Up @@ -1348,19 +1348,19 @@ PHP_INTL_FUNCTION_WITH_ERROR_RESET(locale_filter_matches)
}

/* Convert to lower case for case-insensitive comparison */
cur_lang_tag = std::unique_ptr<char, char_deleter>(reinterpret_cast<char *>(ecalloc(can_lang_tag->len + 1, sizeof(char))));
cur_lang_tag = std::unique_ptr<char, char_deleter>(reinterpret_cast<char *>(ecalloc(ZSTR_LEN(can_lang_tag) + 1, sizeof(char))));
char *p_cur_lang_tag = cur_lang_tag.get();

/* Convert to lower case for case-insensitive comparison */
result = strToMatch( can_lang_tag->val , p_cur_lang_tag);
result = strToMatch( ZSTR_VAL(can_lang_tag) , p_cur_lang_tag);
if( result == 0) {
zend_string_release_ex( can_lang_tag, false );
RETURN_FALSE;
}

cur_loc_range = std::unique_ptr<char, char_deleter>(reinterpret_cast<char *>(ecalloc(can_loc_range->len + 1, sizeof(char))));
cur_loc_range = std::unique_ptr<char, char_deleter>(reinterpret_cast<char *>(ecalloc(ZSTR_LEN(can_loc_range) + 1, sizeof(char))));
char *p_cur_loc_range = cur_loc_range.get();
result = strToMatch( can_loc_range->val , p_cur_loc_range );
result = strToMatch( ZSTR_VAL(can_loc_range) , p_cur_loc_range );
if( result == 0) {
zend_string_release_ex( can_lang_tag, false );
zend_string_release_ex( can_loc_range, false );
Expand All @@ -1372,7 +1372,7 @@ PHP_INTL_FUNCTION_WITH_ERROR_RESET(locale_filter_matches)

if( token && (token==p_cur_lang_tag) ){
/* check if the char. after match is SEPARATOR */
chrcheck = token + can_loc_range->len;
chrcheck = token + ZSTR_LEN(can_loc_range);
if( isIDSeparator(*chrcheck) || isKeywordSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
zend_string_release_ex( can_lang_tag, false );
zend_string_release_ex( can_loc_range, false );
Expand Down Expand Up @@ -1479,15 +1479,15 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr,
if(canonicalize) {
for(i=0; i<cur_arr_len; i++) {
lang_tag = get_icu_value_internal(cur_arr[i*2], LOC_CANONICALIZE_TAG, &result, 0);
if(result != 1 || lang_tag == nullptr || !lang_tag->val[0]) {
if(result != 1 || lang_tag == nullptr || !ZSTR_VAL(lang_tag)[0]) {
if(lang_tag) {
zend_string_release_ex(lang_tag, 0);
}
intl_error_set(nullptr, U_ILLEGAL_ARGUMENT_ERROR, "unable to canonicalize lang_tag");
LOOKUP_CLEAN_RETURN(nullptr);
}
cur_arr[i*2] = reinterpret_cast<char *>(erealloc(cur_arr[i*2], lang_tag->len+1));
result = strToMatch(lang_tag->val, cur_arr[i*2]);
cur_arr[i*2] = reinterpret_cast<char *>(erealloc(cur_arr[i*2], ZSTR_LEN(lang_tag)+1));
result = strToMatch(ZSTR_VAL(lang_tag), cur_arr[i*2]);
zend_string_release_ex(lang_tag, 0);
if(result == 0) {
intl_error_set(nullptr, U_ILLEGAL_ARGUMENT_ERROR, "unable to canonicalize lang_tag");
Expand All @@ -1500,15 +1500,15 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr,
if(canonicalize) {
/* Canonicalize the loc_range */
can_loc_range = get_icu_value_internal(loc_range, LOC_CANONICALIZE_TAG, &result , 0);
if( result != 1 || can_loc_range == nullptr || !can_loc_range->val[0]) {
if( result != 1 || can_loc_range == nullptr || !ZSTR_VAL(can_loc_range)[0]) {
/* Error */
intl_error_set(nullptr, U_ILLEGAL_ARGUMENT_ERROR, "unable to canonicalize loc_range");
if(can_loc_range) {
zend_string_release_ex(can_loc_range, 0);
}
LOOKUP_CLEAN_RETURN(nullptr);
} else {
loc_range = can_loc_range->val;
loc_range = ZSTR_VAL(can_loc_range);
}
}

Expand Down
6 changes: 3 additions & 3 deletions ext/intl/timezone/timezone_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_windows_id)
ZEND_PARSE_PARAMETERS_END();

error = U_ZERO_ERROR;
if (intl_stringFromChar(uID, id->val, id->len, &error) == FAILURE) {
if (intl_stringFromChar(uID, ZSTR_VAL(id), ZSTR_LEN(id), &error) == FAILURE) {
intl_error_set(NULL, error,
"could not convert time zone id to UTF-16");
RETURN_FALSE;
Expand Down Expand Up @@ -619,14 +619,14 @@ U_CFUNC PHP_FUNCTION(intltz_get_id_for_windows_id)
ZEND_PARSE_PARAMETERS_END();

error = U_ZERO_ERROR;
if (intl_stringFromChar(uWinID, winID->val, winID->len, &error) == FAILURE) {
if (intl_stringFromChar(uWinID, ZSTR_VAL(winID), ZSTR_LEN(winID), &error) == FAILURE) {
intl_error_set(NULL, error,
"could not convert time zone id to UTF-16");
RETURN_FALSE;
}

error = U_ZERO_ERROR;
TimeZone::getIDForWindowsID(uWinID, region ? region->val : NULL, uID, error);
TimeZone::getIDForWindowsID(uWinID, region ? ZSTR_VAL(region) : NULL, uID, error);
INTL_CHECK_STATUS(error, "unable to get windows ID for timezone");
if (uID.length() == 0) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha
utc_base = (((unsigned __int64)utc_base_ft.dwHighDateTime) << 32) + utc_base_ft.dwLowDateTime;
}

if (file_handle->opened_path && GetFileAttributesEx(file_handle->opened_path->val, GetFileExInfoStandard, &fdata) != 0) {
if (file_handle->opened_path && GetFileAttributesEx(ZSTR_VAL(file_handle->opened_path), GetFileExInfoStandard, &fdata) != 0) {
unsigned __int64 ftime;

if (CompareFileTime (&fdata.ftLastWriteTime, &utc_base_ft) < 0) {
Expand Down
12 changes: 6 additions & 6 deletions ext/opcache/jit/zend_jit_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static zend_execute_data* ZEND_FASTCALL zend_jit_int_extend_stack_helper(uint32_
static zval* ZEND_FASTCALL zend_jit_symtable_find(HashTable *ht, zend_string *str)
{
zend_ulong idx;
register const char *tmp = str->val;
register const char *tmp = ZSTR_VAL(str);

do {
if (*tmp > '9') {
Expand All @@ -323,7 +323,7 @@ static zval* ZEND_FASTCALL zend_jit_symtable_find(HashTable *ht, zend_string *st
break;
}
}
if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
if (_zend_handle_numeric_str_ex(ZSTR_VAL(str), ZSTR_LEN(str), &idx)) {

@Girgias Girgias Nov 19, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should really be ZEND_HANDLE_NUMERIC, actually the whole code above could be replaced by an if/else with ZEND_HANDLE_NUMERIC.

return zend_hash_index_find(ht, idx);
}
} while (0);
Expand Down Expand Up @@ -367,7 +367,7 @@ static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *s
static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_string *str)
{
zend_ulong idx;
register const char *tmp = str->val;
register const char *tmp = ZSTR_VAL(str);
zval *retval;

do {
Expand All @@ -382,7 +382,7 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_strin
break;
}
}
if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
if (_zend_handle_numeric_str_ex(ZSTR_VAL(str), ZSTR_LEN(str), &idx)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

retval = zend_hash_index_find(ht, idx);
if (!retval) {
retval = zend_undefined_offset_write(ht, idx);
Expand All @@ -402,7 +402,7 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_strin
static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string *str)
{
zend_ulong idx;
register const char *tmp = str->val;
register const char *tmp = ZSTR_VAL(str);

do {
if (*tmp > '9') {
Expand All @@ -416,7 +416,7 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string
break;
}
}
if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
if (_zend_handle_numeric_str_ex(ZSTR_VAL(str), ZSTR_LEN(str), &idx)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

return zend_hash_index_lookup(ht, idx);
}
} while (0);
Expand Down
4 changes: 2 additions & 2 deletions ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ static ir_ref jit_EMALLOC(zend_jit_ctx *jit, size_t size, const zend_op_array *o
#if ZEND_DEBUG
return ir_CALL_5(IR_ADDR, ir_CONST_FC_FUNC(_emalloc),
ir_CONST_ADDR(size),
op_array->filename ? ir_CONST_ADDR(op_array->filename->val) : IR_NULL,
op_array->filename ? ir_CONST_ADDR(ZSTR_VAL(op_array->filename)) : IR_NULL,
ir_CONST_U32(opline ? opline->lineno : 0),
IR_NULL,
ir_CONST_U32(0));
Expand All @@ -908,7 +908,7 @@ static ir_ref jit_EFREE(zend_jit_ctx *jit, ir_ref ptr, size_t size, const zend_o
#if ZEND_DEBUG
return ir_CALL_5(IR_ADDR, ir_CONST_FC_FUNC(_efree),
ptr,
op_array && op_array->filename ? ir_CONST_ADDR(op_array->filename->val) : IR_NULL,
op_array && op_array->filename ? ir_CONST_ADDR(ZSTR_VAL(op_array->filename)) : IR_NULL,
ir_CONST_U32(opline ? opline->lineno : 0),
IR_NULL,
ir_CONST_U32(0));
Expand Down
12 changes: 6 additions & 6 deletions ext/soap/php_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ bool make_http_soap_request(
}
}
smart_str_append_const(&soap_headers,"Content-Length: ");
smart_str_append_long(&soap_headers, request->len);
smart_str_append_long(&soap_headers, ZSTR_LEN(request));
smart_str_append_const(&soap_headers, "\r\n");

/* HTTP Authentication */
Expand Down Expand Up @@ -1555,7 +1555,7 @@ static zend_string* get_http_body(php_stream *stream, bool close, zend_string *h
}

while (len_size < buf_size) {
ssize_t len_read = php_stream_read(stream, http_buf->val + http_buf_size, buf_size - len_size);
ssize_t len_read = php_stream_read(stream, ZSTR_VAL(http_buf) + http_buf_size, buf_size - len_size);
if (UNEXPECTED(len_read <= 0)) {
/* Error or EOF */
done = true;
Expand Down Expand Up @@ -1616,7 +1616,7 @@ static zend_string* get_http_body(php_stream *stream, bool close, zend_string *h
return NULL;
}
while (http_buf_size < header_length) {
ssize_t len_read = php_stream_read(stream, http_buf->val + http_buf_size, header_length - http_buf_size);
ssize_t len_read = php_stream_read(stream, ZSTR_VAL(http_buf) + http_buf_size, header_length - http_buf_size);
if (UNEXPECTED(len_read <= 0)) {
zend_string_efree(http_buf);
return NULL;
Expand All @@ -1640,7 +1640,7 @@ static zend_string* get_http_body(php_stream *stream, bool close, zend_string *h
} else {
http_buf = zend_string_alloc(4096, 0);
}
len_read = php_stream_read(stream, http_buf->val + http_buf_size, 4096);
len_read = php_stream_read(stream, ZSTR_VAL(http_buf) + http_buf_size, 4096);
if (len_read > 0) {
http_buf_size += len_read;
}
Expand All @@ -1649,8 +1649,8 @@ static zend_string* get_http_body(php_stream *stream, bool close, zend_string *h
return NULL;
}

http_buf->val[http_buf_size] = '\0';
http_buf->len = http_buf_size;
ZSTR_VAL(http_buf)[http_buf_size] = '\0';
ZSTR_LEN(http_buf) = http_buf_size;
return http_buf;
}

Expand Down
32 changes: 16 additions & 16 deletions ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ static zend_always_inline int php_array_key_compare_numeric_unstable_i(Bucket *f
} else {
double d1, d2;
if (f->key) {
d1 = zend_strtod(f->key->val, NULL);
d1 = zend_strtod(ZSTR_VAL(f->key), NULL);
} else {
d1 = (double)(zend_long)f->h;
}
if (s->key) {
d2 = zend_strtod(s->key->val, NULL);
d2 = zend_strtod(ZSTR_VAL(s->key), NULL);
} else {
d2 = (double)(zend_long)s->h;
}
Expand All @@ -171,15 +171,15 @@ static zend_always_inline int php_array_key_compare_string_case_unstable_i(Bucke
char buf2[MAX_LENGTH_OF_LONG + 1];

if (f->key) {
s1 = f->key->val;
l1 = f->key->len;
s1 = ZSTR_VAL(f->key);
l1 = ZSTR_LEN(f->key);
} else {
s1 = zend_print_long_to_buf(buf1 + sizeof(buf1) - 1, f->h);
l1 = buf1 + sizeof(buf1) - 1 - s1;
}
if (s->key) {
s2 = s->key->val;
l2 = s->key->len;
s2 = ZSTR_VAL(s->key);
l2 = ZSTR_LEN(s->key);
} else {
s2 = zend_print_long_to_buf(buf2 + sizeof(buf2) - 1, s->h);
l2 = buf2 + sizeof(buf2) - 1 - s2;
Expand All @@ -196,15 +196,15 @@ static zend_always_inline int php_array_key_compare_string_unstable_i(Bucket *f,
char buf2[MAX_LENGTH_OF_LONG + 1];

if (f->key) {
s1 = f->key->val;
l1 = f->key->len;
s1 = ZSTR_VAL(f->key);
l1 = ZSTR_LEN(f->key);
} else {
s1 = zend_print_long_to_buf(buf1 + sizeof(buf1) - 1, f->h);
l1 = buf1 + sizeof(buf1) - 1 - s1;
}
if (s->key) {
s2 = s->key->val;
l2 = s->key->len;
s2 = ZSTR_VAL(s->key);
l2 = ZSTR_LEN(s->key);
} else {
s2 = zend_print_long_to_buf(buf2 + sizeof(buf2) - 1, s->h);
l2 = buf2 + sizeof(buf2) - 1 - s2;
Expand All @@ -221,15 +221,15 @@ static int php_array_key_compare_string_natural_general(Bucket *f, Bucket *s, bo
char buf2[MAX_LENGTH_OF_LONG + 1];

if (f->key) {
s1 = f->key->val;
l1 = f->key->len;
s1 = ZSTR_VAL(f->key);
l1 = ZSTR_LEN(f->key);
} else {
s1 = zend_print_long_to_buf(buf1 + sizeof(buf1) - 1, f->h);
l1 = buf1 + sizeof(buf1) - 1 - s1;
}
if (s->key) {
s2 = s->key->val;
l2 = s->key->len;
s2 = ZSTR_VAL(s->key);
l2 = ZSTR_LEN(s->key);
} else {
s2 = zend_print_long_to_buf(buf2 + sizeof(buf2) - 1, s->h);
l2 = buf2 + sizeof(buf2) - 1 - s2;
Expand Down Expand Up @@ -269,12 +269,12 @@ static zend_always_inline int php_array_key_compare_string_locale_unstable_i(Buc
char buf2[MAX_LENGTH_OF_LONG + 1];

if (f->key) {
s1 = f->key->val;
s1 = ZSTR_VAL(f->key);
} else {
s1 = zend_print_long_to_buf(buf1 + sizeof(buf1) - 1, f->h);
}
if (s->key) {
s2 = s->key->val;
s2 = ZSTR_VAL(s->key);
} else {
s2 = zend_print_long_to_buf(buf2 + sizeof(buf2) - 1, s->h);
}
Expand Down
Loading