diff options
author | Anatol Belski <ab@php.net> | 2014-08-16 11:37:14 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-08-16 11:37:14 +0200 |
commit | cb25136f4ef1042295650475b2c20ace81e2b9b7 (patch) | |
tree | 9d6a509c80f2ac1e094cd9d42772654781a79715 /ext | |
parent | f790043e30513c56f108289ec44ea6eb493f7773 (diff) | |
download | php-git-cb25136f4ef1042295650475b2c20ace81e2b9b7.tar.gz |
fix macros in the 5 basic extensions
Diffstat (limited to 'ext')
62 files changed, 1246 insertions, 1246 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 6cea2af048..168fe9c920 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -860,9 +860,9 @@ PHP_MINIT_FUNCTION(date) REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT); php_date_global_timezone_db = NULL; php_date_global_timezone_db_enabled = 0; @@ -962,7 +962,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) zval ztz; if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz) - && Z_TYPE(ztz) == IS_STRING && Z_STRLEN(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { + && Z_TYPE(ztz) == IS_STRING && Z_STRSIZE(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { return Z_STRVAL(ztz); } } else if (*DATEG(default_timezone)) { @@ -1394,7 +1394,7 @@ PHP_FUNCTION(idate) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token."); RETURN_FALSE; } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1490,7 +1490,7 @@ PHP_FUNCTION(strtotime) if (error1 || error2) { RETURN_FALSE; } else { - RETURN_LONG(ts); + RETURN_INT(ts); } } /* }}} */ @@ -1582,7 +1582,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) if (error) { RETURN_FALSE; } else { - RETURN_LONG(ts); + RETURN_INT(ts); } } /* }}} */ @@ -1737,7 +1737,7 @@ PHP_FUNCTION(gmstrftime) Return current UNIX timestamp */ PHP_FUNCTION(time) { - RETURN_LONG((long)time(NULL)); + RETURN_INT((long)time(NULL)); } /* }}} */ @@ -1763,25 +1763,25 @@ PHP_FUNCTION(localtime) array_init(return_value); if (associative) { - add_assoc_long(return_value, "tm_sec", ts->s); - add_assoc_long(return_value, "tm_min", ts->i); - add_assoc_long(return_value, "tm_hour", ts->h); - add_assoc_long(return_value, "tm_mday", ts->d); - add_assoc_long(return_value, "tm_mon", ts->m - 1); - add_assoc_long(return_value, "tm_year", ts->y - 1900); - add_assoc_long(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d)); - add_assoc_long(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d)); - add_assoc_long(return_value, "tm_isdst", ts->dst); + add_assoc_int(return_value, "tm_sec", ts->s); + add_assoc_int(return_value, "tm_min", ts->i); + add_assoc_int(return_value, "tm_hour", ts->h); + add_assoc_int(return_value, "tm_mday", ts->d); + add_assoc_int(return_value, "tm_mon", ts->m - 1); + add_assoc_int(return_value, "tm_year", ts->y - 1900); + add_assoc_int(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d)); + add_assoc_int(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d)); + add_assoc_int(return_value, "tm_isdst", ts->dst); } else { - add_next_index_long(return_value, ts->s); - add_next_index_long(return_value, ts->i); - add_next_index_long(return_value, ts->h); - add_next_index_long(return_value, ts->d); - add_next_index_long(return_value, ts->m - 1); - add_next_index_long(return_value, ts->y- 1900); - add_next_index_long(return_value, timelib_day_of_week(ts->y, ts->m, ts->d)); - add_next_index_long(return_value, timelib_day_of_year(ts->y, ts->m, ts->d)); - add_next_index_long(return_value, ts->dst); + add_next_index_int(return_value, ts->s); + add_next_index_int(return_value, ts->i); + add_next_index_int(return_value, ts->h); + add_next_index_int(return_value, ts->d); + add_next_index_int(return_value, ts->m - 1); + add_next_index_int(return_value, ts->y- 1900); + add_next_index_int(return_value, timelib_day_of_week(ts->y, ts->m, ts->d)); + add_next_index_int(return_value, timelib_day_of_year(ts->y, ts->m, ts->d)); + add_next_index_int(return_value, ts->dst); } timelib_time_dtor(ts); @@ -1808,17 +1808,17 @@ PHP_FUNCTION(getdate) array_init(return_value); - add_assoc_long(return_value, "seconds", ts->s); - add_assoc_long(return_value, "minutes", ts->i); - add_assoc_long(return_value, "hours", ts->h); - add_assoc_long(return_value, "mday", ts->d); - add_assoc_long(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d)); - add_assoc_long(return_value, "mon", ts->m); - add_assoc_long(return_value, "year", ts->y); - add_assoc_long(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d)); + add_assoc_int(return_value, "seconds", ts->s); + add_assoc_int(return_value, "minutes", ts->i); + add_assoc_int(return_value, "hours", ts->h); + add_assoc_int(return_value, "mday", ts->d); + add_assoc_int(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d)); + add_assoc_int(return_value, "mon", ts->m); + add_assoc_int(return_value, "year", ts->y); + add_assoc_int(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d)); add_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d)); add_assoc_string(return_value, "month", mon_full_names[ts->m - 1]); - add_index_long(return_value, 0, timestamp); + add_index_int(return_value, 0, timestamp); timelib_time_dtor(ts); } @@ -1925,7 +1925,7 @@ static zval *date_period_it_current_data(zend_object_iterator *iter TSRMLS_DC) static void date_period_it_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) { date_period_it *iterator = (date_period_it *)iter; - ZVAL_LONG(key, iterator->current_index); + ZVAL_INT(key, iterator->current_index); } /* }}} */ @@ -2049,7 +2049,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */ date_object_handlers_timezone.get_gc = date_object_get_gc_timezone; #define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \ - zend_declare_class_constant_long(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC); + zend_declare_class_constant_int(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC); REGISTER_TIMEZONE_CLASS_CONST_STRING("AFRICA", PHP_DATE_TIMEZONE_GROUP_AFRICA); REGISTER_TIMEZONE_CLASS_CONST_STRING("AMERICA", PHP_DATE_TIMEZONE_GROUP_AMERICA); @@ -2096,7 +2096,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */ date_object_handlers_period.write_property = date_period_write_property; #define REGISTER_PERIOD_CLASS_CONST_STRING(const_name, value) \ - zend_declare_class_constant_long(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC); + zend_declare_class_constant_int(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC); REGISTER_PERIOD_CLASS_CONST_STRING("EXCLUDE_START_DATE", PHP_DATE_PERIOD_EXCLUDE_START_DATE); } /* }}} */ @@ -2203,7 +2203,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */ /* then we add the timezone name (or similar) */ if (dateobj->time->is_localtime) { - ZVAL_LONG(&zv, dateobj->time->zone_type); + ZVAL_INT(&zv, dateobj->time->zone_type); zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv); switch (dateobj->time->zone_type) { @@ -2296,7 +2296,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) /* return props; } - ZVAL_LONG(&zv, tzobj->type); + ZVAL_INT(&zv, tzobj->type); zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv); switch (tzobj->type) { @@ -2377,7 +2377,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) /* } #define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \ - ZVAL_LONG(&zv, (long)intervalobj->diff->f); \ + ZVAL_INT(&zv, (long)intervalobj->diff->f); \ zend_hash_str_update(props, n, sizeof(n)-1, &zv); PHP_DATE_INTERVAL_ADD_PROPERTY("y", y); @@ -2760,18 +2760,18 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht convert_to_string(z_date); z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1); if (z_timezone_type) { - convert_to_long(z_timezone_type); + convert_to_int(z_timezone_type); z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1); if (z_timezone) { convert_to_string(z_timezone); - switch (Z_LVAL_P(z_timezone_type)) { + switch (Z_IVAL_P(z_timezone_type)) { case TIMELIB_ZONETYPE_OFFSET: case TIMELIB_ZONETYPE_ABBR: { - char *tmp = emalloc(Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2); + char *tmp = emalloc(Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2); int ret; - snprintf(tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone)); - ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); + snprintf(tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone)); + ret = php_date_initialize(*dateobj, tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); efree(tmp); return 1 == ret; } @@ -2791,7 +2791,7 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht tzobj->tzi.tz = tzi; tzobj->initialized = 1; - ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRLEN_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC); + ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRSIZE_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC); zval_ptr_dtor(&tmp_obj); return 1 == ret; } @@ -2870,14 +2870,14 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) / int i; zval element; - add_assoc_long(z, "warning_count", error->warning_count); + add_assoc_int(z, "warning_count", error->warning_count); array_init(&element); for (i = 0; i < error->warning_count; i++) { add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message); } add_assoc_zval(z, "warnings", &element); - add_assoc_long(z, "error_count", error->error_count); + add_assoc_int(z, "error_count", error->error_count); array_init(&element); for (i = 0; i < error->error_count; i++) { add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message); @@ -2908,7 +2908,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * if (parsed_time->elem == -99999) { \ add_assoc_bool(return_value, #name, 0); \ } else { \ - add_assoc_long(return_value, #name, parsed_time->elem); \ + add_assoc_int(return_value, #name, parsed_time->elem); \ } PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(year, y); PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(month, m); @@ -2953,17 +2953,17 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * } if (parsed_time->have_relative) { array_init(&element); - add_assoc_long(&element, "year", parsed_time->relative.y); - add_assoc_long(&element, "month", parsed_time->relative.m); - add_assoc_long(&element, "day", parsed_time->relative.d); - add_assoc_long(&element, "hour", parsed_time->relative.h); - add_assoc_long(&element, "minute", parsed_time->relative.i); - add_assoc_long(&element, "second", parsed_time->relative.s); + add_assoc_int(&element, "year", parsed_time->relative.y); + add_assoc_int(&element, "month", parsed_time->relative.m); + add_assoc_int(&element, "day", parsed_time->relative.d); + add_assoc_int(&element, "hour", parsed_time->relative.h); + add_assoc_int(&element, "minute", parsed_time->relative.i); + add_assoc_int(&element, "second", parsed_time->relative.s); if (parsed_time->relative.have_weekday_relative) { - add_assoc_long(&element, "weekday", parsed_time->relative.weekday); + add_assoc_int(&element, "weekday", parsed_time->relative.weekday); } if (parsed_time->relative.have_special_relative && (parsed_time->relative.special.type == TIMELIB_SPECIAL_WEEKDAY)) { - add_assoc_long(&element, "weekdays", parsed_time->relative.special.amount); + add_assoc_int(&element, "weekdays", parsed_time->relative.special.amount); } if (parsed_time->relative.first_last_day_of) { add_assoc_bool(&element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1); @@ -3360,19 +3360,19 @@ PHP_FUNCTION(date_offset_get) switch (dateobj->time->zone_type) { case TIMELIB_ZONETYPE_ID: offset = timelib_get_time_zone_info(dateobj->time->sse, dateobj->time->tz_info); - RETVAL_LONG(offset->offset); + RETVAL_INT(offset->offset); timelib_time_offset_dtor(offset); break; case TIMELIB_ZONETYPE_OFFSET: - RETVAL_LONG(dateobj->time->z * -60); + RETVAL_INT(dateobj->time->z * -60); break; case TIMELIB_ZONETYPE_ABBR: - RETVAL_LONG((dateobj->time->z - (60 * dateobj->time->dst)) * -60); + RETVAL_INT((dateobj->time->z - (60 * dateobj->time->dst)) * -60); break; } return; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ @@ -3592,7 +3592,7 @@ PHP_FUNCTION(date_timestamp_get) if (error) { RETURN_FALSE; } else { - RETVAL_LONG(timestamp); + RETVAL_INT(timestamp); } } /* }}} */ @@ -3692,7 +3692,7 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez if ((z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1)) != NULL) { if ((z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1)) != NULL) { - convert_to_long(z_timezone_type); + convert_to_int(z_timezone_type); if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_P(z_timezone) TSRMLS_CC)) { return SUCCESS; } @@ -3819,14 +3819,14 @@ PHP_FUNCTION(timezone_offset_get) switch (tzobj->type) { case TIMELIB_ZONETYPE_ID: offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz); - RETVAL_LONG(offset->offset); + RETVAL_INT(offset->offset); timelib_time_offset_dtor(offset); break; case TIMELIB_ZONETYPE_OFFSET: - RETURN_LONG(tzobj->tzi.utc_offset * -60); + RETURN_INT(tzobj->tzi.utc_offset * -60); break; case TIMELIB_ZONETYPE_ABBR: - RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60); + RETURN_INT((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60); break; } } @@ -3853,18 +3853,18 @@ PHP_FUNCTION(timezone_transitions_get) #define add_nominal() \ array_init(&element); \ - add_assoc_long(&element, "ts", timestamp_begin); \ + add_assoc_int(&element, "ts", timestamp_begin); \ add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC)); \ - add_assoc_long(&element, "offset", tzobj->tzi.tz->type[0].offset); \ + add_assoc_int(&element, "offset", tzobj->tzi.tz->type[0].offset); \ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[0].isdst); \ add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx]); \ add_next_index_zval(return_value, &element); #define add(i,ts) \ array_init(&element); \ - add_assoc_long(&element, "ts", ts); \ + add_assoc_int(&element, "ts", ts); \ add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC)); \ - add_assoc_long(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \ + add_assoc_int(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \ add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx]); \ add_next_index_zval(return_value, &element); @@ -4023,7 +4023,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c retval = rv; if (value != -99999) { - ZVAL_LONG(retval, value); + ZVAL_INT(retval, value); } else { ZVAL_FALSE(retval); } @@ -4496,7 +4496,7 @@ PHP_FUNCTION(timezone_abbreviations_list) do { array_init(&element); add_assoc_bool(&element, "dst", entry->type); - add_assoc_long(&element, "offset", entry->gmtoffset); + add_assoc_int(&element, "offset", entry->gmtoffset); if (entry->full_tz_name) { add_assoc_string(&element, "timezone_id", entry->full_tz_name); } else { @@ -4617,7 +4617,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su } if (retformat == SUNFUNCS_RET_TIMESTAMP) { - RETURN_LONG(calc_sunset ? set : rise); + RETURN_INT(calc_sunset ? set : rise); } N = (calc_sunset ? h_set : h_rise) + gmt_offset; @@ -4693,12 +4693,12 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_long(return_value, "sunrise", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "sunrise", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_long(return_value, "sunset", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "sunset", timelib_date_to_int(t2, &dummy)); } t2->sse = transit; - add_assoc_long(return_value, "transit", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "transit", timelib_date_to_int(t2, &dummy)); /* Get civil twilight */ rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -6.0, 0, &ddummy, &ddummy, &rise, &set, &transit); @@ -4713,9 +4713,9 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_long(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_long(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy)); } /* Get nautical twilight */ @@ -4731,9 +4731,9 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_long(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_long(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy)); } /* Get astronomical twilight */ @@ -4749,9 +4749,9 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_long(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_long(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy)); } timelib_time_dtor(t); timelib_time_dtor(t2); @@ -4821,7 +4821,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC) /* { zend_hash_str_update(props, "interval", sizeof("interval")-1, &zv); /* converted to larger type (int->long); must check when unserializing */ - ZVAL_LONG(&zv, (long) period_obj->recurrences); + ZVAL_INT(&zv, (long) period_obj->recurrences); zend_hash_str_update(props, "recurrences", sizeof("recurrences")-1, &zv); ZVAL_BOOL(&zv, period_obj->include_start_date); @@ -4891,8 +4891,8 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash ht_entry = zend_hash_str_find(myht, "recurrences", sizeof("recurrences")-1); if (ht_entry && - Z_TYPE_P(ht_entry) == IS_LONG && Z_LVAL_P(ht_entry) >= 0 && Z_LVAL_P(ht_entry) <= INT_MAX) { - period_obj->recurrences = Z_LVAL_P(ht_entry); + Z_TYPE_P(ht_entry) == IS_INT && Z_IVAL_P(ht_entry) >= 0 && Z_IVAL_P(ht_entry) <= INT_MAX) { + period_obj->recurrences = Z_IVAL_P(ht_entry); } else { return 0; } diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index 79bee9b79f..280b54a43d 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -323,7 +323,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) } else { /* we convert numbers to integers and treat them as a string */ if (Z_TYPE_P(regex) == IS_DOUBLE) { - convert_to_long_ex(regex); /* get rid of decimal places */ + convert_to_int_ex(regex); /* get rid of decimal places */ } convert_to_string_ex(regex); /* don't bother doing an extended regex with just a number */ @@ -379,7 +379,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) } else { if (match_len == 0) match_len = 1; - RETVAL_LONG(match_len); + RETVAL_INT(match_len); } regfree(&re); } @@ -564,28 +564,28 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) } if (Z_TYPE_P(arg_pattern) == IS_STRING) { - if (Z_STRVAL_P(arg_pattern) && Z_STRLEN_P(arg_pattern)) { + if (Z_STRVAL_P(arg_pattern) && Z_STRSIZE_P(arg_pattern)) { pattern = STR_COPY(Z_STR_P(arg_pattern)); } else { pattern = STR_EMPTY_ALLOC(); } } else { - convert_to_long_ex(arg_pattern); + convert_to_int_ex(arg_pattern); pattern = STR_ALLOC(1, 0); - pattern->val[0] = (char) Z_LVAL_P(arg_pattern); + pattern->val[0] = (char) Z_IVAL_P(arg_pattern); pattern->val[1] = '\0'; } if (Z_TYPE_P(arg_replace) == IS_STRING) { - if (Z_STRVAL_P(arg_replace) && Z_STRLEN_P(arg_replace)) { + if (Z_STRVAL_P(arg_replace) && Z_STRSIZE_P(arg_replace)) { replace = STR_COPY(Z_STR_P(arg_replace)); } else { replace = STR_EMPTY_ALLOC(); } } else { - convert_to_long_ex(arg_replace); + convert_to_int_ex(arg_replace); replace = STR_ALLOC(1, 0); - replace->val[0] = (char) Z_LVAL_P(arg_replace); + replace->val[0] = (char) Z_IVAL_P(arg_replace); replace->val[1] = '\0'; } diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 4731db21fb..ddfccc3763 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -143,20 +143,20 @@ static PHP_MINIT_FUNCTION(pcre) { REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("PREG_NO_ERROR", PHP_PCRE_NO_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_INTERNAL_ERROR", PHP_PCRE_INTERNAL_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_BACKTRACK_LIMIT_ERROR", PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_RECURSION_LIMIT_ERROR", PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_ERROR", PHP_PCRE_BAD_UTF8_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_OFFSET_ERROR", PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("PREG_NO_ERROR", PHP_PCRE_NO_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_INTERNAL_ERROR", PHP_PCRE_INTERNAL_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_BACKTRACK_LIMIT_ERROR", PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_RECURSION_LIMIT_ERROR", PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_BAD_UTF8_ERROR", PHP_PCRE_BAD_UTF8_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_BAD_UTF8_OFFSET_ERROR", PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("PCRE_VERSION", (char *)pcre_version(), CONST_CS | CONST_PERSISTENT); return SUCCESS; @@ -527,7 +527,7 @@ static inline void add_offset_pair(zval *result, char *str, int len, int offset, /* Add (match, offset) to the return value */ add_next_index_stringl(&match_pair, str, len); - add_next_index_long(&match_pair, offset); + add_next_index_int(&match_pair, offset); if (name) { zval_add_ref(&match_pair); @@ -888,7 +888,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec /* Did we encounter an error? */ if (PCRE_G(error_code) == PHP_PCRE_NO_ERROR) { - RETVAL_LONG(matched); + RETVAL_INT(matched); } else { RETVAL_FALSE; } @@ -1142,7 +1142,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, } } else { replace = Z_STRVAL_P(replace_val); - replace_len = Z_STRLEN_P(replace_val); + replace_len = Z_STRSIZE_P(replace_val); replace_end = replace + replace_len; } @@ -1519,7 +1519,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl } if (ZEND_NUM_ARGS() > 4) { zval_dtor(zcount); - ZVAL_LONG(zcount, replace_count); + ZVAL_INT(zcount, replace_count); } } @@ -1988,7 +1988,7 @@ static PHP_FUNCTION(preg_last_error) ZEND_PARSE_PARAMETERS_END(); #endif - RETURN_LONG(PCRE_G(error_code)); + RETURN_INT(PCRE_G(error_code)); } /* }}} */ diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 4248de834d..639016179f 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -110,8 +110,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) target = intern->ptr; \ /* Class constants */ -#define REGISTER_REFLECTION_CLASS_CONST_LONG(class_name, const_name, value) \ - zend_declare_class_constant_long(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_REFLECTION_CLASS_CONST_INT(class_name, const_name, value) \ + zend_declare_class_constant_int(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); /* {{{ Smart string functions */ typedef struct _string { @@ -738,8 +738,8 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg string_write(str, "NULL", sizeof("NULL")-1); } else if (Z_TYPE(zv) == IS_STRING) { string_write(str, "'", sizeof("'")-1); - string_write(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15)); - if (Z_STRLEN(zv) > 15) { + string_write(str, Z_STRVAL(zv), MIN(Z_STRSIZE(zv), 15)); + if (Z_STRSIZE(zv) > 15) { string_write(str, "...", sizeof("...")-1); } string_write(str, "'", sizeof("'")-1); @@ -1817,7 +1817,7 @@ ZEND_METHOD(reflection_function, getStartLine) } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { - RETURN_LONG(fptr->op_array.line_start); + RETURN_INT(fptr->op_array.line_start); } RETURN_FALSE; } @@ -1835,7 +1835,7 @@ ZEND_METHOD(reflection_function, getEndLine) } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { - RETURN_LONG(fptr->op_array.line_end); + RETURN_INT(fptr->op_array.line_end); } RETURN_FALSE; } @@ -2018,7 +2018,7 @@ ZEND_METHOD(reflection_function, getNumberOfParameters) METHOD_NOTSTATIC(reflection_function_abstract_ptr); GET_REFLECTION_OBJECT_PTR(fptr); - RETURN_LONG(fptr->common.num_args); + RETURN_INT(fptr->common.num_args); } /* }}} */ @@ -2032,7 +2032,7 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters) METHOD_NOTSTATIC(reflection_function_abstract_ptr); GET_REFLECTION_OBJECT_PTR(fptr); - RETURN_LONG(fptr->common.required_num_args); + RETURN_INT(fptr->common.required_num_args); } /* }}} */ @@ -2149,7 +2149,7 @@ ZEND_METHOD(reflection_parameter, __construct) unsigned int lcname_len; char *lcname; - lcname_len = Z_STRLEN_P(reference); + lcname_len = Z_STRSIZE_P(reference); lcname = zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len); if ((fptr = zend_hash_str_find_ptr(EG(function_table), lcname, lcname_len)) == NULL) { efree(lcname); @@ -2187,7 +2187,7 @@ ZEND_METHOD(reflection_parameter, __construct) } convert_to_string_ex(method); - lcname_len = Z_STRLEN_P(method); + lcname_len = Z_STRSIZE_P(method); lcname = zend_str_tolower_dup(Z_STRVAL_P(method), lcname_len); if (ce == zend_ce_closure && Z_TYPE_P(classref) == IS_OBJECT && (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) @@ -2228,8 +2228,8 @@ ZEND_METHOD(reflection_parameter, __construct) /* Now, search for the parameter */ arg_info = fptr->common.arg_info; - if (Z_TYPE_P(parameter) == IS_LONG) { - position= Z_LVAL_P(parameter); + if (Z_TYPE_P(parameter) == IS_INT) { + position= Z_IVAL_P(parameter); if (position < 0 || (zend_uint)position >= fptr->common.num_args) { if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) { if (fptr->type != ZEND_OVERLOADED_FUNCTION) { @@ -2512,7 +2512,7 @@ ZEND_METHOD(reflection_parameter, getPosition) } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_LONG(param->offset); + RETVAL_INT(param->offset); } /* }}} */ @@ -3112,7 +3112,7 @@ ZEND_METHOD(reflection_function, inNamespace) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_TRUE; @@ -3135,7 +3135,7 @@ ZEND_METHOD(reflection_function, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name)); @@ -3158,10 +3158,10 @@ ZEND_METHOD(reflection_function, getShortName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { - RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1)); + RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1)); } RETURN_ZVAL(name, 1, 0); } @@ -3212,7 +3212,7 @@ ZEND_METHOD(reflection_method, getModifiers) } GET_REFLECTION_OBJECT_PTR(mptr); - RETURN_LONG(mptr->common.fn_flags); + RETURN_INT(mptr->common.fn_flags); } /* }}} */ @@ -3575,7 +3575,7 @@ ZEND_METHOD(reflection_class, getStartLine) } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_FUNCTION) { - RETURN_LONG(ce->info.user.line_start); + RETURN_INT(ce->info.user.line_start); } RETURN_FALSE; } @@ -3593,7 +3593,7 @@ ZEND_METHOD(reflection_class, getEndLine) } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS) { - RETURN_LONG(ce->info.user.line_end); + RETURN_INT(ce->info.user.line_end); } RETURN_FALSE; } @@ -4146,7 +4146,7 @@ ZEND_METHOD(reflection_class, getModifiers) } GET_REFLECTION_OBJECT_PTR(ce); - RETURN_LONG(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED); + RETURN_INT(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED); } /* }}} */ @@ -4657,7 +4657,7 @@ ZEND_METHOD(reflection_class, inNamespace) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_TRUE; @@ -4680,7 +4680,7 @@ ZEND_METHOD(reflection_class, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name)); @@ -4703,10 +4703,10 @@ ZEND_METHOD(reflection_class, getShortName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { - RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1)); + RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1)); } RETURN_ZVAL(name, 1, 0); } @@ -4926,7 +4926,7 @@ ZEND_METHOD(reflection_property, getModifiers) } GET_REFLECTION_OBJECT_PTR(ref); - RETURN_LONG(ref->prop.flags); + RETURN_INT(ref->prop.flags); } /* }}} */ @@ -6058,8 +6058,8 @@ static void _reflection_write_property(zval *object, zval *member, zval *value, { if ((Z_TYPE_P(member) == IS_STRING) && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member)) - && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) - || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) + && ((Z_STRSIZE_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) + || (Z_STRSIZE_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name->val, Z_STRVAL_P(member)); @@ -6102,7 +6102,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ reflection_function_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr TSRMLS_CC); zend_declare_property_string(reflection_function_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_LONG(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED); + REGISTER_REFLECTION_CLASS_CONST_INT(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", reflection_parameter_functions); _reflection_entry.create_object = reflection_objects_new; @@ -6116,12 +6116,12 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ zend_declare_property_string(reflection_method_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_string(reflection_method_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_STATIC", ZEND_ACC_STATIC); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PUBLIC", ZEND_ACC_PUBLIC); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PROTECTED", ZEND_ACC_PROTECTED); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PRIVATE", ZEND_ACC_PRIVATE); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_FINAL", ZEND_ACC_FINAL); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_STATIC", ZEND_ACC_STATIC); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PUBLIC", ZEND_ACC_PUBLIC); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PROTECTED", ZEND_ACC_PROTECTED); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PRIVATE", ZEND_ACC_PRIVATE); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_FINAL", ZEND_ACC_FINAL); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", reflection_class_functions); _reflection_entry.create_object = reflection_objects_new; @@ -6129,9 +6129,9 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ reflection_register_implement(reflection_class_ptr, reflector_ptr TSRMLS_CC); zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS); - REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS); + REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS); + REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions); _reflection_entry.create_object = reflection_objects_new; @@ -6144,10 +6144,10 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ zend_declare_property_string(reflection_property_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_string(reflection_property_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_STATIC", ZEND_ACC_STATIC); - REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PUBLIC", ZEND_ACC_PUBLIC); - REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PROTECTED", ZEND_ACC_PROTECTED); - REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PRIVATE", ZEND_ACC_PRIVATE); + REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_STATIC", ZEND_ACC_STATIC); + REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PUBLIC", ZEND_ACC_PUBLIC); + REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PROTECTED", ZEND_ACC_PROTECTED); + REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PRIVATE", ZEND_ACC_PRIVATE); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", reflection_extension_functions); _reflection_entry.create_object = reflection_objects_new; diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 62cf6ae144..530a0c80ee 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -417,8 +417,8 @@ PHP_FUNCTION(spl_autoload_call) if (SPL_G(autoload_functions)) { int l_autoload_running = SPL_G(autoload_running); SPL_G(autoload_running) = 1; - lc_name = STR_ALLOC(Z_STRLEN_P(class_name), 0); - zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name)); + lc_name = STR_ALLOC(Z_STRSIZE_P(class_name), 0); + zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name)); ZEND_HASH_FOREACH_STR_KEY_PTR(SPL_G(autoload_functions), func_name, alfi) { zend_call_method(Z_ISUNDEF(alfi->obj)? NULL : &alfi->obj, alfi->ce, &alfi->func_ptr, func_name->val, func_name->len, retval, 1, class_name, NULL TSRMLS_CC); zend_exception_save(TSRMLS_C); diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 720a704e92..c7d9a951b8 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -372,8 +372,8 @@ fetch_dim_string: case IS_TRUE: index = 1; goto num_index; - case IS_LONG: - index = Z_LVAL_P(offset); + case IS_INT: + index = Z_IVAL_P(offset); num_index: if ((retval = zend_hash_index_find(ht, index)) == NULL) { switch (type) { @@ -504,8 +504,8 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval case IS_TRUE: index = 1; goto num_index; - case IS_LONG: - index = Z_LVAL_P(offset); + case IS_INT: + index = Z_IVAL_P(offset); num_index: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->u.v.nApplyCount > 0) { @@ -596,8 +596,8 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval case IS_TRUE: index = 1; goto num_index; - case IS_LONG: - index = Z_LVAL_P(offset); + case IS_INT: + index = Z_IVAL_P(offset); num_index: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->u.v.nApplyCount > 0) { @@ -675,8 +675,8 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o case IS_TRUE: index = 1; goto num_index; - case IS_LONG: - index = Z_LVAL_P(offset); + case IS_INT: + index = Z_IVAL_P(offset); num_index: if ((tmp = zend_hash_index_find(ht, index)) != NULL) { if (check_empty == 2) { @@ -957,7 +957,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ ht2 = spl_array_get_hash_table(intern2, 0 TSRMLS_CC); zend_compare_symbol_tables(&temp_zv, ht1, ht2 TSRMLS_CC); - result = (int)Z_LVAL(temp_zv); + result = (int)Z_IVAL(temp_zv); /* if we just compared std.properties, don't do it again */ if (result == 0 && !(ht1 == intern1->std.properties && ht2 == intern2->std.properties)) { @@ -1302,7 +1302,7 @@ SPL_METHOD(Array, getFlags) return; } - RETURN_LONG(intern->ar_flags & ~SPL_ARRAY_INT_MASK); + RETURN_INT(intern->ar_flags & ~SPL_ARRAY_INT_MASK); } /* }}} */ @@ -1449,8 +1449,8 @@ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ if (Z_TYPE(rv) != IS_UNDEF) { zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); - convert_to_long(&intern->retval); - *count = (long)Z_LVAL(intern->retval); + convert_to_int(&intern->retval); + *count = (long)Z_IVAL(intern->retval); return SUCCESS; } *count = 0; @@ -1473,7 +1473,7 @@ SPL_METHOD(Array, count) spl_array_object_count_elements_helper(intern, &count TSRMLS_CC); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */ @@ -1706,7 +1706,7 @@ SPL_METHOD(Array, getChildren) } } - ZVAL_LONG(&flags, SPL_ARRAY_USE_OTHER | intern->ar_flags); + ZVAL_INT(&flags, SPL_ARRAY_USE_OTHER | intern->ar_flags); spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, entry, &flags TSRMLS_CC); } /* }}} */ @@ -1733,7 +1733,7 @@ SPL_METHOD(Array, serialize) PHP_VAR_SERIALIZE_INIT(var_hash); - ZVAL_LONG(&flags, (intern->ar_flags & SPL_ARRAY_CLONE_MASK)); + ZVAL_INT(&flags, (intern->ar_flags & SPL_ARRAY_CLONE_MASK)); /* storage */ smart_str_appendl(&buf, "x:", 2); @@ -1806,12 +1806,12 @@ SPL_METHOD(Array, unserialize) } ++p; - if (!php_var_unserialize(&zflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE(zflags) != IS_LONG) { + if (!php_var_unserialize(&zflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE(zflags) != IS_INT) { goto outexcept; } --p; /* for ';' */ - flags = Z_LVAL(zflags); + flags = Z_IVAL(zflags); /* flags needs to be verified and we also need to verify whether the next * thing we get is ';'. After that we require an 'm' or somethign else * where 'm' stands for members and anything else should be an array. If @@ -2018,13 +2018,13 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator); spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator; - REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); - REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); + REGISTER_SPL_CLASS_CONST_INT(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); + REGISTER_SPL_CLASS_CONST_INT(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); - REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); - REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); + REGISTER_SPL_CLASS_CONST_INT(ArrayIterator, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); + REGISTER_SPL_CLASS_CONST_INT(ArrayIterator, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, "CHILD_ARRAYS_ONLY", SPL_ARRAY_CHILD_ARRAYS_ONLY); + REGISTER_SPL_CLASS_CONST_INT(RecursiveArrayIterator, "CHILD_ARRAYS_ONLY", SPL_ARRAY_CHILD_ARRAYS_ONLY); return SUCCESS; } diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index f9fe83e26d..f0c377bd33 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -767,7 +767,7 @@ SPL_METHOD(DirectoryIterator, key) } if (intern->u.dir.dirp) { - RETURN_LONG(intern->u.dir.index); + RETURN_INT(intern->u.dir.index); } else { RETURN_FALSE; } @@ -1445,7 +1445,7 @@ SPL_METHOD(FilesystemIterator, getFlags) return; } - RETURN_LONG(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK)); + RETURN_INT(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK)); } /* }}} */ /* {{{ proto void FilesystemIterator::setFlags(long $flags) @@ -1506,7 +1506,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren) if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { RETURN_STRINGL(intern->file_name, intern->file_name_len); } else { - ZVAL_LONG(&zflags, intern->flags); + ZVAL_INT(&zflags, intern->flags); ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len); spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &zpath, &zflags TSRMLS_CC); zval_ptr_dtor(&zpath); @@ -1597,7 +1597,7 @@ SPL_METHOD(GlobIterator, count) } if (intern->u.dir.dirp && php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { - RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); + RETURN_INT(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); } else { /* should not happen */ php_error_docref(NULL TSRMLS_CC, E_ERROR, "GlobIterator lost glob state"); @@ -1686,7 +1686,7 @@ static void spl_filesystem_dir_it_current_key(zend_object_iterator *iter, zval * { spl_filesystem_object *object = spl_filesystem_iterator_to_object((spl_filesystem_iterator *)iter TSRMLS_CC); - ZVAL_LONG(key, object->u.dir.index); + ZVAL_INT(key, object->u.dir.index); } /* }}} */ @@ -2177,8 +2177,8 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje } spl_filesystem_file_free_line(intern TSRMLS_CC); if (Z_TYPE(retval) == IS_STRING) { - intern->u.file.current_line = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); - intern->u.file.current_line_len = Z_STRLEN(retval); + intern->u.file.current_line = estrndup(Z_STRVAL(retval), Z_STRSIZE(retval)); + intern->u.file.current_line_len = Z_STRSIZE(retval); } else { ZVAL_ZVAL(&intern->u.file.current_zval, &retval, 1, 0); } @@ -2199,7 +2199,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML } else if (!Z_ISUNDEF(intern->u.file.current_zval)) { switch(Z_TYPE(intern->u.file.current_zval)) { case IS_STRING: - return Z_STRLEN(intern->u.file.current_zval) == 0; + return Z_STRSIZE(intern->u.file.current_zval) == 0; case IS_ARRAY: if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV) && zend_hash_num_elements(Z_ARRVAL(intern->u.file.current_zval)) == 1) { @@ -2210,7 +2210,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML idx++; } first = &Z_ARRVAL(intern->u.file.current_zval)->arData[idx].val; - return Z_TYPE_P(first) == IS_STRING && Z_STRLEN_P(first) == 0; + return Z_TYPE_P(first) == IS_STRING && Z_STRSIZE_P(first) == 0; } return zend_hash_num_elements(Z_ARRVAL(intern->u.file.current_zval)) == 0; case IS_NULL: @@ -2463,7 +2463,7 @@ SPL_METHOD(SplFileObject, key) if (!intern->current_line) { spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC); } */ - RETURN_LONG(intern->u.file.current_line_num); + RETURN_INT(intern->u.file.current_line_num); } /* }}} */ /* {{{ proto void SplFileObject::next() @@ -2504,7 +2504,7 @@ SPL_METHOD(SplFileObject, getFlags) return; } - RETURN_LONG(intern->flags & SPL_FILE_OBJECT_MASK); + RETURN_INT(intern->flags & SPL_FILE_OBJECT_MASK); } /* }}} */ /* {{{ proto void SplFileObject::setMaxLineLen(int max_len) @@ -2537,7 +2537,7 @@ SPL_METHOD(SplFileObject, getMaxLineLen) return; } - RETURN_LONG((long)intern->u.file.max_line_len); + RETURN_INT((long)intern->u.file.max_line_len); } /* }}} */ /* {{{ proto bool SplFileObject::hasChildren() @@ -2649,7 +2649,7 @@ SPL_METHOD(SplFileObject, fputcsv) break; } ret = php_fputcsv(intern->u.file.stream, fields, delimiter, enclosure, escape TSRMLS_CC); - RETURN_LONG(ret); + RETURN_INT(ret); } } /* }}} */ @@ -2752,7 +2752,7 @@ SPL_METHOD(SplFileObject, ftell) if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(ret); + RETURN_INT(ret); } } /* }}} */ @@ -2773,7 +2773,7 @@ SPL_METHOD(SplFileObject, fseek) } spl_filesystem_file_free_line(intern TSRMLS_CC); - RETURN_LONG(php_stream_seek(intern->u.file.stream, pos, whence)); + RETURN_INT(php_stream_seek(intern->u.file.stream, pos, whence)); } /* }}} */ /* {{{ proto int SplFileObject::fgetc() @@ -2819,9 +2819,9 @@ SPL_METHOD(SplFileObject, fgetss) } if (intern->u.file.max_line_len > 0) { - ZVAL_LONG(&arg2, intern->u.file.max_line_len); + ZVAL_INT(&arg2, intern->u.file.max_line_len); } else { - ZVAL_LONG(&arg2, 1024); + ZVAL_INT(&arg2, 1024); } spl_filesystem_file_free_line(intern TSRMLS_CC); @@ -2841,7 +2841,7 @@ SPL_METHOD(SplFileObject, fpassthru) return; } - RETURN_LONG(php_stream_passthru(intern->u.file.stream)); + RETURN_INT(php_stream_passthru(intern->u.file.stream)); } /* }}} */ /* {{{ proto bool SplFileObject::fscanf(string format [, string ...]) @@ -2884,10 +2884,10 @@ SPL_METHOD(SplFileObject, fwrite) str_len = MAX(0, MIN(length, str_len)); } if (!str_len) { - RETURN_LONG(0); + RETURN_INT(0); } - RETURN_LONG(php_stream_write(intern->u.file.stream, str, str_len)); + RETURN_INT(php_stream_write(intern->u.file.stream, str, str_len)); } /* }}} */ SPL_METHOD(SplFileObject, fread) @@ -2910,10 +2910,10 @@ SPL_METHOD(SplFileObject, fread) } ZVAL_STR(return_value, STR_ALLOC(length, 0)); - Z_STRLEN_P(return_value) = php_stream_read(intern->u.file.stream, Z_STRVAL_P(return_value), length); + Z_STRSIZE_P(return_value) = php_stream_read(intern->u.file.stream, Z_STRVAL_P(return_value), length); /* needed because recv/read/gzread doesnt put a null at the end*/ - Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; + Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0; } /* {{{ proto bool SplFileObject::fstat() @@ -3110,18 +3110,18 @@ PHP_MINIT_FUNCTION(spl_directory) REGISTER_SPL_SUB_CLASS_EX(FilesystemIterator, DirectoryIterator, spl_filesystem_object_new, spl_FilesystemIterator_functions); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "FOLLOW_SYMLINKS", SPL_FILE_DIR_FOLLOW_SYMLINKS); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "OTHER_MODE_MASK", SPL_FILE_DIR_OTHERS_MASK); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "FOLLOW_SYMLINKS", SPL_FILE_DIR_FOLLOW_SYMLINKS); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "OTHER_MODE_MASK", SPL_FILE_DIR_OTHERS_MASK); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS); spl_ce_FilesystemIterator->get_iterator = spl_filesystem_tree_get_iterator; @@ -3140,10 +3140,10 @@ PHP_MINIT_FUNCTION(spl_directory) REGISTER_SPL_IMPLEMENTS(SplFileObject, RecursiveIterator); REGISTER_SPL_IMPLEMENTS(SplFileObject, SeekableIterator); - REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE); - REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_AHEAD", SPL_FILE_OBJECT_READ_AHEAD); - REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "SKIP_EMPTY", SPL_FILE_OBJECT_SKIP_EMPTY); - REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_CSV", SPL_FILE_OBJECT_READ_CSV); + REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE); + REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "READ_AHEAD", SPL_FILE_OBJECT_READ_AHEAD); + REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "SKIP_EMPTY", SPL_FILE_OBJECT_SKIP_EMPTY); + REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "READ_CSV", SPL_FILE_OBJECT_READ_CSV); REGISTER_SPL_SUB_CLASS_EX(SplTempFileObject, SplFileObject, spl_filesystem_object_new_check, spl_SplTempFileObject_functions); return SUCCESS; diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 09d874645d..e6dcc53691 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -484,8 +484,8 @@ static int spl_dllist_object_count_elements(zval *object, long *count TSRMLS_DC) if (!Z_ISUNDEF(rv)) { zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); - convert_to_long(&intern->retval); - *count = (long) Z_LVAL(intern->retval); + convert_to_int(&intern->retval); + *count = (long) Z_IVAL(intern->retval); return SUCCESS; } *count = 0; @@ -520,7 +520,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "flags", sizeof("flags")-1 TSRMLS_CC); - ZVAL_LONG(&tmp, intern->flags); + ZVAL_INT(&tmp, intern->flags); zend_hash_add(intern->debug_info, pnstr, &tmp); STR_RELEASE(pnstr); @@ -681,7 +681,7 @@ SPL_METHOD(SplDoublyLinkedList, count) } count = spl_ptr_llist_count(intern->llist); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ @@ -721,7 +721,7 @@ SPL_METHOD(SplDoublyLinkedList, setIteratorMode) intern->flags = value & SPL_DLLIST_IT_MASK; - RETURN_LONG(intern->flags); + RETURN_INT(intern->flags); } /* }}} */ @@ -737,7 +737,7 @@ SPL_METHOD(SplDoublyLinkedList, getIteratorMode) intern = Z_SPLDLLIST_P(getThis()); - RETURN_LONG(intern->flags); + RETURN_INT(intern->flags); } /* }}} */ @@ -754,7 +754,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists) } intern = Z_SPLDLLIST_P(getThis()); - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); RETURN_BOOL(index >= 0 && index < intern->llist->count); } /* }}} */ @@ -773,7 +773,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetGet) } intern = Z_SPLDLLIST_P(getThis()); - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); if (index < 0 || index >= intern->llist->count) { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC); @@ -811,7 +811,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet) long index; spl_ptr_llist_element *element; - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); if (index < 0 || index >= intern->llist->count) { zval_ptr_dtor(value); @@ -859,7 +859,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset) } intern = Z_SPLDLLIST_P(getThis()); - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); llist = intern->llist; if (index < 0 || index >= intern->llist->count) { @@ -1006,7 +1006,7 @@ static void spl_dllist_it_get_current_key(zend_object_iterator *iter, zval *key { spl_dllist_it *iterator = (spl_dllist_it *)iter; - ZVAL_LONG(key, iterator->traverse_position); + ZVAL_INT(key, iterator->traverse_position); } /* }}} */ @@ -1031,7 +1031,7 @@ SPL_METHOD(SplDoublyLinkedList, key) return; } - RETURN_LONG(intern->traverse_position); + RETURN_INT(intern->traverse_position); } /* }}} */ @@ -1127,7 +1127,7 @@ SPL_METHOD(SplDoublyLinkedList, serialize) PHP_VAR_SERIALIZE_INIT(var_hash); /* flags */ - ZVAL_LONG(&flags, intern->flags); + ZVAL_INT(&flags, intern->flags); php_var_serialize(&buf, &flags, &var_hash TSRMLS_CC); zval_ptr_dtor(&flags); @@ -1181,12 +1181,12 @@ SPL_METHOD(SplDoublyLinkedList, unserialize) goto error; } - if (Z_TYPE(flags) != IS_LONG) { + if (Z_TYPE(flags) != IS_INT) { zval_ptr_dtor(&flags); goto error; } - intern->flags = Z_LVAL(flags); + intern->flags = Z_IVAL(flags); zval_ptr_dtor(&flags); /* elements */ @@ -1228,7 +1228,7 @@ SPL_METHOD(SplDoublyLinkedList, add) } intern = Z_SPLDLLIST_P(getThis()); - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); if (index < 0 || index > intern->llist->count) { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC); @@ -1385,10 +1385,10 @@ PHP_MINIT_FUNCTION(spl_dllist) /* {{{ */ spl_handler_SplDoublyLinkedList.dtor_obj = zend_objects_destroy_object; spl_handler_SplDoublyLinkedList.free_obj = spl_dllist_object_free_storage; - REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_LIFO", SPL_DLLIST_IT_LIFO); - REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_FIFO", 0); - REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_DELETE",SPL_DLLIST_IT_DELETE); - REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_KEEP", 0); + REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_LIFO", SPL_DLLIST_IT_LIFO); + REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_FIFO", 0); + REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_DELETE",SPL_DLLIST_IT_DELETE); + REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_KEEP", 0); REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Iterator); REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Countable); diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index 0cfcb8ee18..0cd63dba78 100644 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -40,7 +40,7 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) } /* }}} */ -PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */ +PHPAPI long spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */ { ulong idx; @@ -52,8 +52,8 @@ PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */ break; case IS_DOUBLE: return (long)Z_DVAL_P(offset); - case IS_LONG: - return Z_LVAL_P(offset); + case IS_INT: + return Z_IVAL_P(offset); case IS_FALSE: return 0; case IS_TRUE: diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h index 8c72ca9691..1ddf6bcff3 100644 --- a/ext/spl/spl_engine.h +++ b/ext/spl/spl_engine.h @@ -27,7 +27,7 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC); -PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC); +PHPAPI long spl_offset_convert_to_int(zval *offset TSRMLS_DC); /* {{{ spl_instantiate_arg_ex1 */ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, zval *arg1 TSRMLS_DC) diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 62aaffbc3c..8b3486d627 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -337,10 +337,10 @@ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_o return NULL; } - if (Z_TYPE_P(offset) != IS_LONG) { - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_INT) { + index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_LVAL_P(offset); + index = Z_IVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -392,10 +392,10 @@ static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_o return; } - if (Z_TYPE_P(offset) != IS_LONG) { - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_INT) { + index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_LVAL_P(offset); + index = Z_IVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -440,10 +440,10 @@ static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_o { long index; - if (Z_TYPE_P(offset) != IS_LONG) { - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_INT) { + index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_LVAL_P(offset); + index = Z_IVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -479,10 +479,10 @@ static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_obje long index; int retval; - if (Z_TYPE_P(offset) != IS_LONG) { - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_INT) { + index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_LVAL_P(offset); + index = Z_IVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -539,8 +539,8 @@ static int spl_fixedarray_object_count_elements(zval *object, long *count TSRMLS if (!Z_ISUNDEF(rv)) { zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); - convert_to_long(&intern->retval); - *count = (long) Z_LVAL(intern->retval); + convert_to_int(&intern->retval); + *count = (long) Z_IVAL(intern->retval); return SUCCESS; } } else if (intern->array) { @@ -629,9 +629,9 @@ SPL_METHOD(SplFixedArray, count) intern = Z_SPLFIXEDARRAY_P(object); if (intern->array) { - RETURN_LONG(intern->array->size); + RETURN_INT(intern->array->size); } - RETURN_LONG(0); + RETURN_INT(0); } /* }}} */ @@ -747,9 +747,9 @@ SPL_METHOD(SplFixedArray, getSize) intern = Z_SPLFIXEDARRAY_P(object); if (intern->array) { - RETURN_LONG(intern->array->size); + RETURN_INT(intern->array->size); } - RETURN_LONG(0); + RETURN_INT(0); } /* }}} */ @@ -895,7 +895,7 @@ static zval *spl_fixedarray_it_get_current_data(zend_object_iterator *iter TSRML } else { zval *data; - ZVAL_LONG(&zindex, object->current); + ZVAL_INT(&zindex, object->current); data = spl_fixedarray_object_read_dimension_helper(object, &zindex TSRMLS_CC); zval_ptr_dtor(&zindex); @@ -915,7 +915,7 @@ static void spl_fixedarray_it_get_current_key(zend_object_iterator *iter, zval * if (object->flags & SPL_FIXEDARRAY_OVERLOADED_KEY) { zend_user_it_get_current_key(iter, key TSRMLS_CC); } else { - ZVAL_LONG(key, object->current); + ZVAL_INT(key, object->current); } } /* }}} */ @@ -943,7 +943,7 @@ SPL_METHOD(SplFixedArray, key) return; } - RETURN_LONG(intern->current); + RETURN_INT(intern->current); } /* }}} */ @@ -1000,7 +1000,7 @@ SPL_METHOD(SplFixedArray, current) return; } - ZVAL_LONG(&zindex, intern->current); + ZVAL_INT(&zindex, intern->current); value = spl_fixedarray_object_read_dimension_helper(intern, &zindex TSRMLS_CC); diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h index 1d116ff783..568984f928 100644 --- a/ext/spl/spl_functions.h +++ b/ext/spl/spl_functions.h @@ -46,8 +46,8 @@ typedef zend_object* (*create_object_func_t)(zend_class_entry *class_type TSRMLS #define REGISTER_SPL_PROPERTY(class_name, prop_name, prop_flags) \ spl_register_property(spl_ce_ ## class_name, prop_name, sizeof(prop_name)-1, prop_flags TSRMLS_CC); -#define REGISTER_SPL_CLASS_CONST_LONG(class_name, const_name, value) \ - zend_declare_class_constant_long(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_SPL_CLASS_CONST_INT(class_name, const_name, value) \ + zend_declare_class_constant_int(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC); void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC); diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 90d78db6ee..90fa9af9ed 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -114,8 +114,8 @@ static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object return FAILURE; } - convert_to_long(&zresult); - *result = Z_LVAL(zresult); + convert_to_int(&zresult); + *result = Z_IVAL(zresult); zval_ptr_dtor(&zresult); @@ -165,7 +165,7 @@ static int spl_ptr_heap_zval_max_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { } compare_function(&result, a, b TSRMLS_CC); - return Z_LVAL(result); + return Z_IVAL(result); } /* }}} */ @@ -189,7 +189,7 @@ static int spl_ptr_heap_zval_min_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { } compare_function(&result, b, a TSRMLS_CC); - return Z_LVAL(result); + return Z_IVAL(result); } /* }}} */ @@ -220,7 +220,7 @@ static int spl_ptr_pqueue_zval_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { / } compare_function(&result, a_priority_p, b_priority_p TSRMLS_CC); - return Z_LVAL(result); + return Z_IVAL(result); } /* }}} */ @@ -493,8 +493,8 @@ static int spl_heap_object_count_elements(zval *object, long *count TSRMLS_DC) / if (!Z_ISUNDEF(rv)) { zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); - convert_to_long(&intern->retval); - *count = (long) Z_LVAL(intern->retval); + convert_to_int(&intern->retval); + *count = (long) Z_IVAL(intern->retval); return SUCCESS; } *count = 0; @@ -529,7 +529,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(ce, "flags", sizeof("flags")-1 TSRMLS_CC); - ZVAL_LONG(&tmp, intern->flags); + ZVAL_INT(&tmp, intern->flags); zend_hash_update(intern->debug_info, pnstr, &tmp); STR_RELEASE(pnstr); @@ -580,7 +580,7 @@ SPL_METHOD(SplHeap, count) } count = spl_ptr_heap_count(intern->heap); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ @@ -776,7 +776,7 @@ SPL_METHOD(SplPriorityQueue, setExtractFlags) intern->flags = value & SPL_PQUEUE_EXTR_MASK; - RETURN_LONG(intern->flags); + RETURN_INT(intern->flags); } /* }}} */ @@ -808,7 +808,7 @@ SPL_METHOD(SplPriorityQueue, compare) return; } - RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); + RETURN_INT(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); } /* }}} */ @@ -851,7 +851,7 @@ SPL_METHOD(SplMinHeap, compare) return; } - RETURN_LONG(spl_ptr_heap_zval_min_cmp(a, b, NULL TSRMLS_CC)); + RETURN_INT(spl_ptr_heap_zval_min_cmp(a, b, NULL TSRMLS_CC)); } /* }}} */ @@ -865,7 +865,7 @@ SPL_METHOD(SplMaxHeap, compare) return; } - RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); + RETURN_INT(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); } /* }}} */ @@ -934,7 +934,7 @@ static void spl_heap_it_get_current_key(zend_object_iterator *iter, zval *key TS { spl_heap_object *object = Z_SPLHEAP_P(&iter->data); - ZVAL_LONG(key, object->heap->count - 1); + ZVAL_INT(key, object->heap->count - 1); } /* }}} */ @@ -966,7 +966,7 @@ SPL_METHOD(SplHeap, key) return; } - RETURN_LONG(intern->heap->count - 1); + RETURN_INT(intern->heap->count - 1); } /* }}} */ @@ -1226,9 +1226,9 @@ PHP_MINIT_FUNCTION(spl_heap) /* {{{ */ spl_ce_SplPriorityQueue->get_iterator = spl_pqueue_get_iterator; - REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_BOTH", SPL_PQUEUE_EXTR_BOTH); - REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_PRIORITY", SPL_PQUEUE_EXTR_PRIORITY); - REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_DATA", SPL_PQUEUE_EXTR_DATA); + REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_BOTH", SPL_PQUEUE_EXTR_BOTH); + REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_PRIORITY", SPL_PQUEUE_EXTR_PRIORITY); + REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_DATA", SPL_PQUEUE_EXTR_DATA); return SUCCESS; } diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index e503f9b581..1c8c942753 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -228,7 +228,7 @@ static void spl_recursive_it_get_current_key(zend_object_iterator *iter, zval *k if (sub_iter->funcs->get_current_key) { sub_iter->funcs->get_current_key(sub_iter, key TSRMLS_CC); } else { - ZVAL_LONG(key, iter->index); + ZVAL_INT(key, iter->index); } } @@ -496,7 +496,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla if (user_caching_it_flags) { ZVAL_ZVAL(&caching_it_flags, user_caching_it_flags, 1, 0); } else { - ZVAL_LONG(&caching_it_flags, CIT_CATCH_GET_CHILD); + ZVAL_INT(&caching_it_flags, CIT_CATCH_GET_CHILD); } spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &caching_it, iterator, &caching_it_flags TSRMLS_CC); zval_ptr_dtor(&caching_it_flags); @@ -695,7 +695,7 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth) return; } - RETURN_LONG(object->level); + RETURN_INT(object->level); } /* }}} */ /* {{{ proto RecursiveIterator RecursiveIteratorIterator::getSubIterator([int level]) @@ -871,7 +871,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth) if (object->max_depth == -1) { RETURN_FALSE; } else { - RETURN_LONG(object->max_depth); + RETURN_INT(object->max_depth); } } /* }}} */ @@ -1222,15 +1222,15 @@ SPL_METHOD(RecursiveTreeIterator, current) } spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str = STR_ALLOC(Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix), 0); + str = STR_ALLOC(Z_STRSIZE(prefix) + Z_STRSIZE(entry) + Z_STRSIZE(postfix), 0); ptr = str->val; - memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); - ptr += Z_STRLEN(prefix); - memcpy(ptr, Z_STRVAL(entry), Z_STRLEN(entry)); - ptr += Z_STRLEN(entry); - memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); - ptr += Z_STRLEN(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); + ptr += Z_STRSIZE(prefix); + memcpy(ptr, Z_STRVAL(entry), Z_STRSIZE(entry)); + ptr += Z_STRSIZE(entry); + memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); + ptr += Z_STRSIZE(postfix); *ptr = 0; zval_ptr_dtor(&prefix); @@ -1278,15 +1278,15 @@ SPL_METHOD(RecursiveTreeIterator, key) spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC); spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str = STR_ALLOC(Z_STRLEN(prefix) + Z_STRLEN(key) + Z_STRLEN(postfix), 0); + str = STR_ALLOC(Z_STRSIZE(prefix) + Z_STRSIZE(key) + Z_STRSIZE(postfix), 0); ptr = str->val; - memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); - ptr += Z_STRLEN(prefix); - memcpy(ptr, Z_STRVAL(key), Z_STRLEN(key)); - ptr += Z_STRLEN(key); - memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); - ptr += Z_STRLEN(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); + ptr += Z_STRSIZE(prefix); + memcpy(ptr, Z_STRVAL(key), Z_STRSIZE(key)); + ptr += Z_STRSIZE(key); + memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); + ptr += Z_STRSIZE(postfix); *ptr = 0; zval_ptr_dtor(&prefix); @@ -1709,7 +1709,7 @@ static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more T ZVAL_UNDEF(&intern->current.key); } } else { - ZVAL_LONG(&intern->current.key, intern->current.pos); + ZVAL_INT(&intern->current.key, intern->current.pos); } return EG(exception) ? FAILURE : SUCCESS; } @@ -2049,10 +2049,10 @@ SPL_METHOD(RegexIterator, accept) use_copy = zend_make_printable_zval(subject_ptr, &subject_copy TSRMLS_CC); if (use_copy) { subject = Z_STRVAL(subject_copy); - subject_len = Z_STRLEN(subject_copy); + subject_len = Z_STRSIZE(subject_copy); } else { subject = Z_STRVAL_P(subject_ptr); - subject_len = Z_STRLEN_P(subject_ptr); + subject_len = Z_STRSIZE_P(subject_ptr); } use_copy = 0; @@ -2151,7 +2151,7 @@ SPL_METHOD(RegexIterator, getMode) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_LONG(intern->u.regex.mode); + RETURN_INT(intern->u.regex.mode); } /* }}} */ /* {{{ proto bool RegexIterator::setMode(int new_mode) @@ -2187,7 +2187,7 @@ SPL_METHOD(RegexIterator, getFlags) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_LONG(intern->u.regex.flags); + RETURN_INT(intern->u.regex.flags); } /* }}} */ /* {{{ proto bool RegexIterator::setFlags(int new_flags) @@ -2219,7 +2219,7 @@ SPL_METHOD(RegexIterator, getPregFlags) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); if (intern->u.regex.use_flags) { - RETURN_LONG(intern->u.regex.preg_flags); + RETURN_INT(intern->u.regex.preg_flags); } else { return; } @@ -2486,7 +2486,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS return; } if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { - ZVAL_LONG(&zpos, pos); + ZVAL_INT(&zpos, pos); spl_dual_it_free(intern TSRMLS_CC); zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, &zpos); zval_ptr_dtor(&zpos); @@ -2568,7 +2568,7 @@ SPL_METHOD(LimitIterator, seek) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); spl_limit_it_seek(intern, pos TSRMLS_CC); - RETURN_LONG(intern->current.pos); + RETURN_INT(intern->current.pos); } /* }}} */ /* {{{ proto int LimitIterator::getPosition() @@ -2577,7 +2577,7 @@ SPL_METHOD(LimitIterator, getPosition) { spl_dual_it_object *intern; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_LONG(intern->current.pos); + RETURN_INT(intern->current.pos); } /* }}} */ ZEND_BEGIN_ARG_INFO(arginfo_seekable_it_seek, 0) @@ -2660,7 +2660,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC) return; } } else { - ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC); + ZVAL_INT(&zflags, intern->u.caching.flags & CIT_PUBLIC); spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &intern->u.caching.zchildren, &zchildren, &zflags TSRMLS_CC); zval_ptr_dtor(&zchildren); } @@ -2929,7 +2929,7 @@ SPL_METHOD(CachingIterator, getFlags) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_LONG(intern->u.caching.flags); + RETURN_INT(intern->u.caching.flags); } /* }}} */ @@ -2983,7 +2983,7 @@ SPL_METHOD(CachingIterator, count) return; } - RETURN_LONG(zend_hash_num_elements(HASH_OF(&intern->u.caching.zcache))); + RETURN_INT(zend_hash_num_elements(HASH_OF(&intern->u.caching.zcache))); } /* }}} */ @@ -3591,7 +3591,7 @@ PHP_FUNCTION(iterator_count) } if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count TSRMLS_CC) == SUCCESS) { - RETURN_LONG(count); + RETURN_INT(count); } } /* }}} */ @@ -3636,7 +3636,7 @@ PHP_FUNCTION(iterator_apply) apply_info.count = 0; zend_fcall_info_args(&apply_info.fci, apply_info.args TSRMLS_CC); if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, (void*)&apply_info TSRMLS_CC) == SUCCESS) { - RETVAL_LONG(apply_info.count); + RETVAL_INT(apply_info.count); } else { RETVAL_FALSE; } @@ -3682,10 +3682,10 @@ PHP_MINIT_FUNCTION(spl_iterators) spl_ce_RecursiveIteratorIterator->get_iterator = spl_recursive_it_get_iterator; spl_ce_RecursiveIteratorIterator->iterator_funcs.funcs = &spl_recursive_it_iterator_funcs; - REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "LEAVES_ONLY", RIT_LEAVES_ONLY); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "SELF_FIRST", RIT_SELF_FIRST); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CHILD_FIRST", RIT_CHILD_FIRST); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD); + REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "LEAVES_ONLY", RIT_LEAVES_ONLY); + REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "SELF_FIRST", RIT_SELF_FIRST); + REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "CHILD_FIRST", RIT_CHILD_FIRST); + REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD); REGISTER_SPL_INTERFACE(OuterIterator); REGISTER_SPL_ITERATOR(OuterIterator); @@ -3718,12 +3718,12 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_IMPLEMENTS(CachingIterator, ArrayAccess); REGISTER_SPL_IMPLEMENTS(CachingIterator, Countable); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_KEY", CIT_TOSTRING_USE_KEY); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_KEY", CIT_TOSTRING_USE_KEY); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE); REGISTER_SPL_SUB_CLASS_EX(RecursiveCachingIterator, CachingIterator, spl_dual_it_new, spl_funcs_RecursiveCachingIterator); REGISTER_SPL_IMPLEMENTS(RecursiveCachingIterator, RecursiveIterator); @@ -3737,13 +3737,13 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator, spl_dual_it_new, spl_funcs_InfiniteIterator); #if HAVE_PCRE || HAVE_BUNDLED_PCRE REGISTER_SPL_SUB_CLASS_EX(RegexIterator, FilterIterator, spl_dual_it_new, spl_funcs_RegexIterator); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "USE_KEY", REGIT_USE_KEY); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "INVERT_MATCH",REGIT_INVERTED); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "MATCH", REGIT_MODE_MATCH); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "GET_MATCH", REGIT_MODE_GET_MATCH); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "SPLIT", REGIT_MODE_SPLIT); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "REPLACE", REGIT_MODE_REPLACE); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "USE_KEY", REGIT_USE_KEY); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "INVERT_MATCH",REGIT_INVERTED); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "MATCH", REGIT_MODE_MATCH); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "GET_MATCH", REGIT_MODE_GET_MATCH); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "SPLIT", REGIT_MODE_SPLIT); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "REPLACE", REGIT_MODE_REPLACE); REGISTER_SPL_PROPERTY(RegexIterator, "replacement", 0); REGISTER_SPL_SUB_CLASS_EX(RecursiveRegexIterator, RegexIterator, spl_dual_it_new, spl_funcs_RecursiveRegexIterator); REGISTER_SPL_IMPLEMENTS(RecursiveRegexIterator, RecursiveIterator); @@ -3756,14 +3756,14 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_ITERATOR(EmptyIterator); REGISTER_SPL_SUB_CLASS_EX(RecursiveTreeIterator, RecursiveIteratorIterator, spl_RecursiveTreeIterator_new, spl_funcs_RecursiveTreeIterator); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_KEY", RTIT_BYPASS_KEY); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_LEFT", 0); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_HAS_NEXT", 1); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_LAST", 2); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_HAS_NEXT", 3); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_LAST", 4); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_RIGHT", 5); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "BYPASS_KEY", RTIT_BYPASS_KEY); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_LEFT", 0); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_MID_HAS_NEXT", 1); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_MID_LAST", 2); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_END_HAS_NEXT", 3); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_END_LAST", 4); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_RIGHT", 5); return SUCCESS; } diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index bdfff35506..fcc6af387c 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -397,7 +397,7 @@ static int spl_object_storage_compare_info(zval *e1, zval *e2 TSRMLS_DC) /* {{{ return 1; } - return Z_LVAL(result); + return Z_IVAL(result); } /* }}} */ @@ -526,7 +526,7 @@ SPL_METHOD(SplObjectStorage, addAll) spl_object_storage_addall(intern, getThis(), other TSRMLS_CC); - RETURN_LONG(zend_hash_num_elements(&intern->storage)); + RETURN_INT(zend_hash_num_elements(&intern->storage)); } /* }}} */ /* {{{ proto bool SplObjectStorage::removeAll(SplObjectStorage $os) @@ -554,7 +554,7 @@ SPL_METHOD(SplObjectStorage, removeAll) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); intern->index = 0; - RETURN_LONG(zend_hash_num_elements(&intern->storage)); + RETURN_INT(zend_hash_num_elements(&intern->storage)); } /* }}} */ /* {{{ proto bool SplObjectStorage::removeAllExcept(SplObjectStorage $os) @@ -581,7 +581,7 @@ SPL_METHOD(SplObjectStorage, removeAllExcept) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); intern->index = 0; - RETURN_LONG(zend_hash_num_elements(&intern->storage)); + RETURN_INT(zend_hash_num_elements(&intern->storage)); } /* }}} */ @@ -617,11 +617,11 @@ SPL_METHOD(SplObjectStorage, count) ret += php_count_recursive(element, mode TSRMLS_CC); } ZEND_HASH_FOREACH_END(); - RETURN_LONG(ret); + RETURN_INT(ret); return; } - RETURN_LONG(zend_hash_num_elements(&intern->storage)); + RETURN_INT(zend_hash_num_elements(&intern->storage)); } /* }}} */ /* {{{ proto void SplObjectStorage::rewind() @@ -661,7 +661,7 @@ SPL_METHOD(SplObjectStorage, key) return; } - RETURN_LONG(intern->index); + RETURN_INT(intern->index); } /* }}} */ /* {{{ proto mixed SplObjectStorage::current() @@ -751,7 +751,7 @@ SPL_METHOD(SplObjectStorage, serialize) /* storage */ smart_str_appendl(&buf, "x:", 2); - ZVAL_LONG(&flags, zend_hash_num_elements(&intern->storage)); + ZVAL_INT(&flags, zend_hash_num_elements(&intern->storage)); php_var_serialize(&buf, &flags, &var_hash TSRMLS_CC); zval_ptr_dtor(&flags); @@ -822,13 +822,13 @@ SPL_METHOD(SplObjectStorage, unserialize) if (!php_var_unserialize(&pcount, &p, s + buf_len, &var_hash TSRMLS_CC)) { goto outexcept; } - if (Z_TYPE(pcount) != IS_LONG) { + if (Z_TYPE(pcount) != IS_INT) { zval_ptr_dtor(&pcount); goto outexcept; } --p; /* for ';' */ - count = Z_LVAL(pcount); + count = Z_IVAL(pcount); while (count-- > 0) { spl_SplObjectStorageElement *pelement; @@ -1011,7 +1011,7 @@ SPL_METHOD(MultipleIterator, getFlags) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_LONG(intern->flags); + RETURN_INT(intern->flags); } /* }}} */ @@ -1045,7 +1045,7 @@ SPL_METHOD(MultipleIterator, attachIterator) spl_SplObjectStorageElement *element; zval compare_result; - if (Z_TYPE_P(info) != IS_LONG && Z_TYPE_P(info) != IS_STRING) { + if (Z_TYPE_P(info) != IS_INT && Z_TYPE_P(info) != IS_STRING) { zend_throw_exception(spl_ce_InvalidArgumentException, "Info must be NULL, integer or string", 0 TSRMLS_CC); return; } @@ -1203,8 +1203,8 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ if (intern->flags & MIT_KEYS_ASSOC) { switch (Z_TYPE(element->inf)) { - case IS_LONG: - add_index_zval(return_value, Z_LVAL(element->inf), &retval); + case IS_INT: + add_index_zval(return_value, Z_IVAL(element->inf), &retval); break; case IS_STRING: zend_hash_update(Z_ARRVAL_P(return_value), Z_STR(element->inf), &retval); @@ -1312,10 +1312,10 @@ PHP_MINIT_FUNCTION(spl_observer) REGISTER_SPL_STD_CLASS_EX(MultipleIterator, spl_SplObjectStorage_new, spl_funcs_MultipleIterator); REGISTER_SPL_ITERATOR(MultipleIterator); - REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ANY", MIT_NEED_ANY); - REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ALL", MIT_NEED_ALL); - REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_KEYS_NUMERIC", MIT_KEYS_NUMERIC); - REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_KEYS_ASSOC", MIT_KEYS_ASSOC); + REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_NEED_ANY", MIT_NEED_ANY); + REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_NEED_ALL", MIT_NEED_ALL); + REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_KEYS_NUMERIC", MIT_KEYS_NUMERIC); + REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_KEYS_ASSOC", MIT_KEYS_ASSOC); return SUCCESS; } diff --git a/ext/standard/array.c b/ext/standard/array.c index a177ee7e0f..1675562a50 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -99,33 +99,33 @@ PHP_MINIT_FUNCTION(array) /* {{{ */ { ZEND_INIT_MODULE_GLOBALS(array, php_array_init_globals, NULL); - REGISTER_LONG_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SORT_ASC", PHP_SORT_ASC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_DESC", PHP_SORT_DESC, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SORT_REGULAR", PHP_SORT_REGULAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_NUMERIC", PHP_SORT_NUMERIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_STRING", PHP_SORT_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_LOCALE_STRING", PHP_SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_NATURAL", PHP_SORT_NATURAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_FLAG_CASE", PHP_SORT_FLAG_CASE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SORT_ASC", PHP_SORT_ASC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_DESC", PHP_SORT_DESC, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SORT_REGULAR", PHP_SORT_REGULAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_NUMERIC", PHP_SORT_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_STRING", PHP_SORT_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_LOCALE_STRING", PHP_SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_NATURAL", PHP_SORT_NATURAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_FLAG_CASE", PHP_SORT_FLAG_CASE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -182,13 +182,13 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ s = (Bucket *) b; if (f->key == NULL) { - ZVAL_LONG(&first, f->h); + ZVAL_INT(&first, f->h); } else { ZVAL_STR(&first, f->key); } if (s->key == 0) { - ZVAL_LONG(&second, s->h); + ZVAL_INT(&second, s->h); } else { ZVAL_STR(&second, s->key); } @@ -197,8 +197,8 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ return 0; } - if (EXPECTED(Z_TYPE(result) == IS_LONG)) { - return ZEND_NORMALIZE_BOOL(Z_LVAL(result)); + if (EXPECTED(Z_TYPE(result) == IS_INT)) { + return ZEND_NORMALIZE_BOOL(Z_IVAL(result)); } else if (Z_TYPE(result) == IS_DOUBLE) { return ZEND_NORMALIZE_BOOL(Z_DVAL(result)); } @@ -306,7 +306,7 @@ PHP_FUNCTION(count) switch (Z_TYPE_P(array)) { case IS_NULL: - RETURN_LONG(0); + RETURN_INT(0); break; case IS_ARRAY: cnt = zend_hash_num_elements(Z_ARRVAL_P(array)); @@ -316,7 +316,7 @@ PHP_FUNCTION(count) cnt += php_count_recursive(element, COUNT_RECURSIVE TSRMLS_CC); } ZEND_HASH_FOREACH_END(); } - RETURN_LONG(cnt); + RETURN_INT(cnt); break; case IS_OBJECT: { #ifdef HAVE_SPL @@ -324,8 +324,8 @@ PHP_FUNCTION(count) #endif /* first, we check if the handler is defined */ if (Z_OBJ_HT_P(array)->count_elements) { - RETVAL_LONG(1); - if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value) TSRMLS_CC)) { + RETVAL_INT(1); + if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_IVAL_P(return_value) TSRMLS_CC)) { return; } } @@ -334,7 +334,7 @@ PHP_FUNCTION(count) if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) { zend_call_method_with_0_params(array, NULL, NULL, "count", &retval); if (Z_TYPE(retval) != IS_UNDEF) { - RETVAL_LONG(zval_get_long(&retval)); + RETVAL_INT(zval_get_long(&retval)); zval_ptr_dtor(&retval); } return; @@ -342,7 +342,7 @@ PHP_FUNCTION(count) #endif } default: - RETURN_LONG(1); + RETURN_INT(1); break; } } @@ -378,8 +378,8 @@ static int php_array_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{ return 0; } - if (EXPECTED(Z_TYPE(result) == IS_LONG)) { - return ZEND_NORMALIZE_BOOL(Z_LVAL(result)); + if (EXPECTED(Z_TYPE(result) == IS_INT)) { + return ZEND_NORMALIZE_BOOL(Z_IVAL(result)); } else if (Z_TYPE(result) == IS_DOUBLE) { return ZEND_NORMALIZE_BOOL(Z_DVAL(result)); } @@ -704,12 +704,12 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* s = (Bucket *) b; if (f->key == NULL) { - ZVAL_LONG(&args[0], f->h); + ZVAL_INT(&args[0], f->h); } else { ZVAL_STR(&args[0], STR_COPY(f->key)); } if (s->key == NULL) { - ZVAL_LONG(&args[1], s->h); + ZVAL_INT(&args[1], s->h); } else { ZVAL_STR(&args[1], STR_COPY(s->key)); } @@ -1258,7 +1258,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ if (str_idx) { RETVAL_STR(STR_COPY(str_idx)); } else { - RETVAL_LONG(num_idx); + RETVAL_INT(num_idx); } return; } @@ -1273,7 +1273,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ if (str_idx) { RETVAL_STR(STR_COPY(str_idx)); } else { - RETVAL_LONG(num_idx); + RETVAL_INT(num_idx); } return; } @@ -1339,14 +1339,14 @@ static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */ PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */ { - ZVAL_NEW_STR(result, STR_ALLOC(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); - memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); + ZVAL_NEW_STR(result, STR_ALLOC(Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); + memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix)); if (add_underscore) { - Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; + Z_STRVAL_P(result)[Z_STRSIZE_P(prefix)] = '_'; } - memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); + memcpy(Z_STRVAL_P(result) + Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); return SUCCESS; } @@ -1384,7 +1384,7 @@ PHP_FUNCTION(extract) if (prefix) { convert_to_string(prefix); - if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) { + if (Z_STRSIZE_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "prefix is not a valid identifier"); return; } @@ -1403,9 +1403,9 @@ PHP_FUNCTION(extract) } else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) { zval num; - ZVAL_LONG(&num, num_key); + ZVAL_INT(&num, num_key); convert_to_string(&num); - php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRLEN(num), 1 TSRMLS_CC); + php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRSIZE(num), 1 TSRMLS_CC); zval_dtor(&num); } else { continue; @@ -1462,7 +1462,7 @@ PHP_FUNCTION(extract) break; } - if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { + if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRSIZE(final_name))) { if (extract_refs) { zval *orig_var; @@ -1487,7 +1487,7 @@ PHP_FUNCTION(extract) zval_dtor(&final_name); } ZEND_HASH_FOREACH_END(); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ @@ -1603,9 +1603,9 @@ PHP_FUNCTION(array_fill_keys) ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(keys), entry) { ZVAL_DEREF(entry); - if (Z_TYPE_P(entry) == IS_LONG) { + if (Z_TYPE_P(entry) == IS_INT) { zval_add_ref(val); - zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), val); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), val); } else { zend_string *key = zval_get_string(entry); @@ -1632,7 +1632,7 @@ PHP_FUNCTION(range) if (zstep) { if (Z_TYPE_P(zstep) == IS_DOUBLE || - (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0) == IS_DOUBLE) + (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRSIZE_P(zstep), NULL, NULL, 0) == IS_DOUBLE) ) { is_step_double = 1; } @@ -1649,17 +1649,17 @@ PHP_FUNCTION(range) array_init(return_value); /* If the range is given as strings, generate an array of characters. */ - if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRLEN_P(zlow) >= 1 && Z_STRLEN_P(zhigh) >= 1) { + if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRSIZE_P(zlow) >= 1 && Z_STRSIZE_P(zhigh) >= 1) { int type1, type2; unsigned char low, high; long lstep = (long) step; - type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRLEN_P(zlow), NULL, NULL, 0); - type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRLEN_P(zhigh), NULL, NULL, 0); + type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRSIZE_P(zlow), NULL, NULL, 0); + type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRSIZE_P(zhigh), NULL, NULL, 0); if (type1 == IS_DOUBLE || type2 == IS_DOUBLE || is_step_double) { goto double_str; - } else if (type1 == IS_LONG || type2 == IS_LONG) { + } else if (type1 == IS_INT || type2 == IS_INT) { goto long_str; } @@ -1748,14 +1748,14 @@ long_str: high = zval_get_double(zhigh); lstep = (long) step; - Z_TYPE_INFO(tmp) = IS_LONG; + Z_TYPE_INFO(tmp) = IS_INT; if (low > high) { /* Negative steps */ if (low - high < lstep || lstep <= 0) { err = 1; goto err; } for (; low >= high; low -= lstep) { - Z_LVAL(tmp) = (long)low; + Z_IVAL(tmp) = (long)low; zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp); } } else if (high > low) { /* Positive steps */ @@ -1764,11 +1764,11 @@ long_str: goto err; } for (; low <= high; low += lstep) { - Z_LVAL(tmp) = (long)low; + Z_IVAL(tmp) = (long)low; zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp); } } else { - Z_LVAL(tmp) = (long)low; + Z_IVAL(tmp) = (long)low; zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp); } } @@ -1985,7 +1985,7 @@ PHP_FUNCTION(array_push) } /* Clean up and return the number of values in the stack */ - RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack))); + RETVAL_INT(zend_hash_num_elements(Z_ARRVAL_P(stack))); } /* }}} */ @@ -2129,7 +2129,7 @@ PHP_FUNCTION(array_unshift) zend_hash_destroy(&old_hash); /* Clean up and return the number of elements in the stack */ - RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack))); + RETVAL_INT(zend_hash_num_elements(Z_ARRVAL_P(stack))); } /* }}} */ @@ -2604,7 +2604,7 @@ PHP_FUNCTION(array_keys) if (str_idx) { ZVAL_STR(&new_val, STR_COPY(str_idx)); } else { - ZVAL_LONG(&new_val, num_idx); + ZVAL_INT(&new_val, num_idx); } zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &new_val); } @@ -2653,21 +2653,21 @@ PHP_FUNCTION(array_count_values) /* Go through input array and add values to the return array */ myht = Z_ARRVAL_P(input); ZEND_HASH_FOREACH_VAL(myht, entry) { - if (Z_TYPE_P(entry) == IS_LONG) { - if ((tmp = zend_hash_index_find(Z_ARRVAL_P(return_value), Z_LVAL_P(entry))) == NULL) { + if (Z_TYPE_P(entry) == IS_INT) { + if ((tmp = zend_hash_index_find(Z_ARRVAL_P(return_value), Z_IVAL_P(entry))) == NULL) { zval data; - ZVAL_LONG(&data, 1); - zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data); + ZVAL_INT(&data, 1); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), &data); } else { - Z_LVAL_P(tmp)++; + Z_IVAL_P(tmp)++; } } else if (Z_TYPE_P(entry) == IS_STRING) { if ((tmp = zend_symtable_find(Z_ARRVAL_P(return_value), Z_STR_P(entry))) == NULL) { zval data; - ZVAL_LONG(&data, 1); + ZVAL_INT(&data, 1); zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data); } else { - Z_LVAL_P(tmp)++; + Z_IVAL_P(tmp)++; } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only count STRING and INTEGER values!"); @@ -2684,9 +2684,9 @@ zend_bool array_column_param_helper(zval *param, const char *name TSRMLS_DC) { switch (Z_TYPE_P(param)) { case IS_DOUBLE: - convert_to_long_ex(param); + convert_to_int_ex(param); /* fallthrough */ - case IS_LONG: + case IS_INT: return 1; case IS_OBJECT: @@ -2736,8 +2736,8 @@ PHP_FUNCTION(array_column) } else if ((Z_TYPE_P(zcolumn) == IS_STRING) && ((zcolval = zend_hash_find(ht, Z_STR_P(zcolumn))) == NULL)) { continue; - } else if ((Z_TYPE_P(zcolumn) == IS_LONG) && - ((zcolval = zend_hash_index_find(ht, Z_LVAL_P(zcolumn))) == NULL)) { + } else if ((Z_TYPE_P(zcolumn) == IS_INT) && + ((zcolval = zend_hash_index_find(ht, Z_IVAL_P(zcolumn))) == NULL)) { continue; } @@ -2746,8 +2746,8 @@ PHP_FUNCTION(array_column) */ if (zkey && (Z_TYPE_P(zkey) == IS_STRING)) { zkeyval = zend_hash_find(ht, Z_STR_P(zkey)); - } else if (zkey && (Z_TYPE_P(zkey) == IS_LONG)) { - zkeyval = zend_hash_index_find(ht, Z_LVAL_P(zkey)); + } else if (zkey && (Z_TYPE_P(zkey) == IS_INT)) { + zkeyval = zend_hash_index_find(ht, Z_IVAL_P(zkey)); } if (Z_REFCOUNTED_P(zcolval)) { @@ -2755,8 +2755,8 @@ PHP_FUNCTION(array_column) } if (zkeyval && Z_TYPE_P(zkeyval) == IS_STRING) { zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(zkeyval), zcolval); - } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_LONG) { - add_index_zval(return_value, Z_LVAL_P(zkeyval), zcolval); + } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_INT) { + add_index_zval(return_value, Z_IVAL_P(zkeyval), zcolval); } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_OBJECT) { SEPARATE_ZVAL(zkeyval); convert_to_string(zkeyval); @@ -2884,18 +2884,18 @@ PHP_FUNCTION(array_flip) array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array))); ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) { - if (Z_TYPE_P(entry) == IS_LONG) { + if (Z_TYPE_P(entry) == IS_INT) { if (str_idx) { ZVAL_STR(&data, STR_COPY(str_idx)); } else { - ZVAL_LONG(&data, num_idx); + ZVAL_INT(&data, num_idx); } - zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), &data); } else if (Z_TYPE_P(entry) == IS_STRING) { if (str_idx) { ZVAL_STR(&data, STR_COPY(str_idx)); } else { - ZVAL_LONG(&data, num_idx); + ZVAL_INT(&data, num_idx); } zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data); } else { @@ -3035,8 +3035,8 @@ static int zval_compare(zval *a, zval *b TSRMLS_DC) /* {{{ */ return ZEND_NORMALIZE_BOOL(Z_DVAL(result)); } - convert_to_long(&result); - return ZEND_NORMALIZE_BOOL(Z_LVAL(result)); + convert_to_int(&result); + return ZEND_NORMALIZE_BOOL(Z_IVAL(result)); } /* }}} */ @@ -3935,7 +3935,7 @@ PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC) /* {{{ php_set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r] TSRMLS_CC); ARRAYG(compare_func)(&temp, &ab[r].val, &bb[r].val TSRMLS_CC); - result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp); + result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_IVAL(temp); if (result != 0) { return result; } @@ -4008,14 +4008,14 @@ PHP_FUNCTION(array_multisort) for (k = 0; k < MULTISORT_LAST; k++) { parse_state[k] = 1; } - } else if (Z_TYPE_P(arg) == IS_LONG) { - switch (Z_LVAL_P(arg) & ~PHP_SORT_FLAG_CASE) { + } else if (Z_TYPE_P(arg) == IS_INT) { + switch (Z_IVAL_P(arg) & ~PHP_SORT_FLAG_CASE) { case PHP_SORT_ASC: case PHP_SORT_DESC: /* flag allowed here */ if (parse_state[MULTISORT_ORDER] == 1) { /* Save the flag and make sure then next arg is not the current flag. */ - sort_order = Z_LVAL(args[i]) == PHP_SORT_DESC ? -1 : 1; + sort_order = Z_IVAL(args[i]) == PHP_SORT_DESC ? -1 : 1; parse_state[MULTISORT_ORDER] = 0; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); @@ -4033,7 +4033,7 @@ PHP_FUNCTION(array_multisort) /* flag allowed here */ if (parse_state[MULTISORT_TYPE] == 1) { /* Save the flag and make sure then next arg is not the current flag. */ - sort_type = Z_LVAL(args[i]); + sort_type = Z_IVAL(args[i]); parse_state[MULTISORT_TYPE] = 0; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); @@ -4178,14 +4178,14 @@ PHP_FUNCTION(array_rand) if (string_key) { RETURN_STR(STR_COPY(string_key)); } else { - RETURN_LONG(num_key); + RETURN_INT(num_key); } } else { /* Append the result to the return value. */ if (string_key) { add_next_index_str(return_value, STR_COPY(string_key)); } else { - add_next_index_long(return_value, num_key); + add_next_index_int(return_value, num_key); } } num_req--; @@ -4207,7 +4207,7 @@ PHP_FUNCTION(array_sum) return; } - ZVAL_LONG(return_value, 0); + ZVAL_INT(return_value, 0); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(input), entry) { if (Z_TYPE_P(entry) == IS_ARRAY || Z_TYPE_P(entry) == IS_OBJECT) { @@ -4233,7 +4233,7 @@ PHP_FUNCTION(array_product) return; } - ZVAL_LONG(return_value, 1); + ZVAL_INT(return_value, 1); if (!zend_hash_num_elements(Z_ARRVAL_P(input))) { return; } @@ -4245,10 +4245,10 @@ PHP_FUNCTION(array_product) ZVAL_DUP(&entry_n, entry); convert_scalar_to_number(&entry_n TSRMLS_CC); - if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) { - dval = (double)Z_LVAL_P(return_value) * (double)Z_LVAL(entry_n); + if (Z_TYPE(entry_n) == IS_INT && Z_TYPE_P(return_value) == IS_INT) { + dval = (double)Z_IVAL_P(return_value) * (double)Z_IVAL(entry_n); if ( (double)LONG_MIN <= dval && dval <= (double)LONG_MAX ) { - Z_LVAL_P(return_value) *= Z_LVAL(entry_n); + Z_IVAL_P(return_value) *= Z_IVAL(entry_n); continue; } } @@ -4353,9 +4353,9 @@ PHP_FUNCTION(array_filter) if (!string_key) { if (use_type == ARRAY_FILTER_USE_BOTH) { fci.param_count = 2; - ZVAL_LONG(&args[1], num_key); + ZVAL_INT(&args[1], num_key); } else if (use_type == ARRAY_FILTER_USE_KEY) { - ZVAL_LONG(&args[0], num_key); + ZVAL_INT(&args[0], num_key); } } else { if (use_type == ARRAY_FILTER_USE_BOTH) { @@ -4597,8 +4597,8 @@ PHP_FUNCTION(array_key_exists) RETURN_TRUE; } RETURN_FALSE; - case IS_LONG: - if (zend_hash_index_exists(array, Z_LVAL_P(key))) { + case IS_INT: + if (zend_hash_index_exists(array, Z_IVAL_P(key))) { RETURN_TRUE; } RETURN_FALSE; @@ -4714,9 +4714,9 @@ PHP_FUNCTION(array_combine) break; } else if (Z_TYPE(Z_ARRVAL_P(values)->arData[pos_values].val) != IS_UNDEF) { entry_values = &Z_ARRVAL_P(values)->arData[pos_values].val; - if (Z_TYPE_P(entry_keys) == IS_LONG) { + if (Z_TYPE_P(entry_keys) == IS_INT) { zval_add_ref(entry_values); - add_index_zval(return_value, Z_LVAL_P(entry_keys), entry_values); + add_index_zval(return_value, Z_IVAL_P(entry_keys), entry_values); } else { zend_string *key = zval_get_string(entry_keys); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index e64e2e1ecb..062b15f8b6 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -98,11 +98,11 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */ REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); return SUCCESS; } @@ -164,7 +164,7 @@ PHP_FUNCTION(assert) } compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC); - if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { + if (zend_eval_stringl(myeval, Z_STRSIZE_P(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); if (description_len == 0) { php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); @@ -205,7 +205,7 @@ PHP_FUNCTION(assert) const char *filename = zend_get_executed_filename(TSRMLS_C); ZVAL_STRING(&args[0], SAFE_STRING(filename)); - ZVAL_LONG (&args[1], lineno); + ZVAL_INT (&args[1], lineno); ZVAL_STRING(&args[2], SAFE_STRING(myeval)); ZVAL_FALSE(&retval); @@ -275,7 +275,7 @@ PHP_FUNCTION(assert_options) STR_RELEASE(key); STR_RELEASE(value_str); } - RETURN_LONG(oldint); + RETURN_INT(oldint); break; case ASSERT_BAIL: @@ -287,7 +287,7 @@ PHP_FUNCTION(assert_options) STR_RELEASE(key); STR_RELEASE(value_str); } - RETURN_LONG(oldint); + RETURN_INT(oldint); break; case ASSERT_QUIET_EVAL: @@ -299,7 +299,7 @@ PHP_FUNCTION(assert_options) STR_RELEASE(key); STR_RELEASE(value_str); } - RETURN_LONG(oldint); + RETURN_INT(oldint); break; case ASSERT_WARNING: @@ -311,7 +311,7 @@ PHP_FUNCTION(assert_options) STR_RELEASE(key); STR_RELEASE(value_str); } - RETURN_LONG(oldint); + RETURN_INT(oldint); break; case ASSERT_CALLBACK: diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 17bdae5719..f2f358b3f3 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3545,28 +3545,28 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ BG(incomplete_class) = incomplete_class_entry = php_create_incomplete_class(TSRMLS_C); - REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INI_SCANNER_RAW", ZEND_INI_SCANNER_RAW, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INI_SCANNER_RAW", ZEND_INI_SCANNER_RAW, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT); #define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) REGISTER_MATH_CONSTANT(M_E); @@ -3589,10 +3589,10 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ REGISTER_DOUBLE_CONSTANT("INF", php_get_inf(), CONST_CS | CONST_PERSISTENT); REGISTER_DOUBLE_CONSTANT("NAN", php_get_nan(), CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT); #if ENABLE_TEST_CLASS test_class_startup(); @@ -3925,7 +3925,7 @@ PHP_FUNCTION(ip2long) if (addr_len == 0 || inet_pton(AF_INET, addr, &ip) != 1) { RETURN_FALSE; } - RETURN_LONG(ntohl(ip.s_addr)); + RETURN_INT(ntohl(ip.s_addr)); #else if (addr_len == 0 || (ip = inet_addr(addr)) == INADDR_NONE) { /* The only special case when we should return -1 ourselves, @@ -3934,11 +3934,11 @@ PHP_FUNCTION(ip2long) if (addr_len == sizeof("255.255.255.255") - 1 && !memcmp(addr, "255.255.255.255", sizeof("255.255.255.255") - 1) ) { - RETURN_LONG(0xFFFFFFFF); + RETURN_INT(0xFFFFFFFF); } RETURN_FALSE; } - RETURN_LONG(ntohl(ip)); + RETURN_INT(ntohl(ip)); #endif } /* }}} */ @@ -4342,7 +4342,7 @@ PHP_FUNCTION(getopt) /* Add this option / argument pair to the result hash. */ optname_len = strlen(optname); - if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_LONG) { + if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_INT) { /* numeric string */ int optname_int = atoi(optname); if ((args = zend_hash_index_find(HASH_OF(return_value), optname_int)) != NULL) { @@ -4396,7 +4396,7 @@ PHP_FUNCTION(sleep) RETURN_FALSE; } #ifdef PHP_SLEEP_NON_VOID - RETURN_LONG(php_sleep(num)); + RETURN_INT(php_sleep(num)); #else php_sleep(num); #endif @@ -4450,8 +4450,8 @@ PHP_FUNCTION(time_nanosleep) RETURN_TRUE; } else if (errno == EINTR) { array_init(return_value); - add_assoc_long_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec); - add_assoc_long_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec); + add_assoc_int_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec); + add_assoc_int_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec); return; } else if (errno == EINVAL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "nanoseconds was not in the range 0 to 999 999 999 or seconds was negative"); @@ -4703,10 +4703,10 @@ PHP_FUNCTION(error_get_last) if (PG(last_error_message)) { array_init(return_value); - add_assoc_long_ex(return_value, "type", sizeof("type")-1, PG(last_error_type)); + add_assoc_int_ex(return_value, "type", sizeof("type")-1, PG(last_error_type)); add_assoc_string_ex(return_value, "message", sizeof("message")-1, PG(last_error_message)); add_assoc_string_ex(return_value, "file", sizeof("file")-1, PG(last_error_file)?PG(last_error_file):"-"); - add_assoc_long_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno)); + add_assoc_int_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno)); } } /* }}} */ @@ -4937,11 +4937,11 @@ static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_ } else if (Z_TYPE_P(func1) == IS_ARRAY && Z_TYPE_P(func2) == IS_ARRAY) { zval result; zend_compare_arrays(&result, func1, func2 TSRMLS_CC); - ret = (Z_LVAL(result) == 0); + ret = (Z_IVAL(result) == 0); } else if (Z_TYPE_P(func1) == IS_OBJECT && Z_TYPE_P(func2) == IS_OBJECT) { zval result; zend_compare_objects(&result, func1, func2 TSRMLS_CC); - ret = (Z_LVAL(result) == 0); + ret = (Z_IVAL(result) == 0); } else { ret = 0; } @@ -5242,7 +5242,7 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze add_assoc_null(&option, "local_value"); } - add_assoc_long(&option, "access", ini_entry->modifiable); + add_assoc_int(&option, "access", ini_entry->modifiable); add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, &option); } else { @@ -5450,7 +5450,7 @@ PHP_FUNCTION(print_r) Returns true if client disconnected */ PHP_FUNCTION(connection_aborted) { - RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED); + RETURN_INT(PG(connection_status) & PHP_CONNECTION_ABORTED); } /* }}} */ @@ -5458,7 +5458,7 @@ PHP_FUNCTION(connection_aborted) Returns the connection status bitfield */ PHP_FUNCTION(connection_status) { - RETURN_LONG(PG(connection_status)); + RETURN_INT(PG(connection_status)); } /* }}} */ @@ -5482,7 +5482,7 @@ PHP_FUNCTION(ignore_user_abort) STR_RELEASE(key); } - RETURN_LONG(old_setting); + RETURN_INT(old_setting); } /* }}} */ @@ -5514,7 +5514,7 @@ PHP_FUNCTION(getservbyname) RETURN_FALSE; } - RETURN_LONG(ntohs(serv->s_port)); + RETURN_INT(ntohs(serv->s_port)); } /* }}} */ #endif @@ -5563,7 +5563,7 @@ PHP_FUNCTION(getprotobyname) RETURN_FALSE; } - RETURN_LONG(ent->p_proto); + RETURN_INT(ent->p_proto); } /* }}} */ #endif @@ -5777,8 +5777,8 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal break; } - if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) { - ulong key = (ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); + if (!(Z_STRSIZE_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), NULL, NULL, 0) == IS_INT) { + ulong key = (ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)); if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) { array_init(&hash); find_hash = zend_hash_index_update(Z_ARRVAL_P(arr), key, &hash); @@ -5797,7 +5797,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal ZVAL_DUP(&element, arg2); - if (arg3 && Z_STRLEN_P(arg3) > 0) { + if (arg3 && Z_STRSIZE_P(arg3) > 0) { zend_symtable_update(Z_ARRVAL_P(find_hash), Z_STR_P(arg3), &element); } else { add_next_index_zval(find_hash, &element); diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index f494cc86b1..c5a4b47744 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -83,15 +83,15 @@ static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */ zend_string *res; char *lc_pattern; - res = STR_SAFE_ALLOC(Z_STRLEN_P(pattern), 2, 4, persistent); + res = STR_SAFE_ALLOC(Z_STRSIZE_P(pattern), 2, 4, persistent); t = res->val; - lc_pattern = zend_str_tolower_dup(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern)); + lc_pattern = zend_str_tolower_dup(Z_STRVAL_P(pattern), Z_STRSIZE_P(pattern)); t[j++] = '\xA7'; /* section sign */ t[j++] = '^'; - for (i=0; i<Z_STRLEN_P(pattern); i++, j++) { + for (i=0; i<Z_STRSIZE_P(pattern); i++, j++) { switch (lc_pattern[i]) { case '?': t[j] = '.'; @@ -163,16 +163,16 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb } /* Set proper value for true/false settings */ - if ((Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) || - (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) || - (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1)) + if ((Z_STRSIZE_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) || + (Z_STRSIZE_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) || + (Z_STRSIZE_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1)) ) { ZVAL_NEW_STR(&new_property, STR_INIT("1", sizeof("1")-1, persistent)); } else if ( - (Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) || - (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) || - (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) || - (Z_STRLEN_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1)) + (Z_STRSIZE_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) || + (Z_STRSIZE_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) || + (Z_STRSIZE_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) || + (Z_STRSIZE_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1)) ) { // TODO: USE STR_EMPTY_ALLOC()? ZVAL_NEW_STR(&new_property, STR_INIT("", sizeof("")-1, persistent)); @@ -203,7 +203,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb pefree(bdata->current_section_name, persistent); } bdata->current_section_name = pestrndup(Z_STRVAL_P(arg1), - Z_STRLEN_P(arg1), persistent); + Z_STRSIZE_P(arg1), persistent); zend_hash_update(bdata->htab, Z_STR_P(arg1), &bdata->current_section); @@ -388,7 +388,7 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar ua_len = lookup_browser_length; - for (i = 0; i < Z_STRLEN_P(previous_match); i++) { + for (i = 0; i < Z_STRSIZE_P(previous_match); i++) { switch (Z_STRVAL_P(previous_match)[i]) { case '?': case '*': @@ -400,7 +400,7 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar } } - for (i = 0; i < Z_STRLEN_P(current_match); i++) { + for (i = 0; i < Z_STRSIZE_P(current_match); i++) { switch (Z_STRVAL_P(current_match)[i]) { case '?': case '*': @@ -475,7 +475,7 @@ PHP_FUNCTION(get_browser) RETURN_FALSE; } agent_name = Z_STRVAL_P(http_user_agent); - agent_name_len = Z_STRLEN_P(http_user_agent); + agent_name_len = Z_STRSIZE_P(http_user_agent); } lookup_browser_name = estrndup(agent_name, agent_name_len); diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index e9176e84da..6ff40d57c8 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -39,7 +39,7 @@ PHP_NAMED_FUNCTION(php_if_crc32) for (; nr--; ++p) { crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF ]; } - RETVAL_LONG(crc^0xFFFFFFFF); + RETVAL_INT(crc^0xFFFFFFFF); } /* }}} */ diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 2a2304be20..86ae9bee13 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -102,18 +102,18 @@ PHP_MINIT_FUNCTION(crypt) /* {{{ */ { - REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT); #ifdef PHP_SHA256_CRYPT - REGISTER_LONG_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT); #endif #ifdef PHP_SHA512_CRYPT - REGISTER_LONG_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT); #endif #if PHP_USE_PHP_CRYPT_R diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 80a34a4548..8743708ad9 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -104,14 +104,14 @@ PHP_FUNCTION(strptime) } array_init(return_value); - add_assoc_long(return_value, "tm_sec", parsed_time.tm_sec); - add_assoc_long(return_value, "tm_min", parsed_time.tm_min); - add_assoc_long(return_value, "tm_hour", parsed_time.tm_hour); - add_assoc_long(return_value, "tm_mday", parsed_time.tm_mday); - add_assoc_long(return_value, "tm_mon", parsed_time.tm_mon); - add_assoc_long(return_value, "tm_year", parsed_time.tm_year); - add_assoc_long(return_value, "tm_wday", parsed_time.tm_wday); - add_assoc_long(return_value, "tm_yday", parsed_time.tm_yday); + add_assoc_int(return_value, "tm_sec", parsed_time.tm_sec); + add_assoc_int(return_value, "tm_min", parsed_time.tm_min); + add_assoc_int(return_value, "tm_hour", parsed_time.tm_hour); + add_assoc_int(return_value, "tm_mday", parsed_time.tm_mday); + add_assoc_int(return_value, "tm_mon", parsed_time.tm_mon); + add_assoc_int(return_value, "tm_year", parsed_time.tm_year); + add_assoc_int(return_value, "tm_wday", parsed_time.tm_wday); + add_assoc_int(return_value, "tm_yday", parsed_time.tm_yday); add_assoc_string(return_value, "unparsed", unparsed_part); } /* }}} */ diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 16cc8db054..e721de9774 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -148,44 +148,44 @@ PHP_MINIT_FUNCTION(dir) pathsep_str[1] = '\0'; REGISTER_STRING_CONSTANT("PATH_SEPARATOR", pathsep_str, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_GLOB #ifdef GLOB_BRACE - REGISTER_LONG_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT); #else # define GLOB_BRACE 0 #endif #ifdef GLOB_MARK - REGISTER_LONG_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT); #else # define GLOB_MARK 0 #endif #ifdef GLOB_NOSORT - REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT); #else # define GLOB_NOSORT 0 #endif #ifdef GLOB_NOCHECK - REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT); #else # define GLOB_NOCHECK 0 #endif #ifdef GLOB_NOESCAPE - REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT); #else # define GLOB_NOESCAPE 0 #endif #ifdef GLOB_ERR - REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT); #else # define GLOB_ERR 0 #endif @@ -201,8 +201,8 @@ PHP_MINIT_FUNCTION(dir) /* This is used for checking validity of passed flags (passing invalid flags causes segfault in glob()!! */ #define GLOB_AVAILABLE_FLAGS (0 | GLOB_BRACE | GLOB_MARK | GLOB_NOSORT | GLOB_NOCHECK | GLOB_NOESCAPE | GLOB_ERR | GLOB_ONLYDIR) - REGISTER_LONG_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT); #endif /* HAVE_GLOB */ diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 19573d8e42..2f92c82d2c 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -83,7 +83,7 @@ PHPAPI PHP_FUNCTION(dl) } php_dl(filename, MODULE_TEMPORARY, return_value, 0 TSRMLS_CC); - if (Z_LVAL_P(return_value) == 1) { + if (Z_IVAL_P(return_value) == 1) { EG(full_tables_cleanup) = 1; } } diff --git a/ext/standard/dns.c b/ext/standard/dns.c index cabe3d72f1..c760fc0713 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -448,10 +448,10 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int add_assoc_string(subarray, "host", name); add_assoc_string(subarray, "class", "IN"); - add_assoc_long(subarray, "ttl", ttl); + add_assoc_int(subarray, "ttl", ttl); if (raw) { - add_assoc_long(subarray, "type", type); + add_assoc_int(subarray, "type", type); add_assoc_stringl(subarray, "data", (char*) cp, (uint) dlen); cp += dlen; return cp; @@ -467,7 +467,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int case DNS_T_MX: add_assoc_string(subarray, "type", "MX"); GETSHORT(n, cp); - add_assoc_long(subarray, "pri", n); + add_assoc_int(subarray, "pri", n); /* no break; */ case DNS_T_CNAME: if (type == DNS_T_CNAME) { @@ -546,15 +546,15 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int cp += n; add_assoc_string(subarray, "rname", name); GETLONG(n, cp); - add_assoc_long(subarray, "serial", n); + add_assoc_int(subarray, "serial", n); GETLONG(n, cp); - add_assoc_long(subarray, "refresh", n); + add_assoc_int(subarray, "refresh", n); GETLONG(n, cp); - add_assoc_long(subarray, "retry", n); + add_assoc_int(subarray, "retry", n); GETLONG(n, cp); - add_assoc_long(subarray, "expire", n); + add_assoc_int(subarray, "expire", n); GETLONG(n, cp); - add_assoc_long(subarray, "minimum-ttl", n); + add_assoc_int(subarray, "minimum-ttl", n); break; case DNS_T_AAAA: tp = (u_char*)name; @@ -594,7 +594,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int add_assoc_string(subarray, "type", "A6"); n = ((int)cp[0]) & 0xFF; cp++; - add_assoc_long(subarray, "masklen", n); + add_assoc_int(subarray, "masklen", n); tp = (u_char*)name; if (n > 15) { have_v6_break = 1; @@ -667,11 +667,11 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int case DNS_T_SRV: add_assoc_string(subarray, "type", "SRV"); GETSHORT(n, cp); - add_assoc_long(subarray, "pri", n); + add_assoc_int(subarray, "pri", n); GETSHORT(n, cp); - add_assoc_long(subarray, "weight", n); + add_assoc_int(subarray, "weight", n); GETSHORT(n, cp); - add_assoc_long(subarray, "port", n); + add_assoc_int(subarray, "port", n); n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); if (n < 0) { return NULL; @@ -682,9 +682,9 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int case DNS_T_NAPTR: add_assoc_string(subarray, "type", "NAPTR"); GETSHORT(n, cp); - add_assoc_long(subarray, "order", n); + add_assoc_int(subarray, "order", n); GETSHORT(n, cp); - add_assoc_long(subarray, "pref", n); + add_assoc_int(subarray, "pref", n); n = (cp[0] & 0xFF); add_assoc_stringl(subarray, "flags", (char*)++cp, n); cp += n; @@ -1011,7 +1011,7 @@ PHP_FUNCTION(dns_get_mx) cp += i; add_next_index_string(mx_list, buf); if (weight_list) { - add_next_index_long(weight_list, weight); + add_next_index_int(weight_list, weight); } } php_dns_free_handle(handle); @@ -1023,20 +1023,20 @@ PHP_FUNCTION(dns_get_mx) #if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) PHP_MINIT_FUNCTION(dns) { - REGISTER_LONG_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_A6", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_A6", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT); return SUCCESS; } #endif /* HAVE_FULL_DNS_FUNCS */ diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c index f255ebba63..7ef53dd0e7 100644 --- a/ext/standard/dns_win32.c +++ b/ext/standard/dns_win32.c @@ -77,7 +77,7 @@ PHP_FUNCTION(dns_get_mx) /* {{{ */ add_next_index_string(mx_list, pRec->Data.MX.pNameExchange); if (weight_list) { - add_next_index_long(weight_list, srv->wPriority); + add_next_index_int(weight_list, srv->wPriority); } } @@ -158,10 +158,10 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, add_assoc_string(subarray, "host", pRec->pName); add_assoc_string(subarray, "class", "IN"); - add_assoc_long(subarray, "ttl", ttl); + add_assoc_int(subarray, "ttl", ttl); if (raw) { - add_assoc_long(subarray, "type", type); + add_assoc_int(subarray, "type", type); add_assoc_stringl(subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength); return; } @@ -177,7 +177,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, case DNS_TYPE_MX: add_assoc_string(subarray, "type", "MX"); - add_assoc_long(subarray, "pri", pRec->Data.Srv.wPriority); + add_assoc_int(subarray, "pri", pRec->Data.Srv.wPriority); /* no break; */ case DNS_TYPE_CNAME: @@ -241,11 +241,11 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, add_assoc_string(subarray, "mname", data_soa->pNamePrimaryServer); add_assoc_string(subarray, "rname", data_soa->pNameAdministrator); - add_assoc_long(subarray, "serial", data_soa->dwSerialNo); - add_assoc_long(subarray, "refresh", data_soa->dwRefresh); - add_assoc_long(subarray, "retry", data_soa->dwRetry); - add_assoc_long(subarray, "expire", data_soa->dwExpire); - add_assoc_long(subarray, "minimum-ttl", data_soa->dwDefaultTtl); + add_assoc_int(subarray, "serial", data_soa->dwSerialNo); + add_assoc_int(subarray, "refresh", data_soa->dwRefresh); + add_assoc_int(subarray, "retry", data_soa->dwRetry); + add_assoc_int(subarray, "expire", data_soa->dwExpire); + add_assoc_int(subarray, "minimum-ttl", data_soa->dwDefaultTtl); } break; @@ -309,9 +309,9 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, DNS_SRV_DATA *data_srv = &pRec->Data.Srv; add_assoc_string(subarray, "type", "SRV"); - add_assoc_long(subarray, "pri", data_srv->wPriority); - add_assoc_long(subarray, "weight", data_srv->wWeight); - add_assoc_long(subarray, "port", data_srv->wPort); + add_assoc_int(subarray, "pri", data_srv->wPriority); + add_assoc_int(subarray, "weight", data_srv->wWeight); + add_assoc_int(subarray, "port", data_srv->wPort); add_assoc_string(subarray, "target", data_srv->pNameTarget); } break; @@ -322,8 +322,8 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, DNS_NAPTR_DATA * data_naptr = &pRec->Data.Naptr; add_assoc_string(subarray, "type", "NAPTR"); - add_assoc_long(subarray, "order", data_naptr->wOrder); - add_assoc_long(subarray, "pref", data_naptr->wPreference); + add_assoc_int(subarray, "order", data_naptr->wOrder); + add_assoc_int(subarray, "pref", data_naptr->wPreference); add_assoc_string(subarray, "flags", data_naptr->pFlags); add_assoc_string(subarray, "services", data_naptr->pService); add_assoc_string(subarray, "regex", data_naptr->pRegularExpression); diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 6720231089..87e73ee4f2 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -200,7 +200,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ } if (ret_code) { zval_dtor(ret_code); - ZVAL_LONG(ret_code, ret); + ZVAL_INT(ret_code, ret); } } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index 4551bef8cf..5b0237ba4e 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -188,135 +188,135 @@ PHP_MINIT_FUNCTION(file) REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOCK_SH", PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOCK_EX", PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOCK_UN", PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOCK_NB", PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CLIENT_CONNECT", PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_ANY_CLIENT", STREAM_CRYPTO_METHOD_ANY_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT", STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_ANY_SERVER", STREAM_CRYPTO_METHOD_ANY_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_SERVER", STREAM_CRYPTO_METHOD_TLSv1_0_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_SERVER", STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_SERVER", STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, CONST_CS|CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SHUT_RDWR", STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOCK_SH", PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOCK_EX", PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOCK_UN", PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOCK_NB", PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CLIENT_CONNECT", PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_ANY_CLIENT", STREAM_CRYPTO_METHOD_ANY_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT", STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_ANY_SERVER", STREAM_CRYPTO_METHOD_ANY_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_SERVER", STREAM_CRYPTO_METHOD_TLSv1_0_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_SERVER", STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_SERVER", STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, CONST_CS|CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SHUT_RDWR", STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT); #ifdef PF_INET - REGISTER_LONG_CONSTANT("STREAM_PF_INET", PF_INET, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_INET", PF_INET, CONST_CS|CONST_PERSISTENT); #elif defined(AF_INET) - REGISTER_LONG_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT); #endif #if HAVE_IPV6 # ifdef PF_INET6 - REGISTER_LONG_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT); # elif defined(AF_INET6) - REGISTER_LONG_CONSTANT("STREAM_PF_INET6", AF_INET6, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_INET6", AF_INET6, CONST_CS|CONST_PERSISTENT); # endif #endif #ifdef PF_UNIX - REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", PF_UNIX, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_UNIX", PF_UNIX, CONST_CS|CONST_PERSISTENT); #elif defined(AF_UNIX) - REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", AF_UNIX, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_UNIX", AF_UNIX, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_IP /* most people will use this one when calling socket() or socketpair() */ - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_IP", IPPROTO_IP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_IP", IPPROTO_IP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_TCP - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_TCP", IPPROTO_TCP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_TCP", IPPROTO_TCP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_UDP - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_UDP", IPPROTO_UDP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_UDP", IPPROTO_UDP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_ICMP - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_ICMP", IPPROTO_ICMP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_ICMP", IPPROTO_ICMP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_RAW - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_RAW", IPPROTO_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_RAW", IPPROTO_RAW, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("STREAM_SOCK_STREAM", SOCK_STREAM, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SOCK_DGRAM", SOCK_DGRAM, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_STREAM", SOCK_STREAM, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_DGRAM", SOCK_DGRAM, CONST_CS|CONST_PERSISTENT); #ifdef SOCK_RAW - REGISTER_LONG_CONSTANT("STREAM_SOCK_RAW", SOCK_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_RAW", SOCK_RAW, CONST_CS|CONST_PERSISTENT); #endif #ifdef SOCK_SEQPACKET - REGISTER_LONG_CONSTANT("STREAM_SOCK_SEQPACKET", SOCK_SEQPACKET, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_SEQPACKET", SOCK_SEQPACKET, CONST_CS|CONST_PERSISTENT); #endif #ifdef SOCK_RDM - REGISTER_LONG_CONSTANT("STREAM_SOCK_RDM", SOCK_RDM, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_RDM", SOCK_RDM, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_FNMATCH - REGISTER_LONG_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT); # ifdef FNM_CASEFOLD /* a GNU extension */ /* TODO emulate if not available */ - REGISTER_LONG_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT); # endif #endif @@ -358,14 +358,14 @@ PHP_FUNCTION(flock) if (arg3) { zval_dtor(arg3); - ZVAL_LONG(arg3, 0); + ZVAL_INT(arg3, 0); } /* flock_values contains all possible actions if (operation & 4) we won't block on the lock */ act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0); if (php_stream_lock(stream, act)) { if (operation && errno == EWOULDBLOCK && arg3) { - ZVAL_LONG(arg3, 1); + ZVAL_INT(arg3, 1); } RETURN_FALSE; } @@ -640,17 +640,17 @@ PHP_FUNCTION(file_put_contents) break; } case IS_NULL: - case IS_LONG: + case IS_INT: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: convert_to_string_ex(data); case IS_STRING: - if (Z_STRLEN_P(data)) { - numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); - if (numbytes != Z_STRLEN_P(data)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN_P(data)); + if (Z_STRSIZE_P(data)) { + numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRSIZE_P(data)); + if (numbytes != Z_STRSIZE_P(data)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %d bytes written, possibly out of free disk space", numbytes, Z_STRSIZE_P(data)); numbytes = -1; } } @@ -687,9 +687,9 @@ PHP_FUNCTION(file_put_contents) zval out; if (zend_std_cast_object_tostring(data, &out, IS_STRING TSRMLS_CC) == SUCCESS) { - numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); - if (numbytes != Z_STRLEN(out)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); + numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRSIZE(out)); + if (numbytes != Z_STRSIZE(out)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %d bytes written, possibly out of free disk space", numbytes, Z_STRSIZE(out)); numbytes = -1; } zval_dtor(&out); @@ -706,7 +706,7 @@ PHP_FUNCTION(file_put_contents) RETURN_FALSE; } - RETURN_LONG(numbytes); + RETURN_INT(numbytes); } /* }}} */ @@ -980,7 +980,7 @@ PHP_FUNCTION(pclose) FG(pclose_wait) = 1; zend_list_close(stream->res); FG(pclose_wait) = 0; - RETURN_LONG(FG(pclose_ret)); + RETURN_INT(FG(pclose_ret)); } /* }}} */ @@ -1215,7 +1215,7 @@ PHPAPI PHP_FUNCTION(fwrite) } if (!num_bytes) { - RETURN_LONG(0); + RETURN_INT(0); } PHP_STREAM_TO_ZVAL(stream, arg1); @@ -1225,7 +1225,7 @@ PHPAPI PHP_FUNCTION(fwrite) efree(buffer); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1289,7 +1289,7 @@ PHPAPI PHP_FUNCTION(ftell) if (ret == -1) { RETURN_FALSE; } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1307,7 +1307,7 @@ PHPAPI PHP_FUNCTION(fseek) PHP_STREAM_TO_ZVAL(stream, arg1); - RETURN_LONG(php_stream_seek(stream, arg2, whence)); + RETURN_INT(php_stream_seek(stream, arg2, whence)); } /* }}} */ @@ -1398,7 +1398,7 @@ PHP_FUNCTION(readfile) if (stream) { size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_LONG(size); + RETURN_INT(size); } RETURN_FALSE; @@ -1428,7 +1428,7 @@ PHP_FUNCTION(umask) umask(arg1); } - RETURN_LONG(oldumask); + RETURN_INT(oldumask); } /* }}} */ @@ -1447,7 +1447,7 @@ PHPAPI PHP_FUNCTION(fpassthru) PHP_STREAM_TO_ZVAL(stream, arg1); size = php_stream_passthru(stream); - RETURN_LONG(size); + RETURN_INT(size); } /* }}} */ @@ -1568,30 +1568,30 @@ PHP_NAMED_FUNCTION(php_if_fstat) array_init(return_value); - ZVAL_LONG(&stat_dev, stat_ssb.sb.st_dev); - ZVAL_LONG(&stat_ino, stat_ssb.sb.st_ino); - ZVAL_LONG(&stat_mode, stat_ssb.sb.st_mode); - ZVAL_LONG(&stat_nlink, stat_ssb.sb.st_nlink); - ZVAL_LONG(&stat_uid, stat_ssb.sb.st_uid); - ZVAL_LONG(&stat_gid, stat_ssb.sb.st_gid); + ZVAL_INT(&stat_dev, stat_ssb.sb.st_dev); + ZVAL_INT(&stat_ino, stat_ssb.sb.st_ino); + ZVAL_INT(&stat_mode, stat_ssb.sb.st_mode); + ZVAL_INT(&stat_nlink, stat_ssb.sb.st_nlink); + ZVAL_INT(&stat_uid, stat_ssb.sb.st_uid); + ZVAL_INT(&stat_gid, stat_ssb.sb.st_gid); #ifdef HAVE_ST_RDEV - ZVAL_LONG(&stat_rdev, stat_ssb.sb.st_rdev); + ZVAL_INT(&stat_rdev, stat_ssb.sb.st_rdev); #else - ZVAL_LONG(&stat_rdev, -1); + ZVAL_INT(&stat_rdev, -1); #endif - ZVAL_LONG(&stat_size, stat_ssb.sb.st_size); - ZVAL_LONG(&stat_atime, stat_ssb.sb.st_atime); - ZVAL_LONG(&stat_mtime, stat_ssb.sb.st_mtime); - ZVAL_LONG(&stat_ctime, stat_ssb.sb.st_ctime); + ZVAL_INT(&stat_size, stat_ssb.sb.st_size); + ZVAL_INT(&stat_atime, stat_ssb.sb.st_atime); + ZVAL_INT(&stat_mtime, stat_ssb.sb.st_mtime); + ZVAL_INT(&stat_ctime, stat_ssb.sb.st_ctime); #ifdef HAVE_ST_BLKSIZE - ZVAL_LONG(&stat_blksize, stat_ssb.sb.st_blksize); + ZVAL_INT(&stat_blksize, stat_ssb.sb.st_blksize); #else - ZVAL_LONG(&stat_blksize,-1); + ZVAL_INT(&stat_blksize,-1); #endif #ifdef HAVE_ST_BLOCKS - ZVAL_LONG(&stat_blocks, stat_ssb.sb.st_blocks); + ZVAL_INT(&stat_blocks, stat_ssb.sb.st_blocks); #else - ZVAL_LONG(&stat_blocks,-1); + ZVAL_INT(&stat_blocks,-1); #endif /* Store numeric indexes in propper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); @@ -1782,10 +1782,10 @@ PHPAPI PHP_FUNCTION(fread) } ZVAL_NEW_STR(return_value, STR_ALLOC(len, 0)); - Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); + Z_STRSIZE_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); /* needed because recv/read/gzread doesnt put a null at the end*/ - Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; + Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0; } /* }}} */ @@ -1887,7 +1887,7 @@ PHP_FUNCTION(fputcsv) PHP_STREAM_TO_ZVAL(stream, fp); ret = php_fputcsv(stream, fields, delimiter, enclosure, escape_char TSRMLS_CC); - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 9fb35ef344..b1b7e5933a 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -437,9 +437,9 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ if(wrapper && wrapper->wops->stream_metadata) { int option; void *value; - if (Z_TYPE_P(group) == IS_LONG) { + if (Z_TYPE_P(group) == IS_INT) { option = PHP_STREAM_META_GROUP; - value = &Z_LVAL_P(group); + value = &Z_IVAL_P(group); } else if (Z_TYPE_P(group) == IS_STRING) { option = PHP_STREAM_META_GROUP_NAME; value = Z_STRVAL_P(group); @@ -465,8 +465,8 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ /* We have no native chgrp on Windows, nothing left to do if stream doesn't have own implementation */ RETURN_FALSE; #else - if (Z_TYPE_P(group) == IS_LONG) { - gid = (gid_t)Z_LVAL_P(group); + if (Z_TYPE_P(group) == IS_INT) { + gid = (gid_t)Z_IVAL_P(group); } else if (Z_TYPE_P(group) == IS_STRING) { if(php_get_gid_by_name(Z_STRVAL_P(group), &gid TSRMLS_CC) != SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find gid for %s", Z_STRVAL_P(group)); @@ -574,9 +574,9 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ if(wrapper && wrapper->wops->stream_metadata) { int option; void *value; - if (Z_TYPE_P(user) == IS_LONG) { + if (Z_TYPE_P(user) == IS_INT) { option = PHP_STREAM_META_OWNER; - value = &Z_LVAL_P(user); + value = &Z_IVAL_P(user); } else if (Z_TYPE_P(user) == IS_STRING) { option = PHP_STREAM_META_OWNER_NAME; value = Z_STRVAL_P(user); @@ -603,8 +603,8 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ RETURN_FALSE; #else - if (Z_TYPE_P(user) == IS_LONG) { - uid = (uid_t)Z_LVAL_P(user); + if (Z_TYPE_P(user) == IS_INT) { + uid = (uid_t)Z_IVAL_P(user); } else if (Z_TYPE_P(user) == IS_STRING) { if(php_get_uid_by_name(Z_STRVAL_P(user), &uid TSRMLS_CC) != SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find uid for %s", Z_STRVAL_P(user)); @@ -962,21 +962,21 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ switch (type) { case FS_PERMS: - RETURN_LONG((long)ssb.sb.st_mode); + RETURN_INT((long)ssb.sb.st_mode); case FS_INODE: - RETURN_LONG((long)ssb.sb.st_ino); + RETURN_INT((long)ssb.sb.st_ino); case FS_SIZE: - RETURN_LONG((long)ssb.sb.st_size); + RETURN_INT((long)ssb.sb.st_size); case FS_OWNER: - RETURN_LONG((long)ssb.sb.st_uid); + RETURN_INT((long)ssb.sb.st_uid); case FS_GROUP: - RETURN_LONG((long)ssb.sb.st_gid); + RETURN_INT((long)ssb.sb.st_gid); case FS_ATIME: - RETURN_LONG((long)ssb.sb.st_atime); + RETURN_INT((long)ssb.sb.st_atime); case FS_MTIME: - RETURN_LONG((long)ssb.sb.st_mtime); + RETURN_INT((long)ssb.sb.st_mtime); case FS_CTIME: - RETURN_LONG((long)ssb.sb.st_ctime); + RETURN_INT((long)ssb.sb.st_ctime); case FS_TYPE: if (S_ISLNK(ssb.sb.st_mode)) { RETURN_STRING("link"); @@ -1012,30 +1012,30 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ case FS_STAT: array_init(return_value); - ZVAL_LONG(&stat_dev, stat_sb->st_dev); - ZVAL_LONG(&stat_ino, stat_sb->st_ino); - ZVAL_LONG(&stat_mode, stat_sb->st_mode); - ZVAL_LONG(&stat_nlink, stat_sb->st_nlink); - ZVAL_LONG(&stat_uid, stat_sb->st_uid); - ZVAL_LONG(&stat_gid, stat_sb->st_gid); + ZVAL_INT(&stat_dev, stat_sb->st_dev); + ZVAL_INT(&stat_ino, stat_sb->st_ino); + ZVAL_INT(&stat_mode, stat_sb->st_mode); + ZVAL_INT(&stat_nlink, stat_sb->st_nlink); + ZVAL_INT(&stat_uid, stat_sb->st_uid); + ZVAL_INT(&stat_gid, stat_sb->st_gid); #ifdef HAVE_ST_RDEV - ZVAL_LONG(&stat_rdev, stat_sb->st_rdev); + ZVAL_INT(&stat_rdev, stat_sb->st_rdev); #else - ZVAL_LONG(&stat_rdev, -1); + ZVAL_INT(&stat_rdev, -1); #endif - ZVAL_LONG(&stat_size, stat_sb->st_size); - ZVAL_LONG(&stat_atime, stat_sb->st_atime); - ZVAL_LONG(&stat_mtime, stat_sb->st_mtime); - ZVAL_LONG(&stat_ctime, stat_sb->st_ctime); + ZVAL_INT(&stat_size, stat_sb->st_size); + ZVAL_INT(&stat_atime, stat_sb->st_atime); + ZVAL_INT(&stat_mtime, stat_sb->st_mtime); + ZVAL_INT(&stat_ctime, stat_sb->st_ctime); #ifdef HAVE_ST_BLKSIZE - ZVAL_LONG(&stat_blksize, stat_sb->st_blksize); + ZVAL_INT(&stat_blksize, stat_sb->st_blksize); #else - ZVAL_LONG(&stat_blksize,-1); + ZVAL_INT(&stat_blksize,-1); #endif #ifdef HAVE_ST_BLOCKS - ZVAL_LONG(&stat_blocks, stat_sb->st_blocks); + ZVAL_INT(&stat_blocks, stat_sb->st_blocks); #else - ZVAL_LONG(&stat_blocks,-1); + ZVAL_INT(&stat_blocks,-1); #endif /* Store numeric indexes in propper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); @@ -1201,7 +1201,7 @@ PHP_FUNCTION(realpath_cache_size) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_LONG(realpath_cache_size(TSRMLS_C)); + RETURN_INT(realpath_cache_size(TSRMLS_C)); } /* {{{ proto bool realpath_cache_get() @@ -1224,13 +1224,13 @@ PHP_FUNCTION(realpath_cache_get) /* bucket->key is unsigned long */ if (LONG_MAX >= bucket->key) { - add_assoc_long(&entry, "key", bucket->key); + add_assoc_int(&entry, "key", bucket->key); } else { add_assoc_double(&entry, "key", (double)bucket->key); } add_assoc_bool(&entry, "is_dir", bucket->is_dir); add_assoc_stringl(&entry, "realpath", bucket->realpath, bucket->realpath_len); - add_assoc_long(&entry, "expires", bucket->expires); + add_assoc_int(&entry, "expires", bucket->expires); #ifdef PHP_WIN32 add_assoc_bool(&entry, "is_rvalid", bucket->is_rvalid); add_assoc_bool(&entry, "is_wvalid", bucket->is_wvalid); diff --git a/ext/standard/filters.c b/ext/standard/filters.c index d40321f959..b595252cc5 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -263,14 +263,14 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) { convert_to_string_ex(tmp); smart_str_appendc(&tags_ss, '<'); - smart_str_appendl(&tags_ss, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&tags_ss, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_appendc(&tags_ss, '>'); } ZEND_HASH_FOREACH_END(); smart_str_0(&tags_ss); } else { /* FIXME: convert_to_* may clutter zvals and lead it into segfault ? */ convert_to_string_ex(filterparams); - smart_str_setl(&tags_ss, Z_STRVAL_P(filterparams), Z_STRLEN_P(filterparams)); + smart_str_setl(&tags_ss, Z_STRVAL_P(filterparams), Z_STRSIZE_P(filterparams)); } } @@ -1241,13 +1241,13 @@ static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, long *pretv if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) { zval tmp, *ztval = *tmpval; - if (Z_TYPE_PP(tmpval) != IS_LONG) { + if (Z_TYPE_PP(tmpval) != IS_INT) { tmp = *ztval; zval_copy_ctor(&tmp); - convert_to_long(&tmp); + convert_to_int(&tmp); ztval = &tmp; } - *pretval = Z_LVAL_P(ztval); + *pretval = Z_IVAL_P(ztval); } else { return PHP_CONV_ERR_NOT_FOUND; } @@ -1264,15 +1264,15 @@ static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, unsigned l if ((tmpval = zend_hash_str_find((HashTable *)ht, field_name, field_name_len-1)) != NULL) { zval tmp; - if (Z_TYPE_P(tmpval) != IS_LONG) { + if (Z_TYPE_P(tmpval) != IS_INT) { ZVAL_DUP(&tmp, tmpval);; - convert_to_long(&tmp); + convert_to_int(&tmp); tmpval = &tmp; } - if (Z_LVAL_P(tmpval) < 0) { + if (Z_IVAL_P(tmpval) < 0) { *pretval = 0; } else { - *pretval = Z_LVAL_P(tmpval); + *pretval = Z_IVAL_P(tmpval); } } else { return PHP_CONV_ERR_NOT_FOUND; diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index edd704b068..4725f46386 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -416,12 +416,12 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC) } format = Z_STRVAL(args[format_offset]); - format_len = Z_STRLEN(args[format_offset]); + format_len = Z_STRSIZE(args[format_offset]); result = STR_ALLOC(size, 0); currarg = 1; - while (inpos < Z_STRLEN(args[format_offset])) { + while (inpos < Z_STRSIZE(args[format_offset])) { int expprec = 0; zval *tmp; @@ -687,7 +687,7 @@ PHP_FUNCTION(user_printf) } rlen = PHPWRITE(result->val, result->len); STR_FREE(result); - RETURN_LONG(rlen); + RETURN_INT(rlen); } /* }}} */ @@ -703,7 +703,7 @@ PHP_FUNCTION(vprintf) } rlen = PHPWRITE(result->val, result->len); STR_FREE(result); - RETURN_LONG(rlen); + RETURN_INT(rlen); } /* }}} */ @@ -731,7 +731,7 @@ PHP_FUNCTION(fprintf) php_stream_write(stream, result->val, result->len); - RETVAL_LONG(result->len); + RETVAL_INT(result->len); STR_FREE(result); } /* }}} */ @@ -760,7 +760,7 @@ PHP_FUNCTION(vfprintf) php_stream_write(stream, result->val, result->len); - RETVAL_LONG(result->len); + RETVAL_INT(result->len); STR_FREE(result); } /* }}} */ diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 300df8c1c0..f47331f6af 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -69,7 +69,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, 0); + ZVAL_INT(zerrno, 0); } if (zerrstr) { zval_dtor(zerrstr); @@ -93,7 +93,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, err); + ZVAL_INT(zerrno, err); } if (zerrstr && errstr) { /* no need to dup; we need to efree buf anyway */ diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c index 4833bddc01..709d90840b 100644 --- a/ext/standard/ftok.c +++ b/ext/standard/ftok.c @@ -41,16 +41,16 @@ PHP_FUNCTION(ftok) if (pathname_len == 0){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pathname is invalid"); - RETURN_LONG(-1); + RETURN_INT(-1); } if (proj_len != 1){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Project identifier is invalid"); - RETURN_LONG(-1); + RETURN_INT(-1); } if (php_check_open_basedir(pathname TSRMLS_CC)) { - RETURN_LONG(-1); + RETURN_INT(-1); } k = ftok(pathname, proj[0]); @@ -58,7 +58,7 @@ PHP_FUNCTION(ftok) php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftok() failed - %s", strerror(errno)); } - RETURN_LONG(k); + RETURN_INT(k); } /* }}} */ #endif diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 31b96fb68c..ae7f28b7da 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -498,7 +498,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa } else if (read_write == 2) { /* when writing file (but not appending), it must NOT exist, unless a context option exists which allows it */ if (context && (tmpzval = php_stream_context_get_option(context, "ftp", "overwrite")) != NULL) { - allow_overwrite = Z_LVAL_P(tmpzval); + allow_overwrite = Z_IVAL_P(tmpzval); } if (result <= 299 && result >= 200) { if (allow_overwrite) { @@ -529,12 +529,12 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa /* set resume position if applicable */ if (context && (tmpzval = php_stream_context_get_option(context, "ftp", "resume_pos")) != NULL && - Z_TYPE_P(tmpzval) == IS_LONG && - Z_LVAL_P(tmpzval) > 0) { - php_stream_printf(stream TSRMLS_CC, "REST %ld\r\n", Z_LVAL_P(tmpzval)); + Z_TYPE_P(tmpzval) == IS_INT && + Z_IVAL_P(tmpzval) > 0) { + php_stream_printf(stream TSRMLS_CC, "REST %ld\r\n", Z_IVAL_P(tmpzval)); result = GET_FTP_RESULT(stream); if (result < 300 || result > 399) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %ld", Z_LVAL_P(tmpzval)); + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %ld", Z_IVAL_P(tmpzval)); goto errexit; } } diff --git a/ext/standard/head.c b/ext/standard/head.c index ad82b9fbbf..ec792bee2c 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -239,7 +239,7 @@ PHP_FUNCTION(headers_sent) switch(ZEND_NUM_ARGS()) { case 2: zval_dtor(arg2); - ZVAL_LONG(arg2, line); + ZVAL_INT(arg2, line); case 1: zval_dtor(arg1); if (file) { @@ -303,7 +303,7 @@ PHP_FUNCTION(http_response_code) SG(sapi_headers).http_response_code = response_code; if (old_response_code) { - RETURN_LONG(old_response_code); + RETURN_INT(old_response_code); } RETURN_TRUE; @@ -313,7 +313,7 @@ PHP_FUNCTION(http_response_code) RETURN_FALSE; } - RETURN_LONG(SG(sapi_headers).http_response_code); + RETURN_INT(SG(sapi_headers).http_response_code); } /* }}} */ diff --git a/ext/standard/html.c b/ext/standard/html.c index 360639ea76..e072abd3a4 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1477,18 +1477,18 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) */ void register_html_constants(INIT_FUNC_ARGS) { - REGISTER_LONG_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_IGNORE", ENT_IGNORE, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_SUBSTITUTE", ENT_SUBSTITUTE, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_DISALLOWED", ENT_DISALLOWED, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_HTML401", ENT_HTML401, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_XML1", ENT_XML1, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_XHTML", ENT_XHTML, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_HTML5", ENT_HTML5, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_IGNORE", ENT_IGNORE, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_SUBSTITUTE", ENT_SUBSTITUTE, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_DISALLOWED", ENT_DISALLOWED, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_HTML401", ENT_HTML401, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_XML1", ENT_XML1, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_XHTML", ENT_XHTML, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_HTML5", ENT_HTML5, CONST_PERSISTENT|CONST_CS); } /* }}} */ diff --git a/ext/standard/http.c b/ext/standard/http.c index 34b8e79389..a3eb8246d3 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -178,19 +178,19 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, case IS_STRING: { zend_string *ekey; if (enc_type == PHP_QUERY_RFC3986) { - ekey = php_raw_url_encode(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata)); + ekey = php_raw_url_encode(Z_STRVAL_P(zdata), Z_STRSIZE_P(zdata)); } else { - ekey = php_url_encode(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata)); + ekey = php_url_encode(Z_STRVAL_P(zdata), Z_STRSIZE_P(zdata)); } smart_str_appendl(formstr, ekey->val, ekey->len); STR_FREE(ekey); } break; - case IS_LONG: + case IS_INT: { char *ekey; int ekey_len; - ekey_len = spprintf(&ekey, 0, "%ld", Z_LVAL_P(zdata)); + ekey_len = spprintf(&ekey, 0, "%ld", Z_IVAL_P(zdata)); smart_str_appendl(formstr, ekey, ekey_len); efree(ekey); } @@ -217,9 +217,9 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, ZVAL_DUP(©zval, zdata); convert_to_string_ex(©zval); if (enc_type == PHP_QUERY_RFC3986) { - ekey = php_raw_url_encode(Z_STRVAL(copyzval), Z_STRLEN(copyzval)); + ekey = php_raw_url_encode(Z_STRVAL(copyzval), Z_STRSIZE(copyzval)); } else { - ekey = php_url_encode(Z_STRVAL(copyzval), Z_STRLEN(copyzval)); + ekey = php_url_encode(Z_STRVAL(copyzval), Z_STRSIZE(copyzval)); } smart_str_appendl(formstr, ekey->val, ekey->len); zval_ptr_dtor(©zval); diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 73952dda31..ffec818037 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -160,7 +160,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, if (!context || (tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "proxy")) == NULL || Z_TYPE_P(tmpzval) != IS_STRING || - Z_STRLEN_P(tmpzval) <= 0) { + Z_STRSIZE_P(tmpzval) <= 0) { php_url_free(resource); return php_stream_open_wrapper_ex(path, mode, REPORT_ERRORS, NULL, context); } @@ -169,8 +169,8 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, use_ssl = 0; use_proxy = 1; - transport_len = Z_STRLEN_P(tmpzval); - transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); + transport_len = Z_STRSIZE_P(tmpzval); + transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); } else { /* Normal http request (possibly with proxy) */ @@ -190,10 +190,10 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, if (context && (tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "proxy")) != NULL && Z_TYPE_P(tmpzval) == IS_STRING && - Z_STRLEN_P(tmpzval) > 0) { + Z_STRSIZE_P(tmpzval) > 0) { use_proxy = 1; - transport_len = Z_STRLEN_P(tmpzval); - transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); + transport_len = Z_STRSIZE_P(tmpzval); + transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); } else { transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port); } @@ -271,7 +271,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, } while (*s != 0); } } ZEND_HASH_FOREACH_END(); - } else if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval)) { + } else if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval)) { s = Z_STRVAL_P(tmpzval); do { while (*s == ' ' || *s == '\t') s++; @@ -350,16 +350,16 @@ finish: } if (context && (tmpzval = php_stream_context_get_option(context, "http", "method")) != NULL) { - if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0) { + if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0) { /* As per the RFC, automatically redirected requests MUST NOT use other methods than * GET and HEAD unless it can be confirmed by the user */ if (!redirected - || (Z_STRLEN_P(tmpzval) == 3 && memcmp("GET", Z_STRVAL_P(tmpzval), 3) == 0) - || (Z_STRLEN_P(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_P(tmpzval), 4) == 0) + || (Z_STRSIZE_P(tmpzval) == 3 && memcmp("GET", Z_STRVAL_P(tmpzval), 3) == 0) + || (Z_STRSIZE_P(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_P(tmpzval), 4) == 0) ) { - scratch_len = strlen(path) + 29 + Z_STRLEN_P(tmpzval); + scratch_len = strlen(path) + 29 + Z_STRSIZE_P(tmpzval); scratch = emalloc(scratch_len); - strlcpy(scratch, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) + 1); + strlcpy(scratch, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) + 1); strncat(scratch, " ", 1); } } @@ -422,7 +422,7 @@ finish: ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmpzval), tmpheader) { if (Z_TYPE_P(tmpheader) == IS_STRING) { - smart_str_appendl(&tmpstr, Z_STRVAL_P(tmpheader), Z_STRLEN_P(tmpheader)); + smart_str_appendl(&tmpstr, Z_STRVAL_P(tmpheader), Z_STRSIZE_P(tmpheader)); smart_str_appendl(&tmpstr, "\r\n", sizeof("\r\n") - 1); } } ZEND_HASH_FOREACH_END(); @@ -433,9 +433,9 @@ finish: smart_str_free(&tmpstr); } } - if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval)) { + if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval)) { /* Remove newlines and spaces from start and end php_trim will estrndup() */ - tmp = php_trim(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); + tmp = php_trim(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); } if (tmp && strlen(tmp) > 0) { char *s; @@ -609,9 +609,9 @@ finish: context && !(have_header & HTTP_HEADER_CONTENT_LENGTH) && (tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL && - Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0 + Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0 ) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_P(tmpzval)); php_stream_write(stream, scratch, scratch_len); have_header |= HTTP_HEADER_CONTENT_LENGTH; } @@ -624,9 +624,9 @@ finish: /* Request content, such as for POST requests */ if (header_init && context && (tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL && - Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0) { + Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0) { if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_P(tmpzval)); php_stream_write(stream, scratch, scratch_len); } if (!(have_header & HTTP_HEADER_TYPE)) { @@ -635,7 +635,7 @@ finish: php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Content-type not specified assuming application/x-www-form-urlencoded"); } php_stream_write(stream, "\r\n", sizeof("\r\n")-1); - php_stream_write(stream, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); + php_stream_write(stream, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); } else { php_stream_write(stream, "\r\n", sizeof("\r\n")-1); } diff --git a/ext/standard/image.c b/ext/standard/image.c index 0ec4cd3885..87ab458800 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -72,28 +72,28 @@ struct gfxinfo { * Register IMAGETYPE_<xxx> constants used by GetImageSize(), image_type_to_mime_type, ext/exif */ PHP_MINIT_FUNCTION(imagetypes) { - REGISTER_LONG_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT); #if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) - REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */ - REGISTER_LONG_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_ICO", IMAGE_FILETYPE_ICO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_UNKNOWN", IMAGE_FILETYPE_UNKNOWN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_COUNT", IMAGE_FILETYPE_COUNT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */ + REGISTER_INT_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_ICO", IMAGE_FILETYPE_ICO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_UNKNOWN", IMAGE_FILETYPE_UNKNOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_COUNT", IMAGE_FILETYPE_COUNT, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -1364,19 +1364,19 @@ static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNA } if (result) { - char temp[MAX_LENGTH_OF_LONG * 2 + sizeof("width=\"\" height=\"\"")]; + char temp[MAX_LENGTH_OF_ZEND_INT * 2 + sizeof("width=\"\" height=\"\"")]; array_init(return_value); - add_index_long(return_value, 0, result->width); - add_index_long(return_value, 1, result->height); - add_index_long(return_value, 2, itype); + add_index_int(return_value, 0, result->width); + add_index_int(return_value, 1, result->height); + add_index_int(return_value, 2, itype); snprintf(temp, sizeof(temp), "width=\"%d\" height=\"%d\"", result->width, result->height); add_index_string(return_value, 3, temp); if (result->bits != 0) { - add_assoc_long(return_value, "bits", result->bits); + add_assoc_int(return_value, "bits", result->bits); } if (result->channels != 0) { - add_assoc_long(return_value, "channels", result->channels); + add_assoc_int(return_value, "channels", result->channels); } add_assoc_string(return_value, "mime", (char*)php_image_type_to_mime_type(itype)); efree(result); diff --git a/ext/standard/info.c b/ext/standard/info.c index 47249466b0..15ecd0433a 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -244,10 +244,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) } if (!sapi_module.phpinfo_as_text) { - if (Z_STRLEN(tmp2) == 0) { + if (Z_STRSIZE(tmp2) == 0) { php_info_print("<i>no value</i>"); } else { - php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); + php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRSIZE(tmp2)); } } else { php_info_print(Z_STRVAL(tmp2)); @@ -1143,22 +1143,22 @@ PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, */ void register_phpinfo_constants(INIT_FUNC_ARGS) { - REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS); } /* }}} */ diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c index 786ca052d7..86ce0f2fbe 100644 --- a/ext/standard/levenshtein.c +++ b/ext/standard/levenshtein.c @@ -128,7 +128,7 @@ PHP_FUNCTION(levenshtein) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument string(s) too long"); } - RETURN_LONG(distance); + RETURN_INT(distance); } /* }}} */ diff --git a/ext/standard/link.c b/ext/standard/link.c index 0f889a9e6a..4265823616 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -106,11 +106,11 @@ PHP_FUNCTION(linkinfo) if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); efree(dirname); - RETURN_LONG(-1L); + RETURN_INT(-1L); } efree(dirname); - RETURN_LONG((long) sb.st_dev); + RETURN_INT((long) sb.st_dev); } /* }}} */ diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c index 41ce9d20df..60556c1fe2 100644 --- a/ext/standard/link_win32.c +++ b/ext/standard/link_win32.c @@ -98,10 +98,10 @@ PHP_FUNCTION(linkinfo) ret = VCWD_STAT(link, &sb); if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); - RETURN_LONG(-1L); + RETURN_INT(-1L); } - RETURN_LONG((long) sb.st_dev); + RETURN_INT((long) sb.st_dev); } /* }}} */ diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 815f83118f..b08c4858e8 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -92,7 +92,7 @@ PHP_FUNCTION(ezmlm_hash) h = (h % 53); - RETURN_LONG((int) h); + RETURN_INT((int) h); } /* }}} */ diff --git a/ext/standard/math.c b/ext/standard/math.c index a392eb607c..a5387458f4 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -285,11 +285,11 @@ PHP_FUNCTION(abs) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(fabs(Z_DVAL_P(value))); - } else if (Z_TYPE_P(value) == IS_LONG) { - if (Z_LVAL_P(value) == LONG_MIN) { + } else if (Z_TYPE_P(value) == IS_INT) { + if (Z_IVAL_P(value) == LONG_MIN) { RETURN_DOUBLE(-(double)LONG_MIN); } else { - RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value)); + RETURN_INT(Z_IVAL_P(value) < 0 ? -Z_IVAL_P(value) : Z_IVAL_P(value)); } } RETURN_FALSE; @@ -309,7 +309,7 @@ PHP_FUNCTION(ceil) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(ceil(Z_DVAL_P(value))); - } else if (Z_TYPE_P(value) == IS_LONG) { + } else if (Z_TYPE_P(value) == IS_INT) { RETURN_DOUBLE(zval_get_double(value)); } RETURN_FALSE; @@ -329,7 +329,7 @@ PHP_FUNCTION(floor) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(floor(Z_DVAL_P(value))); - } else if (Z_TYPE_P(value) == IS_LONG) { + } else if (Z_TYPE_P(value) == IS_INT) { RETURN_DOUBLE(zval_get_double(value)); } RETURN_FALSE; @@ -356,15 +356,15 @@ PHP_FUNCTION(round) convert_scalar_to_number_ex(value); switch (Z_TYPE_P(value)) { - case IS_LONG: + case IS_INT: /* Simple case - long that doesn't need to be rounded. */ if (places >= 0) { - RETURN_DOUBLE((double) Z_LVAL_P(value)); + RETURN_DOUBLE((double) Z_IVAL_P(value)); } /* break omitted intentionally */ case IS_DOUBLE: - return_val = (Z_TYPE_P(value) == IS_LONG) ? (double)Z_LVAL_P(value) : Z_DVAL_P(value); + return_val = (Z_TYPE_P(value) == IS_INT) ? (double)Z_IVAL_P(value) : Z_DVAL_P(value); return_val = _php_math_round(return_val, places, mode); RETURN_DOUBLE(return_val); break; @@ -938,7 +938,7 @@ PHPAPI long _php_math_basetolong(zval *arg, int base) s = Z_STRVAL_P(arg); - for (i = Z_STRLEN_P(arg); i > 0; i--) { + for (i = Z_STRSIZE_P(arg); i > 0; i--) { c = *s++; digit = (c >= '0' && c <= '9') ? c - '0' @@ -990,7 +990,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) cutoff = LONG_MAX / base; cutlim = LONG_MAX % base; - for (i = Z_STRLEN_P(arg); i > 0; i--) { + for (i = Z_STRSIZE_P(arg); i > 0; i--) { c = *s++; /* might not work for EBCDIC */ @@ -1024,7 +1024,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) if (mode == 1) { ZVAL_DOUBLE(ret, fnum); } else { - ZVAL_LONG(ret, num); + ZVAL_INT(ret, num); } return SUCCESS; } @@ -1042,11 +1042,11 @@ PHPAPI zend_string * _php_math_longtobase(zval *arg, int base TSRMLS_DC) char *ptr, *end; unsigned long value; - if (Z_TYPE_P(arg) != IS_LONG || base < 2 || base > 36) { + if (Z_TYPE_P(arg) != IS_INT || base < 2 || base > 36) { return STR_EMPTY_ALLOC(); } - value = Z_LVAL_P(arg); + value = Z_IVAL_P(arg); end = ptr = buf + sizeof(buf) - 1; *ptr = '\0'; @@ -1069,7 +1069,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC) { static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - if ((Z_TYPE_P(arg) != IS_LONG && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) { + if ((Z_TYPE_P(arg) != IS_INT && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) { return STR_EMPTY_ALLOC(); } @@ -1157,7 +1157,7 @@ PHP_FUNCTION(decbin) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { return; } - convert_to_long_ex(arg); + convert_to_int_ex(arg); result = _php_math_longtobase(arg, 2 TSRMLS_CC); RETURN_STR(result); } @@ -1173,7 +1173,7 @@ PHP_FUNCTION(decoct) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { return; } - convert_to_long_ex(arg); + convert_to_int_ex(arg); result = _php_math_longtobase(arg, 8 TSRMLS_CC); RETURN_STR(result); } @@ -1189,7 +1189,7 @@ PHP_FUNCTION(dechex) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { return; } - convert_to_long_ex(arg); + convert_to_int_ex(arg); result = _php_math_longtobase(arg, 16 TSRMLS_CC); RETURN_STR(result); } @@ -1434,10 +1434,10 @@ PHP_FUNCTION(intdiv) } else if (divisor == -1 && numerator == LONG_MIN) { /* Prevent overflow error/crash We don't return a float here as that violates function contract */ - RETURN_LONG(0); + RETURN_INT(0); } - RETURN_LONG(numerator/divisor); + RETURN_INT(numerator/divisor); } /* }}} */ diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index f8e19c74ca..3cadf729cc 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -73,11 +73,11 @@ static void _php_gettimeofday(INTERNAL_FUNCTION_PARAMETERS, int mode) offset = timelib_get_time_zone_info(tp.tv_sec, get_timezone_info(TSRMLS_C)); array_init(return_value); - add_assoc_long(return_value, "sec", tp.tv_sec); - add_assoc_long(return_value, "usec", tp.tv_usec); + add_assoc_int(return_value, "sec", tp.tv_sec); + add_assoc_int(return_value, "usec", tp.tv_usec); - add_assoc_long(return_value, "minuteswest", -offset->offset / SEC_IN_MIN); - add_assoc_long(return_value, "dsttime", offset->is_dst); + add_assoc_int(return_value, "minuteswest", -offset->offset / SEC_IN_MIN); + add_assoc_int(return_value, "dsttime", offset->is_dst); timelib_time_offset_dtor(offset); } else { @@ -130,7 +130,7 @@ PHP_FUNCTION(getrusage) array_init(return_value); #define PHP_RUSAGE_PARA(a) \ - add_assoc_long(return_value, #a, usg.a) + add_assoc_int(return_value, #a, usg.a) #if !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */ PHP_RUSAGE_PARA(ru_oublock); PHP_RUSAGE_PARA(ru_inblock); diff --git a/ext/standard/pack.c b/ext/standard/pack.c index c77a1a40c6..90fef0f855 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -89,8 +89,8 @@ static void php_pack(zval *val, int size, int *map, char *output) int i; char *v; - convert_to_long_ex(val); - v = (char *) &Z_LVAL_P(val); + convert_to_int_ex(val); + v = (char *) &Z_IVAL_P(val); for (i = 0; i < size; i++) { *output++ = v[map[i]]; @@ -126,7 +126,7 @@ PHP_FUNCTION(pack) convert_to_string_ex(&argv[0]); format = Z_STRVAL(argv[0]); - formatlen = Z_STRLEN(argv[0]); + formatlen = Z_STRSIZE(argv[0]); /* We have a maximum of <formatlen> format codes to deal with */ formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0); @@ -185,7 +185,7 @@ PHP_FUNCTION(pack) SEPARATE_ZVAL(&argv[currentarg]); } convert_to_string_ex(&argv[currentarg]); - arg = Z_STRLEN(argv[currentarg]); + arg = Z_STRSIZE(argv[currentarg]); if (code == 'Z') { /* add one because Z is always NUL-terminated: * pack("Z*", "aa") === "aa\0" @@ -771,7 +771,7 @@ PHP_FUNCTION(unpack) case 'C': { int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0; long v = php_unpack(&input[inputpos], 1, issigned, byte_map); - add_assoc_long(return_value, n, v); + add_assoc_int(return_value, n, v); break; } @@ -792,7 +792,7 @@ PHP_FUNCTION(unpack) } v = php_unpack(&input[inputpos], 2, issigned, map); - add_assoc_long(return_value, n, v); + add_assoc_int(return_value, n, v); break; } @@ -806,7 +806,7 @@ PHP_FUNCTION(unpack) } v = php_unpack(&input[inputpos], sizeof(int), issigned, int_map); - add_assoc_long(return_value, n, v); + add_assoc_int(return_value, n, v); break; } @@ -840,7 +840,7 @@ PHP_FUNCTION(unpack) v = (unsigned int) v; } } - add_assoc_long(return_value, n, v); + add_assoc_int(return_value, n, v); break; } @@ -948,8 +948,8 @@ PHP_MINIT_FUNCTION(pack) } else { zval val; - int size = sizeof(Z_LVAL(val)); - Z_LVAL(val)=0; /*silence a warning*/ + int size = sizeof(Z_IVAL(val)); + Z_IVAL(val)=0; /*silence a warning*/ /* Where to get hi to lo bytes from */ byte_map[0] = size - 1; diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index a9a4e58de0..9f7cab6edf 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -106,7 +106,7 @@ PHP_FUNCTION(getmyuid) if (uid < 0) { RETURN_FALSE; } else { - RETURN_LONG(uid); + RETURN_INT(uid); } } /* }}} */ @@ -125,7 +125,7 @@ PHP_FUNCTION(getmygid) if (gid < 0) { RETURN_FALSE; } else { - RETURN_LONG(gid); + RETURN_INT(gid); } } /* }}} */ @@ -144,7 +144,7 @@ PHP_FUNCTION(getmypid) if (pid < 0) { RETURN_FALSE; } else { - RETURN_LONG((long) pid); + RETURN_INT((long) pid); } } /* }}} */ @@ -161,7 +161,7 @@ PHP_FUNCTION(getmyinode) if (BG(page_inode) < 0) { RETURN_FALSE; } else { - RETURN_LONG(BG(page_inode)); + RETURN_INT(BG(page_inode)); } } /* }}} */ @@ -186,7 +186,7 @@ PHP_FUNCTION(getlastmod) if (lm < 0) { RETURN_FALSE; } else { - RETURN_LONG(lm); + RETURN_INT(lm); } } /* }}} */ diff --git a/ext/standard/password.c b/ext/standard/password.c index aa50ab1f00..d001e475f0 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -37,10 +37,10 @@ PHP_MINIT_FUNCTION(password) /* {{{ */ { - REGISTER_LONG_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -197,7 +197,7 @@ PHP_FUNCTION(password_get_info) { long cost = PHP_PASSWORD_BCRYPT_COST; sscanf(hash, "$2y$%ld$", &cost); - add_assoc_long(&options, "cost", cost); + add_assoc_int(&options, "cost", cost); } break; case PHP_PASSWORD_UNKNOWN: @@ -207,7 +207,7 @@ PHP_FUNCTION(password_get_info) array_init(return_value); - add_assoc_long(return_value, "algo", algo); + add_assoc_int(return_value, "algo", algo); add_assoc_string(return_value, "algoName", algo_name); add_assoc_zval(return_value, "options", &options); } @@ -242,14 +242,14 @@ PHP_FUNCTION(password_needs_rehash) long new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0; if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) { - if (Z_TYPE_P(option_buffer) != IS_LONG) { + if (Z_TYPE_P(option_buffer) != IS_INT) { zval cast_option_buffer; ZVAL_DUP(&cast_option_buffer, option_buffer); - convert_to_long(&cast_option_buffer); - new_cost = Z_LVAL(cast_option_buffer); + convert_to_int(&cast_option_buffer); + new_cost = Z_IVAL(cast_option_buffer); zval_dtor(&cast_option_buffer); } else { - new_cost = Z_LVAL_P(option_buffer); + new_cost = Z_IVAL_P(option_buffer); } } @@ -324,14 +324,14 @@ PHP_FUNCTION(password_hash) long cost = PHP_PASSWORD_BCRYPT_COST; if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) { - if (Z_TYPE_P(option_buffer) != IS_LONG) { + if (Z_TYPE_P(option_buffer) != IS_INT) { zval cast_option_buffer; ZVAL_DUP(&cast_option_buffer, option_buffer); - convert_to_long(&cast_option_buffer); - cost = Z_LVAL(cast_option_buffer); + convert_to_int(&cast_option_buffer); + cost = Z_IVAL(cast_option_buffer); zval_dtor(&cast_option_buffer); } else { - cost = Z_LVAL_P(option_buffer); + cost = Z_IVAL_P(option_buffer); } } @@ -358,10 +358,10 @@ PHP_FUNCTION(password_hash) size_t buffer_len; switch (Z_TYPE_P(option_buffer)) { case IS_STRING: - buffer = estrndup(Z_STRVAL_P(option_buffer), Z_STRLEN_P(option_buffer)); - buffer_len_int = Z_STRLEN_P(option_buffer); + buffer = estrndup(Z_STRVAL_P(option_buffer), Z_STRSIZE_P(option_buffer)); + buffer_len_int = Z_STRSIZE_P(option_buffer); break; - case IS_LONG: + case IS_INT: case IS_DOUBLE: case IS_OBJECT: { zval cast_option_buffer; @@ -369,8 +369,8 @@ PHP_FUNCTION(password_hash) ZVAL_DUP(&cast_option_buffer, option_buffer); convert_to_string(&cast_option_buffer); if (Z_TYPE(cast_option_buffer) == IS_STRING) { - buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRLEN(cast_option_buffer)); - buffer_len_int = Z_STRLEN(cast_option_buffer); + buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRSIZE(cast_option_buffer)); + buffer_len_int = Z_STRSIZE(cast_option_buffer); zval_dtor(&cast_option_buffer); break; } diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h index 71bcf0b223..2c8c966540 100644 --- a/ext/standard/php_smart_str.h +++ b/ext/standard/php_smart_str.h @@ -91,8 +91,8 @@ smart_str_appendl_ex((dest), (src), (len), 0) #define smart_str_append(dest, src) \ smart_str_append_ex((dest), (src), 0) -#define smart_str_append_long(dest, val) \ - smart_str_append_long_ex((dest), (val), 0) +#define smart_str_append_int(dest, val) \ + smart_str_append_int_ex((dest), (val), 0) #define smart_str_append_off_t(dest, val) \ smart_str_append_off_t_ex((dest), (val), 0) #define smart_str_append_unsigned(dest, val) \ @@ -152,7 +152,7 @@ static inline char *smart_str_print_unsigned(char *buf, long num) { #define smart_str_append_unsigned_ex(dest, num, type) \ smart_str_append_generic_ex((dest), (num), (type), unsigned long, _unsigned) -#define smart_str_append_long_ex(dest, num, type) \ +#define smart_str_append_int_ex(dest, num, type) \ smart_str_append_generic_ex((dest), (num), (type), unsigned long, _signed) #define smart_str_append_off_t_ex(dest, num, type) \ diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index dea8c16c07..84986c2e03 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -300,7 +300,7 @@ PHP_FUNCTION(proc_close) FG(pclose_wait) = 1; zend_list_close(Z_RES_P(zproc)); FG(pclose_wait) = 0; - RETURN_LONG(FG(pclose_ret)); + RETURN_INT(FG(pclose_ret)); } /* }}} */ @@ -328,7 +328,7 @@ PHP_FUNCTION(proc_get_status) array_init(return_value); add_assoc_string(return_value, "command", proc->command); - add_assoc_long(return_value, "pid", (long) proc->child); + add_assoc_int(return_value, "pid", (long) proc->child); #ifdef PHP_WIN32 @@ -368,9 +368,9 @@ PHP_FUNCTION(proc_get_status) add_assoc_bool(return_value, "running", running); add_assoc_bool(return_value, "signaled", signaled); add_assoc_bool(return_value, "stopped", stopped); - add_assoc_long(return_value, "exitcode", exitcode); - add_assoc_long(return_value, "termsig", termsig); - add_assoc_long(return_value, "stopsig", stopsig); + add_assoc_int(return_value, "exitcode", exitcode); + add_assoc_int(return_value, "termsig", termsig); + add_assoc_int(return_value, "stopsig", stopsig); } /* }}} */ @@ -471,14 +471,14 @@ PHP_FUNCTION(proc_open) if (other_options) { zval *item = zend_hash_str_find(Z_ARRVAL_P(other_options), "suppress_errors", sizeof("suppress_errors") - 1); if (item != NULL) { - if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) { + if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_INT) && Z_IVAL_P(item))) { suppress_errors = 1; } } item = zend_hash_str_find(Z_ARRVAL_P(other_options), "bypass_shell", sizeof("bypass_shell") - 1); if (item != NULL) { - if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) { + if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_INT) && Z_IVAL_P(item))) { bypass_shell = 1; } } @@ -584,7 +584,7 @@ PHP_FUNCTION(proc_open) #endif descriptors[ndesc].mode_flags = descriptors[ndesc].mode & DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY; #ifdef PHP_WIN32 - if (Z_STRLEN_P(zmode) >= 2 && Z_STRVAL_P(zmode)[1] == 'b') + if (Z_STRSIZE_P(zmode) >= 2 && Z_STRVAL_P(zmode)[1] == 'b') descriptors[ndesc].mode_flags |= O_BINARY; #endif diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 702fec2311..3029ed28bc 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -301,7 +301,7 @@ PHP_FUNCTION(rand) RAND_RANGE(number, min, max, PHP_RAND_MAX); } - RETURN_LONG(number); + RETURN_INT(number); } /* }}} */ @@ -340,7 +340,7 @@ PHP_FUNCTION(mt_rand) RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); } - RETURN_LONG(number); + RETURN_INT(number); } /* }}} */ @@ -352,7 +352,7 @@ PHP_FUNCTION(getrandmax) return; } - RETURN_LONG(PHP_RAND_MAX); + RETURN_INT(PHP_RAND_MAX); } /* }}} */ @@ -368,7 +368,7 @@ PHP_FUNCTION(mt_getrandmax) * Melo: it could be 2^^32 but we only use 2^^31 to maintain * compatibility with the previous php_rand */ - RETURN_LONG(PHP_MT_RAND_MAX); /* 2^^31 */ + RETURN_INT(PHP_MT_RAND_MAX); /* 2^^31 */ } /* }}} */ diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index f5f97161f2..bf7d461b8b 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -744,9 +744,9 @@ literal: } else if (numVars) { current = Z_REFVAL(args[objIndex++]); zval_ptr_dtor(current); - ZVAL_LONG(current, (long)(string - baseString) ); + ZVAL_INT(current, (long)(string - baseString) ); } else { - add_index_long(return_value, objIndex++, string - baseString); + add_index_int(return_value, objIndex++, string - baseString); } } nconversions++; @@ -1068,9 +1068,9 @@ addToInt: } else if (numVars) { current = Z_REFVAL(args[objIndex++]); zval_ptr_dtor(current); - ZVAL_LONG(current, value); + ZVAL_INT(current, value); } else { - add_index_long(return_value, objIndex++, value); + add_index_int(return_value, objIndex++, value); } } } @@ -1190,8 +1190,8 @@ done: scan_set_error_return( numVars, return_value ); result = SCAN_ERROR_EOF; } else if (numVars) { - convert_to_long(return_value ); - Z_LVAL_P(return_value) = nconversions; + convert_to_int(return_value ); + Z_IVAL_P(return_value) = nconversions; } else if (nconversions < totalVars) { /* TODO: not all elements converted. we need to prune the list - cc */ } @@ -1203,7 +1203,7 @@ done: static inline void scan_set_error_return(int numVars, zval *return_value) /* {{{ */ { if (numVars) { - ZVAL_LONG(return_value, SCAN_ERROR_EOF); /* EOF marker */ + ZVAL_INT(return_value, SCAN_ERROR_EOF); /* EOF marker */ } else { /* convert_to_null calls destructor */ convert_to_null(return_value); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 652512ce07..88c16469a1 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -123,7 +123,7 @@ PHP_FUNCTION(stream_socket_client) #endif if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, 0); + ZVAL_INT(zerrno, 0); } if (zerrstr) { zval_dtor(zerrstr); @@ -151,7 +151,7 @@ PHP_FUNCTION(stream_socket_client) if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, err); + ZVAL_INT(zerrno, err); } if (zerrstr && errstr) { zval_dtor(zerrstr); @@ -198,7 +198,7 @@ PHP_FUNCTION(stream_socket_server) if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, 0); + ZVAL_INT(zerrno, 0); } if (zerrstr) { zval_dtor(zerrstr); @@ -216,7 +216,7 @@ PHP_FUNCTION(stream_socket_server) if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, err); + ZVAL_INT(zerrno, err); } if (zerrstr && errstr) { zval_dtor(zerrstr); @@ -340,7 +340,7 @@ PHP_FUNCTION(stream_socket_sendto) } } - RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC)); + RETURN_INT(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC)); } /* }}} */ @@ -467,7 +467,7 @@ PHP_FUNCTION(stream_copy_to_stream) if (ret != SUCCESS) { RETURN_FALSE; } - RETURN_LONG(len); + RETURN_INT(len); } /* }}} */ @@ -511,7 +511,7 @@ PHP_FUNCTION(stream_get_meta_data) } #endif - add_assoc_long(return_value, "unread_bytes", stream->writepos - stream->readpos); + add_assoc_int(return_value, "unread_bytes", stream->writepos - stream->readpos); add_assoc_bool(return_value, "seekable", (stream->ops->seek) && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0); if (stream->orig_path) { @@ -763,9 +763,9 @@ PHP_FUNCTION(stream_select) /* If seconds is not set to null, build the timeval, else we wait indefinitely */ if (sec != NULL) { - convert_to_long_ex(sec); + convert_to_int_ex(sec); - if (Z_LVAL_P(sec) < 0) { + if (Z_IVAL_P(sec) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater than 0"); RETURN_FALSE; } else if (usec < 0) { @@ -775,10 +775,10 @@ PHP_FUNCTION(stream_select) /* Solaris + BSD do not like microsecond values which are >= 1 sec */ if (usec > 999999) { - tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000); + tv.tv_sec = Z_IVAL_P(sec) + (usec / 1000000); tv.tv_usec = usec % 1000000; } else { - tv.tv_sec = Z_LVAL_P(sec); + tv.tv_sec = Z_IVAL_P(sec); tv.tv_usec = usec; } @@ -798,7 +798,7 @@ PHP_FUNCTION(stream_select) if (e_array != NULL) { zend_hash_clean(Z_ARRVAL_P(e_array)); } - RETURN_LONG(retval); + RETURN_INT(retval); } } @@ -814,7 +814,7 @@ PHP_FUNCTION(stream_select) if (w_array != NULL) stream_array_from_fd_set(w_array, &wfds TSRMLS_CC); if (e_array != NULL) stream_array_from_fd_set(e_array, &efds TSRMLS_CC); - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -827,16 +827,16 @@ static void user_space_stream_notifier(php_stream_context *context, int notifyco zval zvs[6]; int i; - ZVAL_LONG(&zvs[0], notifycode); - ZVAL_LONG(&zvs[1], severity); + ZVAL_INT(&zvs[0], notifycode); + ZVAL_INT(&zvs[1], severity); if (xmsg) { ZVAL_STRING(&zvs[2], xmsg); } else { ZVAL_NULL(&zvs[2]); } - ZVAL_LONG(&zvs[3], xcode); - ZVAL_LONG(&zvs[4], bytes_sofar); - ZVAL_LONG(&zvs[5], bytes_max); + ZVAL_INT(&zvs[3], xcode); + ZVAL_INT(&zvs[4], bytes_sofar); + ZVAL_INT(&zvs[5], bytes_max); if (FAILURE == call_user_function_ex(EG(function_table), NULL, callback, &retval, 6, zvs, 0, NULL TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call user notifier"); @@ -1356,7 +1356,7 @@ PHP_FUNCTION(stream_set_write_buffer) ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); } - RETURN_LONG(ret == 0 ? 0 : EOF); + RETURN_INT(ret == 0 ? 0 : EOF); } /* }}} */ @@ -1390,7 +1390,7 @@ PHP_FUNCTION(stream_set_chunk_size) ret = php_stream_set_option(stream, PHP_STREAM_OPTION_SET_CHUNK_SIZE, (int)csize, NULL); - RETURN_LONG(ret > 0 ? (long)ret : (long)EOF); + RETURN_INT(ret > 0 ? (long)ret : (long)EOF); } /* }}} */ @@ -1419,7 +1419,7 @@ PHP_FUNCTION(stream_set_read_buffer) ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); } - RETURN_LONG(ret == 0 ? 0 : EOF); + RETURN_INT(ret == 0 ? 0 : EOF); } /* }}} */ @@ -1448,7 +1448,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) RETURN_FALSE; } - cryptokind = Z_LVAL_P(val); + cryptokind = Z_IVAL_P(val); } if (zsessstream) { @@ -1466,7 +1466,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) RETURN_FALSE; case 0: - RETURN_LONG(0); + RETURN_INT(0); default: RETURN_TRUE; diff --git a/ext/standard/string.c b/ext/standard/string.c index 82b98eb094..7a9bca8adc 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -81,13 +81,13 @@ */ void register_string_constants(INIT_FUNC_ARGS) { - REGISTER_LONG_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_LOCALECONV /* If last members of struct lconv equal CHAR_MAX, no grouping is done */ @@ -97,18 +97,18 @@ void register_string_constants(INIT_FUNC_ARGS) # define CHAR_MAX 127 # endif - REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT); #endif #ifdef HAVE_LOCALE_H - REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT); # ifdef LC_MESSAGES - REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT); # endif #endif @@ -318,16 +318,16 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) / } if(len == 0) { - RETURN_LONG(0); + RETURN_INT(0); } if (behavior == STR_STRSPN) { - RETURN_LONG(php_strspn(s11 + start /*str1_start*/, + RETURN_INT(php_strspn(s11 + start /*str1_start*/, s22 /*str2_start*/, s11 + start + len /*str1_end*/, s22 + len2 /*str2_end*/)); } else if (behavior == STR_STRCSPN) { - RETURN_LONG(php_strcspn(s11 + start /*str1_start*/, + RETURN_INT(php_strcspn(s11 + start /*str1_start*/, s22 /*str2_start*/, s11 + start + len /*str1_end*/, s22 + len2 /*str2_end*/)); @@ -356,7 +356,7 @@ PHP_FUNCTION(strcspn) #if HAVE_NL_LANGINFO PHP_MINIT_FUNCTION(nl_langinfo) { -#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) +#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_INT_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) #ifdef ABDAY_1 REGISTER_NL_LANGINFO_CONSTANT(ABDAY_1); REGISTER_NL_LANGINFO_CONSTANT(ABDAY_2); @@ -721,7 +721,7 @@ PHP_FUNCTION(strcoll) return; } - RETURN_LONG(strcoll((const char *) s1, + RETURN_INT(strcoll((const char *) s1, (const char *) s2)); } /* }}} */ @@ -1017,18 +1017,18 @@ PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit) { char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); + endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); p1 = Z_STRVAL_P(str); - p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); + p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); if (p2 == NULL) { - add_next_index_stringl(return_value, p1, Z_STRLEN_P(str)); + add_next_index_stringl(return_value, p1, Z_STRSIZE_P(str)); } else { do { add_next_index_stringl(return_value, p1, p2 - p1); - p1 = p2 + Z_STRLEN_P(delim); - } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL && + p1 = p2 + Z_STRSIZE_P(delim); + } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL && --limit > 1); if (p1 <= endp) @@ -1044,10 +1044,10 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu #define EXPLODE_ALLOC_STEP 64 char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); + endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); p1 = Z_STRVAL_P(str); - p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); + p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); if (p2 == NULL) { /* @@ -1065,14 +1065,14 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu allocated = found + EXPLODE_ALLOC_STEP;/* make sure we have enough memory */ positions = erealloc(positions, allocated*sizeof(char *)); } - positions[found++] = p1 = p2 + Z_STRLEN_P(delim); - } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL); + positions[found++] = p1 = p2 + Z_STRSIZE_P(delim); + } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL); to_return = limit + found; /* limit is at least -1 therefore no need of bounds checking : i will be always less than found */ for (i = 0;i < to_return;i++) { /* this checks also for to_return > 0 */ add_next_index_stringl(return_value, positions[i], - (positions[i+1] - Z_STRLEN_P(delim)) - positions[i]); + (positions[i+1] - Z_STRSIZE_P(delim)) - positions[i]); } efree(positions); } @@ -1150,11 +1150,11 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) again: switch (Z_TYPE_P(tmp)) { case IS_STRING: - smart_str_appendl(&implstr, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&implstr, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); break; - case IS_LONG: - smart_str_append_long(&implstr, Z_LVAL_P(tmp)); + case IS_INT: + smart_str_append_int(&implstr, Z_IVAL_P(tmp)); break; case IS_TRUE: @@ -1186,7 +1186,7 @@ again: } if (++i != numelems) { - smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim)); + smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRSIZE_P(delim)); } } ZEND_HASH_FOREACH_END(); @@ -1661,8 +1661,8 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) static int php_needle_char(zval *needle, char *target TSRMLS_DC) { switch (Z_TYPE_P(needle)) { - case IS_LONG: - *target = (char)Z_LVAL_P(needle); + case IS_INT: + *target = (char)Z_IVAL_P(needle); return SUCCESS; case IS_NULL: case IS_FALSE: @@ -1678,11 +1678,11 @@ static int php_needle_char(zval *needle, char *target TSRMLS_DC) { zval holder = *needle; zval_copy_ctor(&(holder)); - convert_to_long(&(holder)); - if(Z_TYPE(holder) != IS_LONG) { + convert_to_int(&(holder)); + if(Z_TYPE(holder) != IS_INT) { return FAILURE; } - *target = (char)Z_LVAL(holder); + *target = (char)Z_IVAL(holder); return SUCCESS; } default: { @@ -1714,13 +1714,13 @@ PHP_FUNCTION(stristr) if (Z_TYPE_P(needle) == IS_STRING) { char *orig_needle; - if (!Z_STRLEN_P(needle)) { + if (!Z_STRSIZE_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); efree(haystack_dup); RETURN_FALSE; } - orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - found = php_stristr(haystack_dup, orig_needle, haystack_len, Z_STRLEN_P(needle)); + orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); + found = php_stristr(haystack_dup, orig_needle, haystack_len, Z_STRSIZE_P(needle)); efree(orig_needle); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { @@ -1764,12 +1764,12 @@ PHP_FUNCTION(strstr) } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { + if (!Z_STRSIZE_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } - found = (char*)php_memnstr(haystack, Z_STRVAL_P(needle), Z_STRLEN_P(needle), haystack + haystack_len); + found = (char*)php_memnstr(haystack, Z_STRVAL_P(needle), Z_STRSIZE_P(needle), haystack + haystack_len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -1825,14 +1825,14 @@ PHP_FUNCTION(strpos) } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { + if (!Z_STRSIZE_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } found = (char*)php_memnstr(haystack + offset, Z_STRVAL_P(needle), - Z_STRLEN_P(needle), + Z_STRSIZE_P(needle), haystack + haystack_len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { @@ -1847,7 +1847,7 @@ PHP_FUNCTION(strpos) } if (found) { - RETURN_LONG(found - haystack); + RETURN_INT(found - haystack); } else { RETURN_FALSE; } @@ -1883,14 +1883,14 @@ PHP_FUNCTION(stripos) php_strtolower(haystack_dup, haystack_len); if (Z_TYPE_P(needle) == IS_STRING) { - if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > haystack_len) { + if (Z_STRSIZE_P(needle) == 0 || Z_STRSIZE_P(needle) > haystack_len) { efree(haystack_dup); RETURN_FALSE; } - needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - php_strtolower(needle_dup, Z_STRLEN_P(needle)); - found = (char*)php_memnstr(haystack_dup + offset, needle_dup, Z_STRLEN_P(needle), haystack_dup + haystack_len); + needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); + php_strtolower(needle_dup, Z_STRSIZE_P(needle)); + found = (char*)php_memnstr(haystack_dup + offset, needle_dup, Z_STRSIZE_P(needle), haystack_dup + haystack_len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { efree(haystack_dup); @@ -1910,7 +1910,7 @@ PHP_FUNCTION(stripos) } if (found) { - RETURN_LONG(found - haystack_dup); + RETURN_INT(found - haystack_dup); } else { RETURN_FALSE; } @@ -1942,7 +1942,7 @@ PHP_FUNCTION(strrpos) if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); + needle_len = Z_STRSIZE_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -1981,7 +1981,7 @@ PHP_FUNCTION(strrpos) /* Single character search can shortcut memcmps */ while (e >= p) { if (*e == *needle) { - RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + RETURN_INT(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -1990,7 +1990,7 @@ PHP_FUNCTION(strrpos) while (e >= p) { if (memcmp(e, needle, needle_len) == 0) { - RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + RETURN_INT(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -2016,7 +2016,7 @@ PHP_FUNCTION(strripos) if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); + needle_len = Z_STRSIZE_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -2052,7 +2052,7 @@ PHP_FUNCTION(strripos) *ord_needle = tolower(*needle); while (e >= p) { if (tolower(*e) == *ord_needle) { - RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + RETURN_INT(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -2092,7 +2092,7 @@ PHP_FUNCTION(strripos) if (memcmp(e, needle_dup, needle_len) == 0) { efree(haystack_dup); efree(needle_dup); - RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + RETURN_INT(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -2331,7 +2331,7 @@ PHP_FUNCTION(substr_replace) convert_to_string_ex(repl); } if (Z_TYPE_P(from) != IS_ARRAY) { - convert_to_long_ex(from); + convert_to_int_ex(from); } if (argc > 3) { @@ -2340,7 +2340,7 @@ PHP_FUNCTION(substr_replace) } } else { if (Z_TYPE_P(str) != IS_ARRAY) { - l = Z_STRLEN_P(str); + l = Z_STRSIZE_P(str); } } @@ -2364,55 +2364,55 @@ PHP_FUNCTION(substr_replace) if (Z_TYPE_P(from) != IS_ARRAY) { int repl_len = 0; - f = Z_LVAL_P(from); + f = Z_IVAL_P(from); /* if "from" position is negative, count start position from the end * of the string */ if (f < 0) { - f = Z_STRLEN_P(str) + f; + f = Z_STRSIZE_P(str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRLEN_P(str)) { - f = Z_STRLEN_P(str); + } else if (f > Z_STRSIZE_P(str)) { + f = Z_STRSIZE_P(str); } /* if "length" position is negative, set it to the length * needed to stop that many chars from the end of the string */ if (l < 0) { - l = (Z_STRLEN_P(str) - f) + l; + l = (Z_STRSIZE_P(str) - f) + l; if (l < 0) { l = 0; } } - if (f > Z_STRLEN_P(str) || (f < 0 && -f > Z_STRLEN_P(str))) { + if (f > Z_STRSIZE_P(str) || (f < 0 && -f > Z_STRSIZE_P(str))) { RETURN_FALSE; - } else if (l > Z_STRLEN_P(str) || (l < 0 && -l > Z_STRLEN_P(str))) { - l = Z_STRLEN_P(str); + } else if (l > Z_STRSIZE_P(str) || (l < 0 && -l > Z_STRSIZE_P(str))) { + l = Z_STRSIZE_P(str); } - if ((f + l) > Z_STRLEN_P(str)) { - l = Z_STRLEN_P(str) - f; + if ((f + l) > Z_STRSIZE_P(str)) { + l = Z_STRSIZE_P(str) - f; } if (Z_TYPE_P(repl) == IS_ARRAY) { zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(repl), &pos_repl); if (NULL != (tmp_repl = zend_hash_get_current_data_ex(Z_ARRVAL_P(repl), &pos_repl))) { convert_to_string_ex(tmp_repl); - repl_len = Z_STRLEN_P(tmp_repl); + repl_len = Z_STRSIZE_P(tmp_repl); } } else { - repl_len = Z_STRLEN_P(repl); + repl_len = Z_STRSIZE_P(repl); } - result = STR_ALLOC(Z_STRLEN_P(str) - l + repl_len, 0); + result = STR_ALLOC(Z_STRSIZE_P(str) - l + repl_len, 0); memcpy(result->val, Z_STRVAL_P(str), f); if (repl_len) { memcpy((result->val + f), (Z_TYPE_P(repl) == IS_ARRAY ? Z_STRVAL_P(tmp_repl) : Z_STRVAL_P(repl)), repl_len); } - memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRLEN_P(str) - f - l); + memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRSIZE_P(str) - f - l); result->val[result->len] = '\0'; RETURN_NEW_STR(result); } else { @@ -2464,26 +2464,26 @@ PHP_FUNCTION(substr_replace) f = zval_get_long(tmp_from); if (f < 0) { - f = Z_STRLEN_P(orig_str) + f; + f = Z_STRSIZE_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRLEN_P(orig_str)) { - f = Z_STRLEN_P(orig_str); + } else if (f > Z_STRSIZE_P(orig_str)) { + f = Z_STRSIZE_P(orig_str); } zend_hash_move_forward_ex(Z_ARRVAL_P(from), &pos_from); } else { f = 0; } } else { - f = Z_LVAL_P(from); + f = Z_IVAL_P(from); if (f < 0) { - f = Z_STRLEN_P(orig_str) + f; + f = Z_STRSIZE_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRLEN_P(orig_str)) { - f = Z_STRLEN_P(orig_str); + } else if (f > Z_STRSIZE_P(orig_str)) { + f = Z_STRSIZE_P(orig_str); } } @@ -2492,26 +2492,26 @@ PHP_FUNCTION(substr_replace) l = zval_get_long(tmp_len); zend_hash_move_forward_ex(Z_ARRVAL_P(len), &pos_len); } else { - l = Z_STRLEN_P(orig_str); + l = Z_STRSIZE_P(orig_str); } } else if (argc > 3) { - l = Z_LVAL_P(len); + l = Z_IVAL_P(len); } else { - l = Z_STRLEN_P(orig_str); + l = Z_STRSIZE_P(orig_str); } if (l < 0) { - l = (Z_STRLEN_P(orig_str) - f) + l; + l = (Z_STRSIZE_P(orig_str) - f) + l; if (l < 0) { l = 0; } } - if ((f + l) > Z_STRLEN_P(orig_str)) { - l = Z_STRLEN_P(orig_str) - f; + if ((f + l) > Z_STRSIZE_P(orig_str)) { + l = Z_STRSIZE_P(orig_str) - f; } - result_len = Z_STRLEN_P(orig_str) - l; + result_len = Z_STRSIZE_P(orig_str) - l; if (Z_TYPE_P(repl) == IS_ARRAY) { if (NULL != (tmp_repl = zend_hash_get_current_data_ex(Z_ARRVAL_P(repl), &pos_repl))) { @@ -2536,13 +2536,13 @@ PHP_FUNCTION(substr_replace) } */ - result_len += Z_STRLEN_P(repl_str); + result_len += Z_STRSIZE_P(repl_str); zend_hash_move_forward_ex(Z_ARRVAL_P(repl), &pos_repl); result = STR_ALLOC(result_len, 0); memcpy(result->val, Z_STRVAL_P(orig_str), f); - memcpy((result->val + f), Z_STRVAL_P(repl_str), Z_STRLEN_P(repl_str)); - memcpy((result->val + f + Z_STRLEN_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + memcpy((result->val + f), Z_STRVAL_P(repl_str), Z_STRSIZE_P(repl_str)); + memcpy((result->val + f + Z_STRSIZE_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); if(Z_TYPE_P(tmp_repl) != IS_STRING) { zval_dtor(repl_str); } @@ -2550,16 +2550,16 @@ PHP_FUNCTION(substr_replace) result = STR_ALLOC(result_len, 0); memcpy(result->val, Z_STRVAL_P(orig_str), f); - memcpy((result->val + f), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + memcpy((result->val + f), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); } } else { - result_len += Z_STRLEN_P(repl); + result_len += Z_STRSIZE_P(repl); result = STR_ALLOC(result_len, 0); memcpy(result->val, Z_STRVAL_P(orig_str), f); - memcpy((result->val + f), Z_STRVAL_P(repl), Z_STRLEN_P(repl)); - memcpy((result->val + f + Z_STRLEN_P(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + memcpy((result->val + f), Z_STRVAL_P(repl), Z_STRSIZE_P(repl)); + memcpy((result->val + f + Z_STRSIZE_P(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); } result->val[result->len] = '\0'; @@ -2650,7 +2650,7 @@ PHP_FUNCTION(ord) ZEND_PARSE_PARAMETERS_END(); #endif - RETURN_LONG((unsigned char) str[0]); + RETURN_INT((unsigned char) str[0]); } /* }}} */ @@ -2773,7 +2773,7 @@ PHP_FUNCTION(ucwords) r = Z_STRVAL_P(return_value); *r = toupper((unsigned char) *r); - for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) { + for (r_end = r + Z_STRSIZE_P(return_value) - 1; r < r_end; ) { if (mask[(unsigned char)*r++]) { *r = toupper((unsigned char) *r); } @@ -2861,7 +2861,7 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable * zend_hash_init(&str_hash, zend_hash_num_elements(pats), NULL, NULL, 0); ZEND_HASH_FOREACH_KEY_VAL(pats, num_key, str_key, entry) { if (UNEXPECTED(!str_key)) { - ZVAL_LONG(&tmp, num_key); + ZVAL_INT(&tmp, num_key); convert_to_string(&tmp); str_key = Z_STR(tmp); len = str_key->len; @@ -3005,10 +3005,10 @@ PHP_FUNCTION(strtr) ZVAL_STRINGL(return_value, str, str_len); php_strtr(Z_STRVAL_P(return_value), - Z_STRLEN_P(return_value), + Z_STRSIZE_P(return_value), Z_STRVAL_P(from), to, - MIN(Z_STRLEN_P(from), + MIN(Z_STRSIZE_P(from), to_len)); } } @@ -3111,7 +3111,7 @@ PHP_FUNCTION(similar_text) Z_DVAL_P(percent) = 0; } - RETURN_LONG(0); + RETURN_INT(0); } sim = php_similar_char(t1, t1_len, t2, t2_len); @@ -3120,7 +3120,7 @@ PHP_FUNCTION(similar_text) Z_DVAL_P(percent) = sim * 200.0 / (t1_len + t2_len); } - RETURN_LONG(sim); + RETURN_INT(sim); } /* }}} */ @@ -3227,7 +3227,7 @@ PHP_FUNCTION(stripcslashes) } ZVAL_STRINGL(return_value, str, str_len); - php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value)); + php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value)); } /* }}} */ @@ -3243,7 +3243,7 @@ PHP_FUNCTION(stripslashes) } ZVAL_STRINGL(return_value, str, str_len); - php_stripslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC); + php_stripslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value) TSRMLS_CC); } /* }}} */ @@ -3708,7 +3708,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec convert_to_string_ex(&tmp_subject); subject = &tmp_subject; } - if (Z_STRLEN_P(subject) == 0) { + if (Z_STRSIZE_P(subject) == 0) { zval_ptr_dtor(&tmp_subject); ZVAL_EMPTY_STRING(result); return; @@ -3725,7 +3725,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec } else { /* Set replacement value to the passed one */ replace_value = Z_STRVAL_P(replace); - replace_len = Z_STRLEN_P(replace); + replace_len = Z_STRSIZE_P(replace); } /* For each entry in the search array, get the entry */ @@ -3733,7 +3733,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec /* Make sure we're dealing with strings. */ SEPARATE_ZVAL(search_entry); convert_to_string(search_entry); - if (Z_STRLEN_P(search_entry) == 0) { + if (Z_STRSIZE_P(search_entry) == 0) { if (Z_TYPE_P(replace) == IS_ARRAY) { zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos); } @@ -3749,7 +3749,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec /* Set replacement value to the one we got from array */ replace_value = Z_STRVAL_P(replace_entry); - replace_len = Z_STRLEN_P(replace_entry); + replace_len = Z_STRSIZE_P(replace_entry); zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos); } else { @@ -3759,18 +3759,18 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec } } - if (Z_STRLEN_P(search_entry) == 1) { + if (Z_STRSIZE_P(search_entry) == 1) { php_char_to_str_ex(Z_STRVAL_P(result), - Z_STRLEN_P(result), + Z_STRSIZE_P(result), Z_STRVAL_P(search_entry)[0], replace_value, replace_len, &temp_result, case_sensitivity, replace_count); - } else if (Z_STRLEN_P(search_entry) > 1) { - ZVAL_STR(&temp_result, php_str_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result), - Z_STRVAL_P(search_entry), Z_STRLEN_P(search_entry), + } else if (Z_STRSIZE_P(search_entry) > 1) { + ZVAL_STR(&temp_result, php_str_to_str_ex(Z_STRVAL_P(result), Z_STRSIZE_P(result), + Z_STRVAL_P(search_entry), Z_STRSIZE_P(search_entry), replace_value, replace_len, case_sensitivity, replace_count)); } @@ -3778,25 +3778,25 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec Z_STR_P(result) = Z_STR(temp_result); Z_TYPE_INFO_P(result) = Z_TYPE_INFO(temp_result); - if (Z_STRLEN_P(result) == 0) { + if (Z_STRSIZE_P(result) == 0) { zval_ptr_dtor(&tmp_subject); return; } } ZEND_HASH_FOREACH_END(); } else { - if (Z_STRLEN_P(search) == 1) { + if (Z_STRSIZE_P(search) == 1) { php_char_to_str_ex(Z_STRVAL_P(subject), - Z_STRLEN_P(subject), + Z_STRSIZE_P(subject), Z_STRVAL_P(search)[0], Z_STRVAL_P(replace), - Z_STRLEN_P(replace), + Z_STRSIZE_P(replace), result, case_sensitivity, replace_count); - } else if (Z_STRLEN_P(search) > 1) { - ZVAL_STR(result, php_str_to_str_ex(Z_STRVAL_P(subject), Z_STRLEN_P(subject), - Z_STRVAL_P(search), Z_STRLEN_P(search), - Z_STRVAL_P(replace), Z_STRLEN_P(replace), case_sensitivity, replace_count)); + } else if (Z_STRSIZE_P(search) > 1) { + ZVAL_STR(result, php_str_to_str_ex(Z_STRVAL_P(subject), Z_STRSIZE_P(subject), + Z_STRVAL_P(search), Z_STRSIZE_P(search), + Z_STRVAL_P(replace), Z_STRSIZE_P(replace), case_sensitivity, replace_count)); } else { ZVAL_DUP(result, subject); } @@ -3867,7 +3867,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit } if (argc > 3) { zval_dtor(zcount); - ZVAL_LONG(zcount, count); + ZVAL_INT(zcount, count); } } /* }}} */ @@ -4176,11 +4176,11 @@ PHP_FUNCTION(strip_tags) convert_to_string_ex(allow); // TODO: reimplement to avoid reallocation ??? if (IS_INTERNED(Z_STR_P(allow))) { - allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRLEN_P(allow)); - allowed_tags_len = Z_STRLEN_P(allow); + allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRSIZE_P(allow)); + allowed_tags_len = Z_STRSIZE_P(allow); } else { allowed_tags = Z_STRVAL_P(allow); - allowed_tags_len = Z_STRLEN_P(allow); + allowed_tags_len = Z_STRSIZE_P(allow); } } @@ -4210,8 +4210,8 @@ PHP_FUNCTION(setlocale) } #ifdef HAVE_SETLOCALE - if (Z_TYPE_P(pcategory) == IS_LONG) { - cat = Z_LVAL_P(pcategory); + if (Z_TYPE_P(pcategory) == IS_INT) { + cat = Z_IVAL_P(pcategory); } else { /* FIXME: The following behaviour should be removed. */ char *category; @@ -4272,7 +4272,7 @@ PHP_FUNCTION(setlocale) loc = NULL; } else { loc = Z_STRVAL(tmp); - if (Z_STRLEN(tmp) >= 255) { + if (Z_STRSIZE(tmp) >= 255) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Specified locale name is too long"); zval_dtor(&tmp); break; @@ -4817,16 +4817,16 @@ PHP_FUNCTION(count_chars) for (inx = 0; inx < 256; inx++) { switch (mymode) { case 0: - add_index_long(return_value, inx, chars[inx]); + add_index_int(return_value, inx, chars[inx]); break; case 1: if (chars[inx] != 0) { - add_index_long(return_value, inx, chars[inx]); + add_index_int(return_value, inx, chars[inx]); } break; case 2: if (chars[inx] == 0) { - add_index_long(return_value, inx, chars[inx]); + add_index_int(return_value, inx, chars[inx]); } break; case 3: @@ -4859,7 +4859,7 @@ static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case) return; } - RETURN_LONG(strnatcmp_ex(s1, s1_len, + RETURN_INT(strnatcmp_ex(s1, s1_len, s2, s2_len, fold_case)); } @@ -4870,7 +4870,7 @@ PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2 zend_string *str1 = zval_get_string(op1); zend_string *str2 = zval_get_string(op2); - ZVAL_LONG(result, strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, case_insensitive)); + ZVAL_INT(result, strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, case_insensitive)); STR_RELEASE(str1); STR_RELEASE(str2); @@ -4924,14 +4924,14 @@ PHP_FUNCTION(localeconv) len = strlen(currlocdata.grouping); for (i = 0; i < len; i++) { - add_index_long(&grouping, i, currlocdata.grouping[i]); + add_index_int(&grouping, i, currlocdata.grouping[i]); } /* Grab the monetary grouping data out of the array */ len = strlen(currlocdata.mon_grouping); for (i = 0; i < len; i++) { - add_index_long(&mon_grouping, i, currlocdata.mon_grouping[i]); + add_index_int(&mon_grouping, i, currlocdata.mon_grouping[i]); } add_assoc_string(return_value, "decimal_point", currlocdata.decimal_point); @@ -4942,21 +4942,21 @@ PHP_FUNCTION(localeconv) add_assoc_string(return_value, "mon_thousands_sep", currlocdata.mon_thousands_sep); add_assoc_string(return_value, "positive_sign", currlocdata.positive_sign); add_assoc_string(return_value, "negative_sign", currlocdata.negative_sign); - add_assoc_long( return_value, "int_frac_digits", currlocdata.int_frac_digits); - add_assoc_long( return_value, "frac_digits", currlocdata.frac_digits); - add_assoc_long( return_value, "p_cs_precedes", currlocdata.p_cs_precedes); - add_assoc_long( return_value, "p_sep_by_space", currlocdata.p_sep_by_space); - add_assoc_long( return_value, "n_cs_precedes", currlocdata.n_cs_precedes); - add_assoc_long( return_value, "n_sep_by_space", currlocdata.n_sep_by_space); - add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn); - add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn); + add_assoc_int( return_value, "int_frac_digits", currlocdata.int_frac_digits); + add_assoc_int( return_value, "frac_digits", currlocdata.frac_digits); + add_assoc_int( return_value, "p_cs_precedes", currlocdata.p_cs_precedes); + add_assoc_int( return_value, "p_sep_by_space", currlocdata.p_sep_by_space); + add_assoc_int( return_value, "n_cs_precedes", currlocdata.n_cs_precedes); + add_assoc_int( return_value, "n_sep_by_space", currlocdata.n_sep_by_space); + add_assoc_int( return_value, "p_sign_posn", currlocdata.p_sign_posn); + add_assoc_int( return_value, "n_sign_posn", currlocdata.n_sign_posn); } #else /* Ok, it doesn't look like we have locale info floating around, so I guess it wouldn't hurt to just go ahead and return the POSIX locale information? */ - add_index_long(&grouping, 0, -1); - add_index_long(&mon_grouping, 0, -1); + add_index_int(&grouping, 0, -1); + add_index_int(&mon_grouping, 0, -1); add_assoc_string(return_value, "decimal_point", "\x2E"); add_assoc_string(return_value, "thousands_sep", ""); @@ -4966,14 +4966,14 @@ PHP_FUNCTION(localeconv) add_assoc_string(return_value, "mon_thousands_sep", ""); add_assoc_string(return_value, "positive_sign", ""); add_assoc_string(return_value, "negative_sign", ""); - add_assoc_long( return_value, "int_frac_digits", CHAR_MAX); - add_assoc_long( return_value, "frac_digits", CHAR_MAX); - add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX); - add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX); - add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX); - add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX); - add_assoc_long( return_value, "p_sign_posn", CHAR_MAX); - add_assoc_long( return_value, "n_sign_posn", CHAR_MAX); + add_assoc_int( return_value, "int_frac_digits", CHAR_MAX); + add_assoc_int( return_value, "frac_digits", CHAR_MAX); + add_assoc_int( return_value, "p_cs_precedes", CHAR_MAX); + add_assoc_int( return_value, "p_sep_by_space", CHAR_MAX); + add_assoc_int( return_value, "n_cs_precedes", CHAR_MAX); + add_assoc_int( return_value, "n_sep_by_space", CHAR_MAX); + add_assoc_int( return_value, "p_sign_posn", CHAR_MAX); + add_assoc_int( return_value, "n_sign_posn", CHAR_MAX); #endif zend_hash_str_update(Z_ARRVAL_P(return_value), "grouping", sizeof("grouping")-1, &grouping); @@ -5050,7 +5050,7 @@ PHP_FUNCTION(substr_count) } } - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ @@ -5174,7 +5174,7 @@ PHP_FUNCTION(str_rot13) RETVAL_STRINGL(arg, arglen); - php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), rot13_from, rot13_to, 52); + php_strtr(Z_STRVAL_P(return_value), Z_STRSIZE_P(return_value), rot13_from, rot13_to, 52); } /* }}} */ @@ -5216,8 +5216,8 @@ PHP_FUNCTION(str_shuffle) } RETVAL_STRINGL(arg, arglen); - if (Z_STRLEN_P(return_value) > 1) { - php_string_shuffle(Z_STRVAL_P(return_value), (long) Z_STRLEN_P(return_value) TSRMLS_CC); + if (Z_STRSIZE_P(return_value) > 1) { + php_string_shuffle(Z_STRVAL_P(return_value), (long) Z_STRSIZE_P(return_value) TSRMLS_CC); } } /* }}} */ @@ -5253,7 +5253,7 @@ PHP_FUNCTION(str_word_count) break; case 0: if (!str_len) { - RETURN_LONG(0); + RETURN_INT(0); } /* nothing to be done */ break; @@ -5301,7 +5301,7 @@ PHP_FUNCTION(str_word_count) } if (!type) { - RETURN_LONG(word_count); + RETURN_INT(word_count); } } @@ -5433,7 +5433,7 @@ PHP_FUNCTION(substr_compare) if (ZEND_NUM_ARGS() >= 4 && len <= 0) { if (len == 0) { - RETURN_LONG(0L); + RETURN_INT(0L); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than or equal to zero"); RETURN_FALSE; @@ -5453,9 +5453,9 @@ PHP_FUNCTION(substr_compare) cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset))); if (!cs) { - RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); + RETURN_INT(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); } else { - RETURN_LONG(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); + RETURN_INT(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); } } /* }}} */ diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index acbffe49ad..05c443988e 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -41,59 +41,59 @@ PHP_MINIT_FUNCTION(syslog) { /* error levels */ - REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */ - REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */ - REGISTER_LONG_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */ - REGISTER_LONG_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */ + REGISTER_INT_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */ + REGISTER_INT_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */ + REGISTER_INT_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT); /* facility: type of program logging the message */ - REGISTER_LONG_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */ - REGISTER_LONG_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */ - REGISTER_LONG_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */ - REGISTER_LONG_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */ + REGISTER_INT_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */ + REGISTER_INT_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */ + REGISTER_INT_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT); #ifdef LOG_NEWS /* No LOG_NEWS on HP-UX */ - REGISTER_LONG_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */ + REGISTER_INT_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */ #endif #ifdef LOG_UUCP /* No LOG_UUCP on HP-UX */ - REGISTER_LONG_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT); #endif #ifdef LOG_CRON /* apparently some systems don't have this one */ - REGISTER_LONG_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT); #endif #ifdef LOG_AUTHPRIV /* AIX doesn't have LOG_AUTHPRIV */ - REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT); #endif #ifndef PHP_WIN32 - REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT); #endif /* options */ - REGISTER_LONG_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT); #ifdef LOG_NOWAIT - REGISTER_LONG_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT); #endif #ifdef LOG_PERROR /* AIX doesn't have LOG_PERROR */ - REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/ + REGISTER_INT_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/ #endif BG(syslog_device)=NULL; diff --git a/ext/standard/type.c b/ext/standard/type.c index 2a2988dee5..1aac60dfc2 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -41,7 +41,7 @@ PHP_FUNCTION(gettype) RETVAL_STRING("boolean"); break; - case IS_LONG: + case IS_INT: RETVAL_STRING("integer"); break; @@ -103,9 +103,9 @@ PHP_FUNCTION(settype) ZVAL_DEREF(var); SEPARATE_ZVAL_NOREF(var); if (!strcasecmp(type, "integer")) { - convert_to_long(var); + convert_to_int(var); } else if (!strcasecmp(type, "int")) { - convert_to_long(var); + convert_to_int(var); } else if (!strcasecmp(type, "float")) { convert_to_double(var); } else if (!strcasecmp(type, "double")) { /* deprecated */ @@ -156,7 +156,7 @@ PHP_FUNCTION(intval) #endif RETVAL_ZVAL(num, 1, 0); - convert_to_long_base(return_value, base); + convert_to_int_base(return_value, base); } /* }}} */ @@ -277,7 +277,7 @@ PHP_FUNCTION(is_bool) Returns true if variable is a long (integer) */ PHP_FUNCTION(is_long) { - php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG); + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_INT); } /* }}} */ @@ -324,13 +324,13 @@ PHP_FUNCTION(is_numeric) } switch (Z_TYPE_P(arg)) { - case IS_LONG: + case IS_INT: case IS_DOUBLE: RETURN_TRUE; break; case IS_STRING: - if (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 0)) { + if (is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), NULL, NULL, 0)) { RETURN_TRUE; } else { RETURN_FALSE; @@ -364,7 +364,7 @@ PHP_FUNCTION(is_scalar) case IS_FALSE: case IS_TRUE: case IS_DOUBLE: - case IS_LONG: + case IS_INT: case IS_STRING: RETURN_TRUE; break; diff --git a/ext/standard/url.c b/ext/standard/url.c index 7e848fecfe..714d334cfe 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -398,7 +398,7 @@ PHP_FUNCTION(parse_url) if (resource->host != NULL) RETVAL_STRING(resource->host); break; case PHP_URL_PORT: - if (resource->port != 0) RETVAL_LONG(resource->port); + if (resource->port != 0) RETVAL_INT(resource->port); break; case PHP_URL_USER: if (resource->user != NULL) RETVAL_STRING(resource->user); @@ -431,7 +431,7 @@ PHP_FUNCTION(parse_url) if (resource->host != NULL) add_assoc_string(return_value, "host", resource->host); if (resource->port != 0) - add_assoc_long(return_value, "port", resource->port); + add_assoc_int(return_value, "port", resource->port); if (resource->user != NULL) add_assoc_string(return_value, "user", resource->user); if (resource->pass != NULL) @@ -769,10 +769,10 @@ no_name_header: } if ((prev_val = zend_hash_str_find(HASH_OF(return_value), Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr)))) == NULL) { - add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr)))); + add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRSIZE_P(hdr) - (s - Z_STRVAL_P(hdr)))); } else { /* some headers may occur more then once, therefor we need to remake the string into an array */ convert_to_array(prev_val); - add_next_index_stringl(prev_val, s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr)))); + add_next_index_stringl(prev_val, s, (Z_STRSIZE_P(hdr) - (s - Z_STRVAL_P(hdr)))); } *p = c; diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 7dce126ac3..f9c94186f1 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -113,13 +113,13 @@ PHP_MINIT_FUNCTION(user_filters) return FAILURE; } - REGISTER_LONG_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -203,7 +203,7 @@ php_stream_filter_status_t userfilter_filter( ZEND_REGISTER_RESOURCE(&args[1], buckets_out, le_bucket_brigade); if (bytes_consumed) { - ZVAL_LONG(&args[2], *bytes_consumed); + ZVAL_INT(&args[2], *bytes_consumed); } else { ZVAL_NULL(&args[2]); } @@ -220,14 +220,14 @@ php_stream_filter_status_t userfilter_filter( zval_ptr_dtor(&func_name); if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - convert_to_long(&retval); - ret = Z_LVAL(retval); + convert_to_int(&retval); + ret = Z_IVAL(retval); } else if (call_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call filter function"); } if (bytes_consumed) { - *bytes_consumed = Z_LVAL_P(&args[2]); + *bytes_consumed = Z_IVAL_P(&args[2]); } if (buckets_in->head) { @@ -424,7 +424,7 @@ PHP_FUNCTION(stream_bucket_make_writeable) /* add_property_zval increments the refcount which is unwanted here */ zval_ptr_dtor(&zbucket); add_property_stringl(return_value, "data", bucket->buf, bucket->buflen); - add_property_long(return_value, "datalen", bucket->buflen); + add_property_int(return_value, "datalen", bucket->buflen); } } /* }}} */ @@ -453,9 +453,9 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) if (!bucket->own_buf) { bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC); } - if ((int)bucket->buflen != Z_STRLEN_P(pzdata)) { - bucket->buf = perealloc(bucket->buf, Z_STRLEN_P(pzdata), bucket->is_persistent); - bucket->buflen = Z_STRLEN_P(pzdata); + if ((int)bucket->buflen != Z_STRSIZE_P(pzdata)) { + bucket->buf = perealloc(bucket->buf, Z_STRSIZE_P(pzdata), bucket->is_persistent); + bucket->buflen = Z_STRSIZE_P(pzdata); } memcpy(bucket->buf, Z_STRVAL_P(pzdata), bucket->buflen); } @@ -525,7 +525,7 @@ PHP_FUNCTION(stream_bucket_new) /* add_property_zval increments the refcount which is unwanted here */ zval_ptr_dtor(&zbucket); add_property_stringl(return_value, "data", bucket->buf, bucket->buflen); - add_property_long(return_value, "datalen", bucket->buflen); + add_property_int(return_value, "datalen", bucket->buflen); } /* }}} */ diff --git a/ext/standard/var.c b/ext/standard/var.c index 96b1ee40ec..1f86b1331b 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -119,15 +119,15 @@ again: case IS_NULL: php_printf("%sNULL\n", COMMON); break; - case IS_LONG: - php_printf("%sint(%ld)\n", COMMON, Z_LVAL_P(struc)); + case IS_INT: + php_printf("%sint(%ld)\n", COMMON, Z_IVAL_P(struc)); break; case IS_DOUBLE: php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc)); - PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_P(struc)); + PHPWRITE(Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); PUTS("\"\n"); break; case IS_ARRAY: @@ -290,15 +290,15 @@ again: case IS_NULL: php_printf("%sNULL\n", COMMON); break; - case IS_LONG: - php_printf("%slong(%ld)\n", COMMON, Z_LVAL_P(struc)); + case IS_INT: + php_printf("%slong(%ld)\n", COMMON, Z_IVAL_P(struc)); break; case IS_DOUBLE: php_printf("%sdouble(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc)); - PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_P(struc)); + PHPWRITE(Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); php_printf("\" refcount(%u)\n", IS_INTERNED(Z_STR_P(struc)) ? 1 : Z_REFCOUNT_P(struc)); break; case IS_ARRAY: @@ -402,7 +402,7 @@ static void php_array_element_export(zval *zv, ulong index, zend_string *key, in { if (key == NULL) { /* numeric key */ buffer_append_spaces(buf, level+1); - smart_str_append_long(buf, (long) index); + smart_str_append_int(buf, (long) index); smart_str_appendl(buf, " => ", 4); } else { /* string key */ @@ -443,7 +443,7 @@ static void php_object_element_export(zval *zv, ulong index, zend_string *key, i smart_str_appendc(buf, '\''); STR_RELEASE(pname_esc); } else { - smart_str_append_long(buf, (long) index); + smart_str_append_int(buf, (long) index); } smart_str_appendl(buf, " => ", 4); php_var_export_ex(zv, level + 2, buf TSRMLS_CC); @@ -474,8 +474,8 @@ again: case IS_NULL: smart_str_appendl(buf, "NULL", 4); break; - case IS_LONG: - smart_str_append_long(buf, Z_LVAL_P(struc)); + case IS_INT: + smart_str_append_int(buf, Z_IVAL_P(struc)); break; case IS_DOUBLE: tmp_len = spprintf(&tmp_str, 0,"%.*H", PG(serialize_precision), Z_DVAL_P(struc)); @@ -483,7 +483,7 @@ again: efree(tmp_str); break; case IS_STRING: - ztmp = php_addcslashes(Z_STRVAL_P(struc), Z_STRLEN_P(struc), 0, "'\\", 2 TSRMLS_CC); + ztmp = php_addcslashes(Z_STRVAL_P(struc), Z_STRSIZE_P(struc), 0, "'\\", 2 TSRMLS_CC); ztmp2 = php_str_to_str_ex(ztmp->val, ztmp->len, "\0", 1, "' . \"\\0\" . '", 12, 0, NULL); smart_str_appendc(buf, '\''); @@ -631,7 +631,7 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var_ptr, zval *var if (var == var_ptr) { /* we still need to bump up the counter, since non-refs will * be counted separately by unserializer */ - ZVAL_LONG(&var_no, -1); + ZVAL_INT(&var_no, -1); zend_hash_next_index_insert(var_hash, &var_no); } #if 0 @@ -641,10 +641,10 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var_ptr, zval *var } /* +1 because otherwise hash will think we are trying to store NULL pointer */ - ZVAL_LONG(&var_no, zend_hash_num_elements(var_hash) + 1); + ZVAL_INT(&var_no, zend_hash_num_elements(var_hash) + 1); zend_hash_str_add(var_hash, p, len, &var_no); #if 0 - fprintf(stderr, "+ add var (%d): %lu\n", Z_TYPE_P(var), Z_LVAL(var_no)); + fprintf(stderr, "+ add var (%d): %lu\n", Z_TYPE_P(var), Z_IVAL(var_no)); #endif return SUCCESS; } @@ -653,7 +653,7 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var_ptr, zval *var static inline void php_var_serialize_long(smart_str *buf, long val) /* {{{ */ { smart_str_appendl(buf, "i:", 2); - smart_str_append_long(buf, val); + smart_str_append_int(buf, val); smart_str_appendc(buf, ';'); } /* }}} */ @@ -661,7 +661,7 @@ static inline void php_var_serialize_long(smart_str *buf, long val) /* {{{ */ static inline void php_var_serialize_string(smart_str *buf, char *str, int len) /* {{{ */ { smart_str_appendl(buf, "s:", 2); - smart_str_append_long(buf, len); + smart_str_append_int(buf, len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, str, len); smart_str_appendl(buf, "\";", 2); @@ -674,7 +674,7 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc PHP_SET_CLASS_ATTRIBUTES(struc); smart_str_appendl(buf, "O:", 2); - smart_str_append_long(buf, (int)class_name->len); + smart_str_append_int(buf, (int)class_name->len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, class_name->val, class_name->len); smart_str_appendl(buf, "\":", 2); @@ -695,7 +695,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt if (incomplete_class) { --count; } - smart_str_append_long(buf, count); + smart_str_append_int(buf, count); smart_str_appendl(buf, ":{", 2); if (count > 0) { @@ -728,7 +728,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt continue; } } - php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name)); + php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name)); php_var_serialize_intern(buf, d, var_hash TSRMLS_CC); } else { zend_class_entry *ce; @@ -737,7 +737,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt zend_string *prot_name, *priv_name; do { - priv_name = zend_mangle_property_name(ce->name->val, ce->name->len, Z_STRVAL_P(name), Z_STRLEN_P(name), ce->type & ZEND_INTERNAL_CLASS); + priv_name = zend_mangle_property_name(ce->name->val, ce->name->len, Z_STRVAL_P(name), Z_STRSIZE_P(name), ce->type & ZEND_INTERNAL_CLASS); if ((d = zend_hash_find(propers, priv_name)) != NULL) { if (Z_TYPE_P(d) == IS_INDIRECT) { d = Z_INDIRECT_P(d); @@ -751,7 +751,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt break; } STR_FREE(priv_name); - prot_name = zend_mangle_property_name("*", 1, Z_STRVAL_P(name), Z_STRLEN_P(name), ce->type & ZEND_INTERNAL_CLASS); + prot_name = zend_mangle_property_name("*", 1, Z_STRVAL_P(name), Z_STRSIZE_P(name), ce->type & ZEND_INTERNAL_CLASS); if ((d = zend_hash_find(propers, prot_name)) != NULL) { if (Z_TYPE_P(d) == IS_INDIRECT) { d = Z_INDIRECT_P(d); @@ -766,12 +766,12 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt break; } STR_FREE(prot_name); - php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name)); + php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%s\" returned as member variable from __sleep() but does not exist", Z_STRVAL_P(name)); } while (0); } else { - php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name)); + php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); } } @@ -797,12 +797,12 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var php_add_var_hash(var_hash, struc, &var_already TSRMLS_CC) == FAILURE) { if (Z_ISREF_P(struc)) { smart_str_appendl(buf, "R:", 2); - smart_str_append_long(buf, Z_LVAL(var_already)); + smart_str_append_int(buf, Z_IVAL(var_already)); smart_str_appendc(buf, ';'); return; } else if (Z_TYPE_P(struc) == IS_OBJECT) { smart_str_appendl(buf, "r:", 2); - smart_str_append_long(buf, Z_LVAL(var_already)); + smart_str_append_int(buf, Z_IVAL(var_already)); smart_str_appendc(buf, ';'); return; } @@ -822,8 +822,8 @@ again: smart_str_appendl(buf, "N;", 2); return; - case IS_LONG: - php_var_serialize_long(buf, Z_LVAL_P(struc)); + case IS_INT: + php_var_serialize_long(buf, Z_IVAL_P(struc)); return; case IS_DOUBLE: { @@ -839,7 +839,7 @@ again: } case IS_STRING: - php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRLEN_P(struc)); + php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); return; case IS_OBJECT: { @@ -859,12 +859,12 @@ again: if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { smart_str_appendl(buf, "C:", 2); - smart_str_append_long(buf, (int)Z_OBJCE_P(struc)->name->len); + smart_str_append_int(buf, (int)Z_OBJCE_P(struc)->name->len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, Z_OBJCE_P(struc)->name->val, Z_OBJCE_P(struc)->name->len); smart_str_appendl(buf, "\":", 2); - smart_str_append_long(buf, (int)serialized_length); + smart_str_append_int(buf, (int)serialized_length); smart_str_appendl(buf, ":{", 2); smart_str_appendl(buf, serialized_data, serialized_length); smart_str_appendc(buf, '}'); @@ -923,7 +923,7 @@ again: if (i > 0 && incomplete_class) { --i; } - smart_str_append_long(buf, i); + smart_str_append_int(buf, i); smart_str_appendl(buf, ":{", 2); if (i > 0) { zend_string *key; @@ -1048,7 +1048,7 @@ PHP_FUNCTION(memory_get_usage) { RETURN_FALSE; } - RETURN_LONG(zend_memory_usage(real_usage TSRMLS_CC)); + RETURN_INT(zend_memory_usage(real_usage TSRMLS_CC)); } /* }}} */ @@ -1061,7 +1061,7 @@ PHP_FUNCTION(memory_get_peak_usage) { RETURN_FALSE; } - RETURN_LONG(zend_memory_peak_usage(real_usage TSRMLS_CC)); + RETURN_INT(zend_memory_peak_usage(real_usage TSRMLS_CC)); } /* }}} */ diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index b6fcd79c2d..968598aa18 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -307,7 +307,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long return 0; } - if (Z_TYPE(key) != IS_LONG && Z_TYPE(key) != IS_STRING) { + if (Z_TYPE(key) != IS_INT && Z_TYPE(key) != IS_STRING) { zval_dtor(&key); return 0; } @@ -317,12 +317,12 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long if (!objprops) { switch (Z_TYPE(key)) { - case IS_LONG: - if ((old_data = zend_hash_index_find(ht, Z_LVAL(key))) != NULL) { + case IS_INT: + if ((old_data = zend_hash_index_find(ht, Z_IVAL(key))) != NULL) { //??? update hash var_push_dtor(var_hash, old_data); } - data = zend_hash_index_update(ht, Z_LVAL(key), &d); + data = zend_hash_index_update(ht, Z_IVAL(key), &d); break; case IS_STRING: if ((old_data = zend_symtable_find(ht, Z_STR(key))) != NULL) { @@ -1142,9 +1142,9 @@ yy79: } /* Use double for large long values that were serialized on a 64-bit system */ - if (digits >= MAX_LENGTH_OF_LONG - 1) { - if (digits == MAX_LENGTH_OF_LONG - 1) { - int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1); + if (digits >= MAX_LENGTH_OF_ZEND_INT - 1) { + if (digits == MAX_LENGTH_OF_ZEND_INT - 1) { + int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_ZEND_INT, int_min_digits, MAX_LENGTH_OF_ZEND_INT - 1); if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) { goto use_double; @@ -1155,7 +1155,7 @@ yy79: } #endif *p = YYCURSOR; - ZVAL_LONG(rval, parse_iv(start + 2)); + ZVAL_INT(rval, parse_iv(start + 2)); return 1; } #line 1162 "ext/standard/var_unserializer.c" diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c index 9eb3829a08..85085b0b97 100644 --- a/ext/standard/versioning.c +++ b/ext/standard/versioning.c @@ -221,7 +221,7 @@ PHP_FUNCTION(version_compare) } compare = php_version_compare(v1, v2); if (argc == 2) { - RETURN_LONG(compare); + RETURN_INT(compare); } if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) { RETURN_BOOL(compare == -1); |