diff options
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/assert.c | 4 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 4 | ||||
-rw-r--r-- | ext/standard/browscap.c | 48 | ||||
-rw-r--r-- | ext/standard/crc32.c | 4 | ||||
-rw-r--r-- | ext/standard/cyr_convert.c | 4 | ||||
-rw-r--r-- | ext/standard/datetime.c | 128 | ||||
-rw-r--r-- | ext/standard/dir.c | 12 | ||||
-rw-r--r-- | ext/standard/dl.c | 14 | ||||
-rw-r--r-- | ext/standard/file.c | 2 | ||||
-rw-r--r-- | ext/standard/filestat.c | 76 | ||||
-rw-r--r-- | ext/standard/formatted_print.c | 20 | ||||
-rw-r--r-- | ext/standard/html.c | 8 | ||||
-rw-r--r-- | ext/standard/image.c | 2 | ||||
-rw-r--r-- | ext/standard/info.c | 24 | ||||
-rw-r--r-- | ext/standard/iptc.c | 20 | ||||
-rw-r--r-- | ext/standard/levenshtein.c | 8 | ||||
-rw-r--r-- | ext/standard/link.c | 2 | ||||
-rw-r--r-- | ext/standard/mail.c | 4 | ||||
-rw-r--r-- | ext/standard/md5.c | 2 | ||||
-rw-r--r-- | ext/standard/metaphone.c | 4 | ||||
-rw-r--r-- | ext/standard/microtime.c | 2 | ||||
-rw-r--r-- | ext/standard/pack.c | 4 | ||||
-rw-r--r-- | ext/standard/scanf.c | 6 | ||||
-rw-r--r-- | ext/standard/soundex.c | 12 | ||||
-rw-r--r-- | ext/standard/string.c | 124 | ||||
-rw-r--r-- | ext/standard/syslog.c | 6 | ||||
-rw-r--r-- | ext/standard/var.c | 20 |
27 files changed, 282 insertions, 282 deletions
diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 44545e181a..a7d3ac98a6 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -143,7 +143,7 @@ PHP_FUNCTION(assert) WRONG_PARAM_COUNT; } - if ((*assertion)->type == IS_STRING) { + if (Z_TYPE_PP(assertion) == IS_STRING) { zval retval; int old_error_reporting = 0; /* shut up gcc! */ @@ -233,7 +233,7 @@ PHP_FUNCTION(assert_options) convert_to_long_ex(what); - switch ((*what)->value.lval) { + switch (Z_LVAL_PP(what)) { case ASSERT_ACTIVE: oldint = ASSERTG(active); if (ac == 2) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index ef2fc7ca07..285a447938 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1413,9 +1413,9 @@ PHP_FUNCTION(gettype) char *result; int res_len; - res_len = sizeof("object of type ")-1 + arg->value.obj.ce->name_length; + res_len = sizeof("object of type ")-1 + Z_OBJCE_P(arg)->name_length; result = (char *) emalloc(res_len+1); - sprintf(result, "object of type %s", arg->value.obj.ce->name); + sprintf(result, "object of type %s", Z_OBJCE_P(arg)->name); RETVAL_STRINGL(result, res_len, 0); } */ diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 0e7e6813c1..fbd38f39f6 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -34,7 +34,7 @@ static zval *current_section; static void browscap_entry_dtor(zval *pvalue) { - if (pvalue->type == IS_OBJECT) { + if (Z_TYPE_P(pvalue) == IS_OBJECT) { zend_hash_destroy(Z_OBJPROP_P(pvalue)); free(Z_OBJPROP_P(pvalue)); } @@ -47,21 +47,21 @@ static void convert_browscap_pattern(zval *pattern) register int i, j; char *t; - for (i=0; i<pattern->value.str.len; i++) { - if (pattern->value.str.val[i]=='*' || pattern->value.str.val[i]=='?' || pattern->value.str.val[i]=='.') { + for (i=0; i<Z_STRLEN_P(pattern); i++) { + if (Z_STRVAL_P(pattern)[i]=='*' || Z_STRVAL_P(pattern)[i]=='?' || Z_STRVAL_P(pattern)[i]=='.') { break; } } - if (i==pattern->value.str.len) { /* no wildcards */ - pattern->value.str.val = zend_strndup(pattern->value.str.val, pattern->value.str.len); + if (i==Z_STRLEN_P(pattern)) { /* no wildcards */ + Z_STRVAL_P(pattern) = zend_strndup(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern)); return; } - t = (char *) malloc(pattern->value.str.len*2); + t = (char *) malloc(Z_STRLEN_P(pattern)*2); - for (i=0, j=0; i<pattern->value.str.len; i++, j++) { - switch (pattern->value.str.val[i]) { + for (i=0, j=0; i<Z_STRLEN_P(pattern); i++, j++) { + switch (Z_STRVAL_P(pattern)[i]) { case '?': t[j] = '.'; break; @@ -74,13 +74,13 @@ static void convert_browscap_pattern(zval *pattern) t[j] = '.'; break; default: - t[j] = pattern->value.str.val[i]; + t[j] = Z_STRVAL_P(pattern)[i]; break; } } t[j]=0; - pattern->value.str.val = t; - pattern->value.str.len = j; + Z_STRVAL_P(pattern) = t; + Z_STRLEN_P(pattern) = j; } /* }}} */ @@ -96,9 +96,9 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, int callback_type, vo new_property = (zval *) malloc(sizeof(zval)); INIT_PZVAL(new_property); - new_property->value.str.val = Z_STRLEN_P(arg2)?zend_strndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)):""; - new_property->value.str.len = Z_STRLEN_P(arg2); - new_property->type = IS_STRING; + Z_STRVAL_P(new_property) = Z_STRLEN_P(arg2)?zend_strndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)):""; + Z_STRLEN_P(new_property) = Z_STRLEN_P(arg2); + Z_TYPE_P(new_property) = IS_STRING; new_key = zend_strndup(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); zend_str_tolower(new_key, Z_STRLEN_P(arg1)); @@ -118,13 +118,13 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, int callback_type, vo /* OBJECTS_FIXME */ Z_OBJCE_P(current_section) = &zend_standard_class_def; Z_OBJPROP_P(current_section) = (HashTable *) malloc(sizeof(HashTable)); - current_section->type = IS_OBJECT; + Z_TYPE_P(current_section) = IS_OBJECT; zend_hash_init(Z_OBJPROP_P(current_section), 0, NULL, (dtor_func_t) browscap_entry_dtor, 1); zend_hash_update(&browser_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, (void *) ¤t_section, sizeof(zval *), NULL); - processed->value.str.val = Z_STRVAL_P(arg1); - processed->value.str.len = Z_STRLEN_P(arg1); - processed->type = IS_STRING; + Z_STRVAL_P(processed) = Z_STRVAL_P(arg1); + Z_STRLEN_P(processed) = Z_STRLEN_P(arg1); + Z_TYPE_P(processed) = IS_STRING; convert_browscap_pattern(processed); zend_hash_update(Z_OBJPROP_P(current_section), "browser_name_pattern", sizeof("browser_name_pattern"), (void *) &processed, sizeof(zval *), NULL); } @@ -152,7 +152,7 @@ PHP_MINIT_FUNCTION(browscap) return FAILURE; } fh.filename = browscap; - fh.type = ZEND_HANDLE_FP; + Z_TYPE(fh) = ZEND_HANDLE_FP; zend_parse_ini_file(&fh, 1, (zend_ini_parser_cb_t) php_browscap_parser_cb, &browser_hash); } @@ -187,10 +187,10 @@ static int browser_reg_compare(zval **browser, int num_args, va_list args, zend_ return 0; } - if (!strchr((*browser_name)->value.str.val,'*')) { + if (!strchr(Z_STRVAL_PP(browser_name),'*')) { return 0; } - if (regcomp(&r, (*browser_name)->value.str.val, REG_NOSUB)!=0) { + if (regcomp(&r, Z_STRVAL_PP(browser_name), REG_NOSUB)!=0) { return 0; } if (regexec(&r, lookup_browser_name, 0, NULL, 0)==0) { @@ -233,8 +233,8 @@ PHP_FUNCTION(get_browser) convert_to_string_ex(agent_name); - if (zend_hash_find(&browser_hash, (*agent_name)->value.str.val, (*agent_name)->value.str.len+1, (void **) &agent)==FAILURE) { - lookup_browser_name = (*agent_name)->value.str.val; + if (zend_hash_find(&browser_hash, Z_STRVAL_PP(agent_name), Z_STRLEN_PP(agent_name)+1, (void **) &agent)==FAILURE) { + lookup_browser_name = Z_STRVAL_PP(agent_name); found_browser_entry = NULL; zend_hash_apply_with_arguments(&browser_hash, (apply_func_args_t) browser_reg_compare, 2, lookup_browser_name, &found_browser_entry); @@ -250,7 +250,7 @@ PHP_FUNCTION(get_browser) while (zend_hash_find(Z_OBJPROP_PP(agent), "parent", sizeof("parent"), (void **) &agent_name)==SUCCESS) { - if (zend_hash_find(&browser_hash, (*agent_name)->value.str.val, (*agent_name)->value.str.len+1, (void **)&agent)==FAILURE) { + if (zend_hash_find(&browser_hash, Z_STRVAL_PP(agent_name), Z_STRLEN_PP(agent_name)+1, (void **)&agent)==FAILURE) { break; } diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index 0c7a06b6dd..e14c872cbf 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -117,8 +117,8 @@ PHP_NAMED_FUNCTION(php_if_crc32) convert_to_string_ex(arg); len = 0 ; - nr=(*arg)->value.str.len; - p = (*arg)->value.str.val; + nr=Z_STRLEN_PP(arg); + p = Z_STRVAL_PP(arg); for (len += nr; nr--; ++p) { CRC32(crc, *p); } diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c index 72acec7185..fd330dc5b9 100644 --- a/ext/standard/cyr_convert.c +++ b/ext/standard/cyr_convert.c @@ -282,9 +282,9 @@ PHP_FUNCTION(convert_cyr_string) convert_to_string_ex(fr_cs); convert_to_string_ex(to_cs); - str = (unsigned char*) estrndup((*str_arg)->value.str.val, (*str_arg)->value.str.len); + str = (unsigned char*) estrndup(Z_STRVAL_PP(str_arg), Z_STRLEN_PP(str_arg)); - php_convert_cyr_string(str, (*str_arg)->value.str.len, (*fr_cs)->value.str.val[0], (*to_cs)->value.str.val[0]); + php_convert_cyr_string(str, Z_STRLEN_PP(str_arg), Z_STRVAL_PP(fr_cs)[0], Z_STRVAL_PP(to_cs)[0]); RETVAL_STRING((char *)str, 0) } /* }}} */ diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index a6348fe74e..71eb7740d9 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -233,7 +233,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) WRONG_PARAM_COUNT; } convert_to_long_ex(timestamp); - the_time = (*timestamp)->value.lval; + the_time = Z_LVAL_PP(timestamp); break; default: WRONG_PARAM_COUNT; @@ -250,8 +250,8 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) php_error(E_WARNING, "unexpected error in date()"); RETURN_FALSE; } - for (i = 0; i < (*format)->value.str.len; i++) { - switch ((*format)->value.str.val[i]) { + for (i = 0; i < Z_STRLEN_PP(format); i++) { + switch (Z_STRVAL_PP(format)[i]) { case 'r': /* rfc822 format */ size += 31; break; @@ -303,7 +303,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) size += 2; break; case '\\': - if(i < (*format)->value.str.len-1) { + if(i < Z_STRLEN_PP(format)-1) { i++; } size ++; @@ -317,123 +317,123 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) } } - return_value->value.str.val = (char *) emalloc(size + 1); - return_value->value.str.val[0] = '\0'; + Z_STRVAL_P(return_value) = (char *) emalloc(size + 1); + Z_STRVAL_P(return_value)[0] = '\0'; - for (i = 0; i < (*format)->value.str.len; i++) { - switch ((*format)->value.str.val[i]) { + for (i = 0; i < Z_STRLEN_PP(format); i++) { + switch (Z_STRVAL_PP(format)[i]) { case '\\': - if(i < (*format)->value.str.len-1) { + if(i < Z_STRLEN_PP(format)-1) { char ch[2]; - ch[0]=(*format)->value.str.val[i+1]; + ch[0]=Z_STRVAL_PP(format)[i+1]; ch[1]='\0'; - strcat(return_value->value.str.val, ch); + strcat(Z_STRVAL_P(return_value), ch); i++; } break; case 'U': /* seconds since the epoch */ sprintf(tmp_buff, "%ld", (long)the_time); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'F': /* month, textual, full */ - strcat(return_value->value.str.val, mon_full_names[ta->tm_mon]); + strcat(Z_STRVAL_P(return_value), mon_full_names[ta->tm_mon]); break; case 'l': /* day (of the week), textual, full */ - strcat(return_value->value.str.val, day_full_names[ta->tm_wday]); + strcat(Z_STRVAL_P(return_value), day_full_names[ta->tm_wday]); break; case 'Y': /* year, numeric, 4 digits */ sprintf(tmp_buff, "%d", ta->tm_year + 1900); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'M': /* month, textual, 3 letters */ - strcat(return_value->value.str.val, mon_short_names[ta->tm_mon]); + strcat(Z_STRVAL_P(return_value), mon_short_names[ta->tm_mon]); break; case 'D': /* day (of the week), textual, 3 letters */ - strcat(return_value->value.str.val, day_short_names[ta->tm_wday]); + strcat(Z_STRVAL_P(return_value), day_short_names[ta->tm_wday]); break; case 'z': /* day (of the year) */ sprintf(tmp_buff, "%d", ta->tm_yday); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'y': /* year, numeric, 2 digits */ sprintf(tmp_buff, "%02d", ((ta->tm_year)%100)); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'm': /* month, numeric */ sprintf(tmp_buff, "%02d", ta->tm_mon + 1); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'n': /* month, numeric, no leading zeros */ sprintf(tmp_buff, "%d", ta->tm_mon + 1); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'd': /* day of the month, numeric */ sprintf(tmp_buff, "%02d", ta->tm_mday); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'j': sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'H': /* hour, numeric, 24 hour format */ sprintf(tmp_buff, "%02d", ta->tm_hour); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'h': /* hour, numeric, 12 hour format */ h = ta->tm_hour % 12; if (h==0) h = 12; sprintf(tmp_buff, "%02d", h); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'G': /* hour, numeric, 24 hour format, no leading zeros */ sprintf(tmp_buff, "%d", ta->tm_hour); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'g': /* hour, numeric, 12 hour format, no leading zeros */ h = ta->tm_hour % 12; if (h==0) h = 12; sprintf(tmp_buff, "%d", h); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'i': /* minutes, numeric */ sprintf(tmp_buff, "%02d", ta->tm_min); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 's': /* seconds, numeric */ sprintf(tmp_buff, "%02d", ta->tm_sec); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'A': /* AM/PM */ - strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "PM" : "AM")); + strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "PM" : "AM")); break; case 'a': /* am/pm */ - strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "pm" : "am")); + strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "pm" : "am")); break; case 'S': /* standard english suffix, e.g. 2nd/3rd for the day of the month */ if (ta->tm_mday >= 10 && ta->tm_mday <= 19) { - strcat(return_value->value.str.val, "th"); + strcat(Z_STRVAL_P(return_value), "th"); } else { switch (ta->tm_mday % 10) { case 1: - strcat(return_value->value.str.val, "st"); + strcat(Z_STRVAL_P(return_value), "st"); break; case 2: - strcat(return_value->value.str.val, "nd"); + strcat(Z_STRVAL_P(return_value), "nd"); break; case 3: - strcat(return_value->value.str.val, "rd"); + strcat(Z_STRVAL_P(return_value), "rd"); break; default: - strcat(return_value->value.str.val, "th"); + strcat(Z_STRVAL_P(return_value), "th"); break; } } break; case 't': /* days in current month */ sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+1900))][ta->tm_mon] ); - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'w': /* day of the week, numeric EXTENSION */ sprintf(tmp_buff, "%01d", ta->tm_wday); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'O': /* GMT offset in [+-]HHMM format */ #if HAVE_TM_GMTOFF @@ -441,7 +441,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) #else sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600)); #endif - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'Z': /* timezone offset in seconds */ #if HAVE_TM_GMTOFF @@ -449,17 +449,17 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) #else sprintf(tmp_buff, "%ld", ta->tm_isdst ? -(timezone - 3600) : -timezone); #endif - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'L': /* boolean for leapyear */ sprintf(tmp_buff, "%d", (isleap((ta->tm_year+1900)) ? 1 : 0 ) ); - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'T': /* timezone name */ #if HAVE_TM_ZONE - strcat(return_value->value.str.val, ta->tm_zone); + strcat(Z_STRVAL_P(return_value), ta->tm_zone); #elif HAVE_TZNAME - strcat(return_value->value.str.val, tzname[0]); + strcat(Z_STRVAL_P(return_value), tzname[0]); #endif break; case 'B': /* Swatch Beat a.k.a. Internet Time */ @@ -470,11 +470,11 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) } beat = beat % 1000; sprintf(tmp_buff, "%03d", beat); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'I': sprintf(tmp_buff, "%d", ta->tm_isdst); - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'r': #if HAVE_TM_GMTOFF @@ -504,7 +504,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) ); #endif - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'W': /* ISO-8601 week number of year, weeks starting on Monday */ wd = ta->tm_wday==0 ? 7 : ta->tm_wday; @@ -515,18 +515,18 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) wk--; } sprintf(tmp_buff, "%d", wk); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; default: - length = strlen(return_value->value.str.val); - return_value->value.str.val[length] = (*format)->value.str.val[i]; - return_value->value.str.val[length + 1] = '\0'; + length = strlen(Z_STRVAL_P(return_value)); + Z_STRVAL_P(return_value)[length] = Z_STRVAL_PP(format)[i]; + Z_STRVAL_P(return_value)[length + 1] = '\0'; break; } } - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ @@ -567,13 +567,13 @@ PHP_FUNCTION(localtime) break; case 1: convert_to_long_ex(timestamp_arg); - timestamp = (*timestamp_arg)->value.lval; + timestamp = Z_LVAL_PP(timestamp_arg); break; case 2: convert_to_long_ex(timestamp_arg); convert_to_long_ex(assoc_array_arg); - timestamp = (*timestamp_arg)->value.lval; - assoc_array = (*assoc_array_arg)->value.lval; + timestamp = Z_LVAL_PP(timestamp_arg); + assoc_array = Z_LVAL_PP(assoc_array_arg); break; } ta = php_localtime_r(×tamp, &tmbuf); @@ -620,7 +620,7 @@ PHP_FUNCTION(getdate) WRONG_PARAM_COUNT; } else { convert_to_long_ex(timestamp_arg); - timestamp = (*timestamp_arg)->value.lval; + timestamp = Z_LVAL_PP(timestamp_arg); } ta = php_localtime_r(×tamp, &tmbuf); @@ -689,8 +689,8 @@ PHP_FUNCTION(checkdate) WRONG_PARAM_COUNT; } - if((*year)->type == IS_STRING) { - res = is_numeric_string((*year)->value.str.val, (*year)->value.str.len, NULL, NULL, 0); + if(Z_TYPE_PP(year) == IS_STRING) { + res = is_numeric_string(Z_STRVAL_PP(year), Z_STRLEN_PP(year), NULL, NULL, 0); if(res!=IS_LONG && res !=IS_DOUBLE) { RETURN_FALSE; } @@ -698,9 +698,9 @@ PHP_FUNCTION(checkdate) convert_to_long_ex(day); convert_to_long_ex(month); convert_to_long_ex(year); - y = (*year)->value.lval; - m = (*month)->value.lval; - d = (*day)->value.lval; + y = Z_LVAL_PP(year); + m = Z_LVAL_PP(month); + d = Z_LVAL_PP(day); if (y < 1 || y > 32767) { RETURN_FALSE; @@ -739,7 +739,7 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm) RETURN_FALSE; } convert_to_long_ex(timestamp_arg); - timestamp = (*timestamp_arg)->value.lval; + timestamp = Z_LVAL_PP(timestamp_arg); break; default: WRONG_PARAM_COUNT; @@ -747,13 +747,13 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm) } convert_to_string_ex(format_arg); - if ((*format_arg)->value.str.len==0) { + if (Z_STRLEN_PP(format_arg)==0) { RETURN_FALSE; } if (timestamp < 0) { RETURN_FALSE; } - format = (*format_arg)->value.str.val; + format = Z_STRVAL_PP(format_arg); if (gm) { ta = php_gmtime_r(×tamp, &tmbuf); } else { diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 186318a6bf..cb36184926 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -148,13 +148,13 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) } convert_to_string_ex(arg); - if (php_check_open_basedir((*arg)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(arg) TSRMLS_CC)) { RETURN_FALSE; } dirp = emalloc(sizeof(php_dir)); - dirp->dir = VCWD_OPENDIR((*arg)->value.str.val); + dirp->dir = VCWD_OPENDIR(Z_STRVAL_PP(arg)); #ifdef PHP_WIN32 if (!dirp->dir || dirp->dir->finished) { @@ -175,7 +175,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) if (createobject) { object_init_ex(return_value, dir_class_entry_ptr); - add_property_stringl(return_value, "path", (*arg)->value.str.val, (*arg)->value.str.len, 1); + add_property_stringl(return_value, "path", Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), 1); add_property_resource(return_value, "handle", dirp->id); zend_list_addref(dirp->id); } else { @@ -235,7 +235,7 @@ PHP_FUNCTION(chroot) } convert_to_string_ex(arg); - ret = chroot((*arg)->value.str.val); + ret = chroot(Z_STRVAL_PP(arg)); if (ret != 0) { php_error(E_WARNING, "chroot: %s (errno %d)", strerror(errno), errno); @@ -268,10 +268,10 @@ PHP_FUNCTION(chdir) } convert_to_string_ex(arg); - if (PG(safe_mode) && !php_checkuid((*arg)->value.str.val, NULL, CHECKUID_ALLOW_ONLY_FILE)) { + if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(arg), NULL, CHECKUID_ALLOW_ONLY_FILE)) { RETURN_FALSE; } - ret = VCWD_CHDIR((*arg)->value.str.val); + ret = VCWD_CHDIR(Z_STRVAL_PP(arg)); if (ret != 0) { php_error(E_WARNING, "ChDir: %s (errno %d)", strerror(errno), errno); diff --git a/ext/standard/dl.c b/ext/standard/dl.c index d482677b99..d033dce989 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -119,15 +119,15 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC) if (extension_dir && extension_dir[0]){ int extension_dir_len = strlen(extension_dir); - libpath = emalloc(extension_dir_len+file->value.str.len+2); + libpath = emalloc(extension_dir_len+Z_STRLEN_P(file)+2); if (IS_SLASH(extension_dir[extension_dir_len-1])) { - sprintf(libpath, "%s%s", extension_dir, file->value.str.val); /* SAFE */ + sprintf(libpath, "%s%s", extension_dir, Z_STRVAL_P(file)); /* SAFE */ } else { - sprintf(libpath, "%s/%s", extension_dir, file->value.str.val); /* SAFE */ + sprintf(libpath, "%s/%s", extension_dir, Z_STRVAL_P(file)); /* SAFE */ } } else { - libpath = estrndup(file->value.str.val, file->value.str.len); + libpath = estrndup(Z_STRVAL_P(file), Z_STRLEN_P(file)); } /* load dynamic symbol */ @@ -154,7 +154,7 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC) if (!get_module) { DL_UNLOAD(handle); - php_error(error_type, "Invalid library (maybe not a PHP library) '%s' ", file->value.str.val); + php_error(error_type, "Invalid library (maybe not a PHP library) '%s' ", Z_STRVAL_P(file)); RETURN_FALSE; } module_entry = get_module(); @@ -170,7 +170,7 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC) DL_UNLOAD(handle); RETURN_FALSE; } - module_entry->type = type; + Z_TYPE_P(module_entry) = type; module_entry->module_number = zend_next_free_module(); if (module_entry->module_startup_func) { if (module_entry->module_startup_func(type, module_entry->module_number TSRMLS_CC)==FAILURE) { @@ -209,7 +209,7 @@ PHP_MINFO_FUNCTION(dl) void php_dl(pval *file, int type, pval *return_value) { - php_error(E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", file->value.str.val); + php_error(E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", Z_STRVAL_P(file)); RETURN_FALSE; } diff --git a/ext/standard/file.c b/ext/standard/file.c index 6f7042ecc5..970a8309ae 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2041,7 +2041,7 @@ PHP_FUNCTION(fgetcsv) } convert_to_string_ex(p_delim); /* Make sure that there is at least one character in string */ - if ((*p_delim)->value.str.len < 1) { + if (Z_STRLEN_PP(p_delim) < 1) { WRONG_PARAM_COUNT; } /* use first character from string */ diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 4f2921f755..d2a130ea27 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -164,7 +164,7 @@ PHP_FUNCTION(disk_total_space) convert_to_string_ex(path); - if (php_check_open_basedir((*path)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(path) TSRMLS_CC)) { RETURN_FALSE; } @@ -178,7 +178,7 @@ PHP_FUNCTION(disk_total_space) /* It's available, so we can call it. */ if (gdfse) { func = (gdfse_func)gdfse; - if (func((*path)->value.str.val, + if (func(Z_STRVAL_PP(path), &FreeBytesAvailableToCaller, &TotalNumberOfBytes, &TotalNumberOfFreeBytes) == 0) RETURN_FALSE; @@ -190,7 +190,7 @@ PHP_FUNCTION(disk_total_space) } /* If it's not available, we just use GetDiskFreeSpace */ else { - if (GetDiskFreeSpace((*path)->value.str.val, + if (GetDiskFreeSpace(Z_STRVAL_PP(path), &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE; bytestotal = (double)TotalNumberOfClusters * (double)SectorsPerCluster * (double)BytesPerSector; @@ -204,14 +204,14 @@ PHP_FUNCTION(disk_total_space) #elif defined(OS2) { FSALLOCATE fsinfo; - char drive = (*path)->value.str.val[0] & 95; + char drive = Z_STRVAL_PP(path)[0] & 95; if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0) bytestotal = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnit; } #else /* WINDOWS, OS/2 */ #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) - if (statvfs((*path)->value.str.val, &buf)) RETURN_FALSE; + if (statvfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE; if (buf.f_frsize) { bytestotal = (((double)buf.f_blocks) * ((double)buf.f_frsize)); } else { @@ -219,7 +219,7 @@ PHP_FUNCTION(disk_total_space) } #elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS) - if (statfs((*path)->value.str.val, &buf)) RETURN_FALSE; + if (statfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE; bytestotal = (((double)buf.f_bsize) * ((double)buf.f_blocks)); #endif #endif /* WINDOWS */ @@ -267,7 +267,7 @@ PHP_FUNCTION(disk_free_space) convert_to_string_ex(path); - if (php_check_open_basedir((*path)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(path) TSRMLS_CC)) { RETURN_FALSE; } @@ -281,7 +281,7 @@ PHP_FUNCTION(disk_free_space) /* It's available, so we can call it. */ if (gdfse) { func = (gdfse_func)gdfse; - if (func((*path)->value.str.val, + if (func(Z_STRVAL_PP(path), &FreeBytesAvailableToCaller, &TotalNumberOfBytes, &TotalNumberOfFreeBytes) == 0) RETURN_FALSE; @@ -293,7 +293,7 @@ PHP_FUNCTION(disk_free_space) } /* If it's not available, we just use GetDiskFreeSpace */ else { - if (GetDiskFreeSpace((*path)->value.str.val, + if (GetDiskFreeSpace(Z_STRVAL_PP(path), &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE; bytesfree = (double)NumberOfFreeClusters * (double)SectorsPerCluster * (double)BytesPerSector; @@ -307,21 +307,21 @@ PHP_FUNCTION(disk_free_space) #elif defined(OS2) { FSALLOCATE fsinfo; - char drive = (*path)->value.str.val[0] & 95; + char drive = Z_STRVAL_PP(path)[0] & 95; if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0) bytesfree = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnitAvail; } #else /* WINDOWS, OS/2 */ #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) - if (statvfs((*path)->value.str.val, &buf)) RETURN_FALSE; + if (statvfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE; if (buf.f_frsize) { bytesfree = (((double)buf.f_bavail) * ((double)buf.f_frsize)); } else { bytesfree = (((double)buf.f_bavail) * ((double)buf.f_bsize)); } #elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS) - if (statfs((*path)->value.str.val, &buf)) RETURN_FALSE; + if (statfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE; bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail)); #endif #endif /* WINDOWS */ @@ -344,29 +344,29 @@ PHP_FUNCTION(chgrp) WRONG_PARAM_COUNT; } convert_to_string_ex(filename); - if ((*group)->type == IS_STRING) { - gr = getgrnam((*group)->value.str.val); + if (Z_TYPE_PP(group) == IS_STRING) { + gr = getgrnam(Z_STRVAL_PP(group)); if (!gr) { php_error(E_WARNING, "unable to find gid for %s", - (*group)->value.str.val); + Z_STRVAL_PP(group)); RETURN_FALSE; } gid = gr->gr_gid; } else { convert_to_long_ex(group); - gid = (*group)->value.lval; + gid = Z_LVAL_PP(group); } - if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { + if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { RETURN_FALSE; } /* Check the basedir */ - if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { RETURN_FALSE; } - ret = VCWD_CHOWN((*filename)->value.str.val, -1, gid); + ret = VCWD_CHOWN(Z_STRVAL_PP(filename), -1, gid); if (ret == -1) { php_error(E_WARNING, "chgrp failed: %s", strerror(errno)); RETURN_FALSE; @@ -392,29 +392,29 @@ PHP_FUNCTION(chown) WRONG_PARAM_COUNT; } convert_to_string_ex(filename); - if ((*user)->type == IS_STRING) { - pw = getpwnam((*user)->value.str.val); + if (Z_TYPE_PP(user) == IS_STRING) { + pw = getpwnam(Z_STRVAL_PP(user)); if (!pw) { php_error(E_WARNING, "unable to find uid for %s", - (*user)->value.str.val); + Z_STRVAL_PP(user)); RETURN_FALSE; } uid = pw->pw_uid; } else { convert_to_long_ex(user); - uid = (*user)->value.lval; + uid = Z_LVAL_PP(user); } - if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { + if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { RETURN_FALSE; } /* Check the basedir */ - if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { RETURN_FALSE; } - ret = VCWD_CHOWN((*filename)->value.str.val, uid, -1); + ret = VCWD_CHOWN(Z_STRVAL_PP(filename), uid, -1); if (ret == -1) { php_error(E_WARNING, "chown failed: %s", strerror(errno)); RETURN_FALSE; @@ -438,16 +438,16 @@ PHP_FUNCTION(chmod) convert_to_string_ex(filename); convert_to_long_ex(mode); - if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { + if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { RETURN_FALSE; } /* Check the basedir */ - if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { RETURN_FALSE; } - imode = (mode_t) (*mode)->value.lval; + imode = (mode_t) Z_LVAL_PP(mode); /* in safe mode, do not allow to setuid files. Setuiding files could allow users to gain privileges that safe mode doesn't give them. @@ -455,7 +455,7 @@ PHP_FUNCTION(chmod) if(PG(safe_mode)) imode &= 0777; - ret = VCWD_CHMOD((*filename)->value.str.val, imode); + ret = VCWD_CHMOD(Z_STRVAL_PP(filename), imode); if (ret == -1) { php_error(E_WARNING, "chmod failed: %s", strerror(errno)); RETURN_FALSE; @@ -493,20 +493,20 @@ PHP_FUNCTION(touch) return; } convert_to_long_ex(filetime); - newtime->actime = (*filetime)->value.lval; - newtime->modtime = (*filetime)->value.lval; + newtime->actime = Z_LVAL_PP(filetime); + newtime->modtime = Z_LVAL_PP(filetime); } else { WRONG_PARAM_COUNT; } convert_to_string_ex(filename); - if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { + if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_CHECK_FILE_AND_DIR))) { if (newtime) efree(newtime); RETURN_FALSE; } /* Check the basedir */ - if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { if (newtime) { efree(newtime); } @@ -514,18 +514,18 @@ PHP_FUNCTION(touch) } /* create the file if it doesn't exist already */ - ret = VCWD_STAT((*filename)->value.str.val, &sb); + ret = VCWD_STAT(Z_STRVAL_PP(filename), &sb); if (ret == -1) { - file = VCWD_FOPEN((*filename)->value.str.val, "w"); + file = VCWD_FOPEN(Z_STRVAL_PP(filename), "w"); if (file == NULL) { - php_error(E_WARNING, "unable to create file %s because %s", (*filename)->value.str.val, strerror(errno)); + php_error(E_WARNING, "unable to create file %s because %s", Z_STRVAL_PP(filename), strerror(errno)); if (newtime) efree(newtime); RETURN_FALSE; } fclose(file); } - ret = VCWD_UTIME((*filename)->value.str.val, newtime); + ret = VCWD_UTIME(Z_STRVAL_PP(filename), newtime); if (newtime) efree(newtime); if (ret == -1) { php_error(E_WARNING, "utime failed: %s", strerror(errno)); diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index fa18a56f7f..d10de4d6f8 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -552,24 +552,24 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 's': convert_to_string_ex(args[argnum]); php_sprintf_appendstring(&result, &outpos, &size, - (*args[argnum])->value.str.val, + Z_STRVAL_PP(args[argnum]), width, precision, padding, alignment, - (*args[argnum])->value.str.len, + Z_STRLEN_PP(args[argnum]), 0, expprec); break; case 'd': convert_to_long_ex(args[argnum]); php_sprintf_appendint(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment); break; case 'u': convert_to_long_ex(args[argnum]); php_sprintf_appenduint(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment); break; @@ -578,7 +578,7 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) /* XXX not done */ convert_to_double_ex(args[argnum]); php_sprintf_appenddouble(&result, &outpos, &size, - (*args[argnum])->value.dval, + Z_DVAL_PP(args[argnum]), width, padding, alignment, precision, adjusting, format[inpos]); @@ -587,13 +587,13 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 'c': convert_to_long_ex(args[argnum]); php_sprintf_appendchar(&result, &outpos, &size, - (char) (*args[argnum])->value.lval TSRMLS_CC); + (char) Z_LVAL_PP(args[argnum]) TSRMLS_CC); break; case 'o': convert_to_long_ex(args[argnum]); php_sprintf_append2n(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment, 3, hexchars, expprec); break; @@ -601,7 +601,7 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 'x': convert_to_long_ex(args[argnum]); php_sprintf_append2n(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment, 4, hexchars, expprec); break; @@ -609,7 +609,7 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 'X': convert_to_long_ex(args[argnum]); php_sprintf_append2n(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment, 4, HEXCHARS, expprec); break; @@ -617,7 +617,7 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 'b': convert_to_long_ex(args[argnum]); php_sprintf_append2n(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment, 1, hexchars, expprec); break; diff --git a/ext/standard/html.c b/ext/standard/html.c index 092949c031..eb6512c18d 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -492,7 +492,7 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) convert_to_string_ex(arg); if(ac==2) { convert_to_long_ex(quotes); - quote_style = (*quotes)->value.lval; + quote_style = Z_LVAL_PP(quotes); } if (ac == 3) { convert_to_string_ex(charset); @@ -500,7 +500,7 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) } - new = php_escape_html_entities((*arg)->value.str.val, (*arg)->value.str.len, &len, all, quote_style, hint_charset); + new = php_escape_html_entities(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &len, all, quote_style, hint_charset); RETVAL_STRINGL(new, len, 0); } /* }}} */ @@ -553,11 +553,11 @@ PHP_FUNCTION(get_html_translation_table) if (ac > 0) { convert_to_long_ex(whichone); - which = (*whichone)->value.lval; + which = Z_LVAL_PP(whichone); } if (ac == 2) { convert_to_long_ex(quotes); - quote_style = (*quotes)->value.lval; + quote_style = Z_LVAL_PP(quotes); } array_init(return_value); diff --git a/ext/standard/image.c b/ext/standard/image.c index 087b4e9a6e..7b6fded134 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -306,7 +306,7 @@ static void php_read_APP(int socketd, FILE *fp, int issock, unsigned int marker, sprintf(markername, "APP%d", marker - M_APP0); - if (zend_hash_find(info->value.ht, markername, strlen(markername)+1, (void **) &tmp) == FAILURE) { + if (zend_hash_find(Z_ARRVAL_P(info), markername, strlen(markername)+1, (void **) &tmp) == FAILURE) { /* XXX we onyl catch the 1st tag of it's kind! */ add_assoc_stringl(info, markername, buffer, length, 1); } diff --git a/ext/standard/info.c b/ext/standard/info.c index 0f01eff45e..c314531171 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -65,14 +65,14 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) ulong num_key; if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) &data)!=FAILURE - && ((*data)->type==IS_ARRAY)) { - zend_hash_internal_pointer_reset((*data)->value.ht); - while (zend_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) { + && (Z_TYPE_PP(data)==IS_ARRAY)) { + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); + while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) { PUTS("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">"); PUTS("<td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>"); PUTS(name); PUTS("[\""); - switch (zend_hash_get_current_key((*data)->value.ht, &string_key, &num_key, 0)) { + switch (zend_hash_get_current_key(Z_ARRVAL_PP(data), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: zend_html_puts(string_key, strlen(string_key)); break; @@ -81,21 +81,21 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) break; } PUTS("\"]</b></td><td>"); - if ((*tmp)->type == IS_ARRAY) { + if (Z_TYPE_PP(tmp) == IS_ARRAY) { PUTS("<pre>"); zend_print_zval_r(*tmp, 0); PUTS("</pre>"); - } else if ((*tmp)->type != IS_STRING) { + } else if (Z_TYPE_PP(tmp) != IS_STRING) { tmp2 = **tmp; zval_copy_ctor(&tmp2); convert_to_string(&tmp2); zend_html_puts(tmp2.value.str.val, tmp2.value.str.len); zval_dtor(&tmp2); } else { - zend_html_puts((*tmp)->value.str.val, (*tmp)->value.str.len); + zend_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } PUTS(" </td></tr>\n"); - zend_hash_move_forward((*data)->value.ht); + zend_hash_move_forward(Z_ARRVAL_PP(data)); } } } @@ -290,16 +290,16 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print_table_start(); php_info_print_table_header(2, "Variable", "Value"); if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) { - php_info_print_table_row(2, "PHP_SELF", (*data)->value.str.val); + php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_PP(data)); } if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) { - php_info_print_table_row(2, "PHP_AUTH_TYPE", (*data)->value.str.val); + php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_PP(data)); } if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) { - php_info_print_table_row(2, "PHP_AUTH_USER", (*data)->value.str.val); + php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_PP(data)); } if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) { - php_info_print_table_row(2, "PHP_AUTH_PW", (*data)->value.str.val); + php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data)); } php_print_gpcse_array("_FORM", sizeof("_FORM")-1 TSRMLS_CC); php_print_gpcse_array("_GET", sizeof("_GET")-1 TSRMLS_CC); diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 19bec00289..9641ca408e 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -194,7 +194,7 @@ PHP_FUNCTION(iptcembed) convert_to_string_ex(iptcdata); convert_to_string_ex(jpeg_file); convert_to_long_ex(spool_flag); - spool = (*spool_flag)->value.lval; + spool = Z_LVAL_PP(spool_flag); break; case 2: @@ -210,16 +210,16 @@ PHP_FUNCTION(iptcembed) break; } - if (php_check_open_basedir((*jpeg_file)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(jpeg_file) TSRMLS_CC)) { RETURN_FALSE; } - if ((fp = VCWD_FOPEN((*jpeg_file)->value.str.val, "rb")) == 0) { - php_error(E_WARNING, "Unable to open %s", (*jpeg_file)->value.str.val); + if ((fp = VCWD_FOPEN(Z_STRVAL_PP(jpeg_file), "rb")) == 0) { + php_error(E_WARNING, "Unable to open %s", Z_STRVAL_PP(jpeg_file)); RETURN_FALSE; } - len = (*iptcdata)->value.str.len; + len = Z_STRLEN_PP(iptcdata); if (spool < 2) { fstat(fileno(fp), &sb); @@ -275,7 +275,7 @@ PHP_FUNCTION(iptcembed) php_iptc_put1(fp, spool, (unsigned char)(len&0xff), poi?&poi:0 TSRMLS_CC); for (inx = 0; inx < len; inx++) - php_iptc_put1(fp, spool, (*iptcdata)->value.str.val[inx], poi?&poi:0 TSRMLS_CC); + php_iptc_put1(fp, spool, Z_STRVAL_PP(iptcdata)[inx], poi?&poi:0 TSRMLS_CC); break; case M_SOS: @@ -316,8 +316,8 @@ PHP_FUNCTION(iptcparse) convert_to_string_ex(str); inx = 0; - length = (*str)->value.str.len; - buffer = (*str)->value.str.val; + length = Z_STRLEN_PP(str); + buffer = Z_STRVAL_PP(str); inheader = 0; /* have we already found the IPTC-Header??? */ tagsfound = 0; /* number of tags already found */ @@ -362,7 +362,7 @@ PHP_FUNCTION(iptcparse) } } - if (zend_hash_find(return_value->value.ht, key, strlen(key) + 1, (void **) &element) == FAILURE) { + if (zend_hash_find(Z_ARRVAL_P(return_value), key, strlen(key) + 1, (void **) &element) == FAILURE) { ALLOC_ZVAL(values); INIT_PZVAL(values); if (array_init(values) == FAILURE) { @@ -370,7 +370,7 @@ PHP_FUNCTION(iptcparse) RETURN_FALSE; } - zend_hash_update(return_value->value.ht, key, strlen(key)+1, (void *) &values, sizeof(pval*), (void **) &element); + zend_hash_update(Z_ARRVAL_P(return_value), key, strlen(key)+1, (void *) &values, sizeof(pval*), (void **) &element); } add_next_index_stringl(*element, buffer+inx, len, 1); diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c index 7a0fe01730..7ce5f79764 100644 --- a/ext/standard/levenshtein.c +++ b/ext/standard/levenshtein.c @@ -119,9 +119,9 @@ PHP_FUNCTION(levenshtein) distance = reference_levdist((*str1)->value.str.val, (*str1)->value.str.len, (*str2)->value.str.val, (*str2)->value.str.len, - (*cost_ins)->value.lval, - (*cost_rep)->value.lval, - (*cost_del)->value.lval + Z_LVAL_PP(cost_ins), + Z_LVAL_PP(cost_rep), + Z_LVAL_PP(cost_del) ); break; @@ -136,7 +136,7 @@ PHP_FUNCTION(levenshtein) distance = custom_levdist((*str1)->value.str.val , (*str2)->value.str.val - , (*callback_name)->value.str.val + , Z_STRVAL_PP(callback_name) ); break; diff --git a/ext/standard/link.c b/ext/standard/link.c index 377322dac5..463ab6c04e 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -146,7 +146,7 @@ PHP_FUNCTION(link) RETURN_FALSE; } - if (!strncasecmp((*topath)->value.str.val, "http://", 7) || !strncasecmp(Z_STRVAL_PP(topath), "ftp://", 6)) { + if (!strncasecmp(Z_STRVAL_PP(topath), "http://", 7) || !strncasecmp(Z_STRVAL_PP(topath), "ftp://", 6)) { php_error(E_WARNING, "Unable to link to a URL"); RETURN_FALSE; } diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 5e53ab0fe0..d045fa4690 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -56,8 +56,8 @@ PHP_FUNCTION(ezmlm_hash) } convert_to_string_ex(pstr); - if ((*pstr)->value.str.val) { - str = (*pstr)->value.str.val; + if (Z_STRVAL_PP(pstr)) { + str = Z_STRVAL_PP(pstr); } else { php_error(E_WARNING, "Must give string parameter to ezmlm_hash()"); RETURN_FALSE; diff --git a/ext/standard/md5.c b/ext/standard/md5.c index 00444db734..634814a74f 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -45,7 +45,7 @@ PHP_NAMED_FUNCTION(php_if_md5) md5str[0] = '\0'; PHP_MD5Init(&context); - PHP_MD5Update(&context, (*arg)->value.str.val, (*arg)->value.str.len); + PHP_MD5Update(&context, Z_STRVAL_PP(arg), Z_STRLEN_PP(arg)); PHP_MD5Final(digest, &context); for (i = 0, r = md5str; i < 16; i++, r += 2) { sprintf(r, "%02x", digest[i]); diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c index f249c249b0..5d1648dfd2 100644 --- a/ext/standard/metaphone.c +++ b/ext/standard/metaphone.c @@ -39,14 +39,14 @@ PHP_FUNCTION(metaphone) if (zend_get_parameters_ex(2, &pstr, &pphones) == SUCCESS) { convert_to_long_ex(pphones); - phones = (*pphones)->value.lval; + phones = Z_LVAL_PP(pphones); } else if (zend_get_parameters_ex(1, &pstr) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(pstr); - if (metaphone((*pstr)->value.str.val, phones, &result, 1) == 0) { + if (metaphone(Z_STRVAL_PP(pstr), phones, &result, 1) == 0) { RETVAL_STRING(result, 0); } else { if (result) { diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index e9e6b2dcf0..b8e527d2a1 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -103,7 +103,7 @@ PHP_FUNCTION(getrusage) if(ac == 1 && zend_get_parameters_ex(ac, &pwho) != FAILURE) { convert_to_long_ex(pwho); - if((*pwho)->value.lval == 1) + if(Z_LVAL_PP(pwho) == 1) who = RUSAGE_CHILDREN; } diff --git a/ext/standard/pack.c b/ext/standard/pack.c index ef7becfac2..60cdfc4db0 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -858,8 +858,8 @@ PHP_MINIT_FUNCTION(pack) } else { zval val; - int size = sizeof(val.value.lval); - val.value.lval=0; /*silence a warning*/ + int size = sizeof(Z_LVAL(val)); + Z_LVAL(val)=0; /*silence a warning*/ /* Where to get hi to lo bytes from */ byte_map[0] = size - 1; diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index c7f5a56282..46107f12b3 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -1219,7 +1219,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, result = SCAN_ERROR_EOF; } else if (numVars) { convert_to_long( *return_value ); - (*return_value)->value.lval = nconversions; + Z_LVAL_PP(return_value) = nconversions; } else if (nconversions < totalVars) { /* to do : not all elements converted. we need to prune the list - cc */ @@ -1233,8 +1233,8 @@ PHPAPI int php_sscanf_internal( char *string, char *format, static inline void scan_set_error_return(int numVars, pval **return_value) { if (numVars) { - (*return_value)->type = IS_LONG; - (*return_value)->value.lval = SCAN_ERROR_EOF; /* EOF marker */ + Z_TYPE_PP(return_value) = IS_LONG; + Z_LVAL_PP(return_value) = SCAN_ERROR_EOF; /* EOF marker */ } else { /* pval_destructor( *return_value ); */ /* convert_to_null calls destructor */ diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c index e52f1be5c1..bea945117b 100644 --- a/ext/standard/soundex.c +++ b/ext/standard/soundex.c @@ -66,11 +66,11 @@ PHP_FUNCTION(soundex) } convert_to_string_ex(parg); arg = *parg; - if (arg->value.str.len==0) { + if (Z_STRLEN_P(arg)==0) { RETURN_FALSE; } - somestring = arg->value.str.val; - len = arg->value.str.len; + somestring = Z_STRVAL_P(arg); + len = Z_STRLEN_P(arg); /* build soundex string */ last = -1; @@ -106,9 +106,9 @@ PHP_FUNCTION(soundex) } soundex[_small] = '\0'; - return_value->value.str.val = estrndup(soundex, _small); - return_value->value.str.len = _small; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrndup(soundex, _small); + Z_STRLEN_P(return_value) = _small; + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ diff --git a/ext/standard/string.c b/ext/standard/string.c index c8088dabc6..7b81d3245e 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -865,7 +865,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value) tmp_str[0] = 0; zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos); - while (zend_hash_get_current_data_ex(arr->value.ht, (void **) &tmp, &pos) == SUCCESS) { + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **) &tmp, &pos) == SUCCESS) { count--; memcpy(tmp_str + target, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); target += Z_STRLEN_PP(tmp); @@ -1768,7 +1768,7 @@ PHP_FUNCTION(quotemeta) RETURN_FALSE; } - str = emalloc(2 * (*arg)->value.str.len + 1); + str = emalloc(2 * Z_STRLEN_PP(arg) + 1); for(p = old, q = str; p != old_end; p++) { c = *p; @@ -1932,8 +1932,8 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable * break; case HASH_KEY_IS_LONG: - ctmp.type = IS_LONG; - ctmp.value.lval = num_key; + Z_TYPE(ctmp) = IS_LONG; + Z_LVAL(ctmp) = num_key; convert_to_string(&ctmp); len = Z_STRLEN(ctmp); @@ -2009,7 +2009,7 @@ PHP_FUNCTION(strtr) WRONG_PARAM_COUNT; } - if (ac == 2 && (*from)->type != IS_ARRAY) { + if (ac == 2 && Z_TYPE_PP(from) != IS_ARRAY) { php_error(E_WARNING, "arg2 must be passed an array"); RETURN_FALSE; } @@ -2817,7 +2817,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) RETURN_FALSE; } convert_to_long_ex(max_chars_per_line); - max_chars = (*max_chars_per_line)->value.lval; + max_chars = Z_LVAL_PP(max_chars_per_line); break; default: WRONG_PARAM_COUNT; @@ -2826,16 +2826,16 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) convert_to_string_ex(str); - if ((*str)->value.str.len==0) { + if (Z_STRLEN_PP(str)==0) { RETURN_FALSE; } - tmp = (*str)->value.str.val; + tmp = Z_STRVAL_PP(str); block_start=block_end=0; block_ended=0; - heb_str = (char *) emalloc((*str)->value.str.len+1); - target = heb_str+(*str)->value.str.len; + heb_str = (char *) emalloc(Z_STRLEN_PP(str)+1); + target = heb_str+Z_STRLEN_PP(str); opposite_target = heb_str; *target = 0; target--; @@ -2850,13 +2850,13 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) do { if (block_type==_HEB_BLOCK_TYPE_HEB) { - while((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && block_end<(*str)->value.str.len-1) { + while((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && block_end<Z_STRLEN_PP(str)-1) { tmp++; block_end++; block_length++; } for (i=block_start; i<=block_end; i++) { - *target = (*str)->value.str.val[i]; + *target = Z_STRVAL_PP(str)[i]; switch (*target) { case '(': *target = ')'; @@ -2871,7 +2871,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) } block_type = _HEB_BLOCK_TYPE_ENG; } else { - while(!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end<(*str)->value.str.len-1) { + while(!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end<Z_STRLEN_PP(str)-1) { tmp++; block_end++; block_length++; @@ -2881,17 +2881,17 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) block_end--; } for (i=block_end; i>=block_start; i--) { - *target = (*str)->value.str.val[i]; + *target = Z_STRVAL_PP(str)[i]; target--; } block_type = _HEB_BLOCK_TYPE_HEB; } block_start=block_end+1; - } while(block_end<(*str)->value.str.len-1); + } while(block_end<Z_STRLEN_PP(str)-1); - broken_str = (char *) emalloc((*str)->value.str.len+1); - begin=end=(*str)->value.str.len-1; + broken_str = (char *) emalloc(Z_STRLEN_PP(str)+1); + begin=end=Z_STRLEN_PP(str)-1; target = broken_str; while (1) { @@ -2950,12 +2950,12 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) efree(heb_str); if (convert_newlines) { - php_char_to_str(broken_str, (*str)->value.str.len,'\n', "<br>\n", 5, return_value); + php_char_to_str(broken_str, Z_STRLEN_PP(str),'\n', "<br>\n", 5, return_value); efree(broken_str); } else { - return_value->value.str.val = broken_str; - return_value->value.str.len = (*str)->value.str.len; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = broken_str; + Z_STRLEN_P(return_value) = Z_STRLEN_PP(str); + Z_TYPE_P(return_value) = IS_STRING; } } /* }}} */ @@ -2996,16 +2996,16 @@ PHP_FUNCTION(nl2br) } /* Windows style line-endings */ - tmp = php_str_to_str((*str)->value.str.val, (*str)->value.str.len, "\r\n", 2, "<br />\r\n", 8, &new_length); - if (new_length != (*str)->value.str.len) + tmp = php_str_to_str(Z_STRVAL_PP(str), Z_STRLEN_PP(str), "\r\n", 2, "<br />\r\n", 8, &new_length); + if (new_length != Z_STRLEN_PP(str)) RETURN_STRINGL (tmp, new_length, 0); efree (tmp); /* Mac / Unix style line-endings */ - if (php_char_to_str((*str)->value.str.val,(*str)->value.str.len, '\n',"<br />\n", 7, return_value)) + if (php_char_to_str(Z_STRVAL_PP(str),Z_STRLEN_PP(str), '\n',"<br />\n", 7, return_value)) return; efree (Z_STRVAL_P(return_value)); - php_char_to_str((*str)->value.str.val,(*str)->value.str.len, '\r',"<br />\r", 7, return_value); + php_char_to_str(Z_STRVAL_PP(str),Z_STRLEN_PP(str), '\r',"<br />\r", 7, return_value); } /* }}} */ @@ -3029,16 +3029,16 @@ PHP_FUNCTION(strip_tags) RETURN_FALSE; } convert_to_string_ex(allow); - allowed_tags = (*allow)->value.str.val; - allowed_tags_len = (*allow)->value.str.len; + allowed_tags = Z_STRVAL_PP(allow); + allowed_tags_len = Z_STRLEN_PP(allow); break; default: WRONG_PARAM_COUNT; break; } convert_to_string_ex(str); - buf = estrndup((*str)->value.str.val, (*str)->value.str.len); - php_strip_tags(buf, (*str)->value.str.len, 0, allowed_tags, allowed_tags_len); + buf = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str)); + php_strip_tags(buf, Z_STRLEN_PP(str), 0, allowed_tags, allowed_tags_len); RETURN_STRING(buf, 0); } /* }}} */ @@ -3066,31 +3066,31 @@ PHP_FUNCTION(setlocale) convert_to_string_ex(pcategory); category = *pcategory; - if (!strcasecmp ("LC_ALL", category->value.str.val)) + if (!strcasecmp ("LC_ALL", Z_STRVAL_P(category))) cat = LC_ALL; - else if (!strcasecmp ("LC_COLLATE", category->value.str.val)) + else if (!strcasecmp ("LC_COLLATE", Z_STRVAL_P(category))) cat = LC_COLLATE; - else if (!strcasecmp ("LC_CTYPE", category->value.str.val)) + else if (!strcasecmp ("LC_CTYPE", Z_STRVAL_P(category))) cat = LC_CTYPE; #ifdef LC_MESSAGES - else if (!strcasecmp ("LC_MESSAGES", category->value.str.val)) + else if (!strcasecmp ("LC_MESSAGES", Z_STRVAL_P(category))) cat = LC_MESSAGES; #endif - else if (!strcasecmp ("LC_MONETARY", category->value.str.val)) + else if (!strcasecmp ("LC_MONETARY", Z_STRVAL_P(category))) cat = LC_MONETARY; - else if (!strcasecmp ("LC_NUMERIC", category->value.str.val)) + else if (!strcasecmp ("LC_NUMERIC", Z_STRVAL_P(category))) cat = LC_NUMERIC; - else if (!strcasecmp ("LC_TIME", category->value.str.val)) + else if (!strcasecmp ("LC_TIME", Z_STRVAL_P(category))) cat = LC_TIME; else { - php_error(E_WARNING, "Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC or LC_TIME", category->value.str.val); + php_error(E_WARNING, "Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC or LC_TIME", Z_STRVAL_P(category)); RETURN_FALSE; } } - if (!strcmp ("0", locale->value.str.val)) { + if (!strcmp ("0", Z_STRVAL_P(locale))) { loc = NULL; } else { - loc = locale->value.str.val; + loc = Z_STRVAL_P(locale); } retval = setlocale (cat, loc); @@ -3127,8 +3127,8 @@ PHP_FUNCTION(parse_str) convert_to_string_ex(arg); sarg = *arg; - if (sarg->value.str.val && *sarg->value.str.val) { - res = estrndup(sarg->value.str.val, sarg->value.str.len); + if (Z_STRVAL_P(sarg) && *Z_STRVAL_P(sarg)) { + res = estrndup(Z_STRVAL_P(sarg), Z_STRLEN_P(sarg)); } old_rg = PG(register_globals); @@ -3381,29 +3381,29 @@ PHP_FUNCTION(str_repeat) convert_to_string_ex(input_str); convert_to_long_ex(mult); - if ((*mult)->value.lval < 0) { + if (Z_LVAL_PP(mult) < 0) { php_error(E_WARNING, "Second argument to %s() has to be greater than or equal to 0", get_active_function_name(TSRMLS_C)); return; } /* Don't waste our time if it's empty */ - if ((*input_str)->value.str.len == 0) + if (Z_STRLEN_PP(input_str) == 0) RETURN_STRINGL(empty_string, 0, 1); /* ... or if the multiplier is zero */ - if ((*mult)->value.lval == 0) + if (Z_LVAL_PP(mult) == 0) RETURN_STRINGL(empty_string, 0, 1); /* Initialize the result string */ - result_len = (*input_str)->value.str.len * (*mult)->value.lval; + result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult); result = (char *)emalloc(result_len + 1); /* Copy the input string into the result as many times as necessary */ - for (i=0; i<(*mult)->value.lval; i++) { - memcpy(result + (*input_str)->value.str.len * i, - (*input_str)->value.str.val, - (*input_str)->value.str.len); + for (i=0; i<Z_LVAL_PP(mult); i++) { + memcpy(result + Z_STRLEN_PP(input_str) * i, + Z_STRVAL_PP(input_str), + Z_STRLEN_PP(input_str)); } result[result_len] = '\0'; @@ -3432,7 +3432,7 @@ PHP_FUNCTION(count_chars) if (ac == 2) { convert_to_long_ex(mode); - mymode = (*mode)->value.lval; + mymode = Z_LVAL_PP(mode); if (mymode < 0 || mymode > 4) { php_error(E_WARNING, "unknown mode"); @@ -3440,8 +3440,8 @@ PHP_FUNCTION(count_chars) } } - len = (*input)->value.str.len; - buf = (unsigned char *) (*input)->value.str.val; + len = Z_STRLEN_PP(input); + buf = (unsigned char *) Z_STRVAL_PP(input); memset((void*) chars, 0, sizeof(chars)); while (len > 0) { @@ -3600,8 +3600,8 @@ PHP_FUNCTION(localeconv) add_assoc_long( return_value, "n_sign_posn", CHAR_MAX ); #endif - zend_hash_update(return_value->value.ht, "grouping", 9, &grouping, sizeof(zval *), NULL); - zend_hash_update(return_value->value.ht, "mon_grouping", 13, &mon_grouping, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), "grouping", 9, &grouping, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), "mon_grouping", 13, &mon_grouping, sizeof(zval *), NULL); } /* }}} */ @@ -3628,24 +3628,24 @@ PHP_FUNCTION(substr_count) convert_to_string_ex(haystack); convert_to_string_ex(needle); - if ((*needle)->value.str.len == 0) { + if (Z_STRLEN_PP(needle) == 0) { php_error(E_WARNING, "Empty substring"); RETURN_FALSE; - } else if ((*needle)->value.str.len == 1) { + } else if (Z_STRLEN_PP(needle) == 1) { /* Special optimized case to avoid calls to php_memnstr(). */ - for (i = 0, p = (*haystack)->value.str.val, - length = (*haystack)->value.str.len, cmp = (*needle)->value.str.val[0]; + for (i = 0, p = Z_STRVAL_PP(haystack), + length = Z_STRLEN_PP(haystack), cmp = Z_STRVAL_PP(needle)[0]; i < length; i++) { if (p[i] == cmp) { count++; } } } else { - p = (*haystack)->value.str.val; - endp = p + (*haystack)->value.str.len; + p = Z_STRVAL_PP(haystack); + endp = p + Z_STRLEN_PP(haystack); while (p <= endp) { - if( (p = php_memnstr(p, (*needle)->value.str.val, (*needle)->value.str.len, endp)) != NULL ) { - p += (*needle)->value.str.len; + if( (p = php_memnstr(p, Z_STRVAL_PP(needle), Z_STRLEN_PP(needle), endp)) != NULL ) { + p += Z_STRLEN_PP(needle); count++; } else { break; diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index 74d99abace..d3e05fa5e9 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -217,8 +217,8 @@ PHP_FUNCTION(openlog) if (BG(syslog_device)) { efree(BG(syslog_device)); } - BG(syslog_device) = estrndup((*ident)->value.str.val, (*ident)->value.str.len); - openlog(BG(syslog_device), (*option)->value.lval, (*facility)->value.lval); + BG(syslog_device) = estrndup(Z_STRVAL_PP(ident), Z_STRLEN_PP(ident)); + openlog(BG(syslog_device), Z_LVAL_PP(option), Z_LVAL_PP(facility)); RETURN_TRUE; } /* }}} */ @@ -253,7 +253,7 @@ PHP_FUNCTION(syslog) * this will cause problems. */ - php_syslog((*priority)->value.lval, "%.500s", (*message)->value.str.val); + php_syslog(Z_LVAL_PP(priority), "%.500s", Z_STRVAL_PP(message)); RETURN_TRUE; } /* }}} */ diff --git a/ext/standard/var.c b/ext/standard/var.c index 0f07f035fc..5b11a5247f 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -491,9 +491,9 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has INIT_PZVAL(*rval); if (cur == 'a') { - (*rval)->type = IS_ARRAY; - ALLOC_HASHTABLE((*rval)->value.ht); - myht = (*rval)->value.ht; + Z_TYPE_PP(rval) = IS_ARRAY; + ALLOC_HASHTABLE(Z_ARRVAL_PP(rval)); + myht = Z_ARRVAL_PP(rval); } else { zend_class_entry *ce; @@ -573,7 +573,7 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has FREE_ZVAL(data); return 0; } - switch (key->type) { + switch (Z_TYPE_P(key)) { case IS_LONG: zend_hash_index_update(myht, Z_LVAL_P(key), &data, sizeof(data), NULL); break; @@ -585,7 +585,7 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has FREE_ZVAL(key); } - if ((*rval)->type == IS_OBJECT) { + if (Z_TYPE_PP(rval) == IS_OBJECT) { zval *retval_ptr = NULL; zval fname; @@ -617,9 +617,9 @@ PHP_FUNCTION(serialize) WRONG_PARAM_COUNT; } - return_value->type = IS_STRING; - return_value->value.str.val = NULL; - return_value->value.str.len = 0; + Z_TYPE_P(return_value) = IS_STRING; + Z_STRVAL_P(return_value) = NULL; + Z_STRLEN_P(return_value) = 0; PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&buf, struc, &var_hash TSRMLS_CC); @@ -641,8 +641,8 @@ PHP_FUNCTION(unserialize) WRONG_PARAM_COUNT; } - if ((*buf)->type == IS_STRING) { - const char *p = (*buf)->value.str.val; + if (Z_TYPE_PP(buf) == IS_STRING) { + const char *p = Z_STRVAL_PP(buf); if (Z_STRLEN_PP(buf) == 0) { RETURN_FALSE; |