summaryrefslogtreecommitdiff
path: root/ext/standard/var_unserializer.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/var_unserializer.c')
-rw-r--r--ext/standard/var_unserializer.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index b4be2cc26d..3ae0aaf633 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -30,13 +30,13 @@
typedef struct {
zval *data[VAR_ENTRIES_MAX];
- php_int_t used_slots;
+ zend_long used_slots;
void *next;
} var_entries;
typedef struct {
zval data[VAR_ENTRIES_MAX];
- php_int_t used_slots;
+ zend_long used_slots;
void *next;
} var_dtor_entries;
@@ -119,7 +119,7 @@ PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval *rva
PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nzval)
{
- php_int_t i;
+ zend_long i;
var_entries *var_hash = (*var_hashx)->first;
#if VAR_ENTRIES_DBG
fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval));
@@ -136,7 +136,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nz
}
}
-static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id)
+static zval *var_access(php_unserialize_data_t *var_hashx, zend_long id)
{
var_entries *var_hash = (*var_hashx)->first;
#if VAR_ENTRIES_DBG
@@ -158,7 +158,7 @@ static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id)
PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
{
void *next;
- php_int_t i;
+ zend_long i;
var_entries *var_hash = (*var_hashx)->first;
var_dtor_entries *var_dtor_hash = (*var_hashx)->first_dtor;
#if VAR_ENTRIES_DBG
@@ -186,17 +186,17 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t maxlen)
{
size_t i, j;
- zend_string *str = STR_ALLOC(len, 0);
+ zend_string *str = zend_string_alloc(len, 0);
unsigned char *end = *(unsigned char **)p+maxlen;
if (end < *p) {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
for (i = 0; i < len; i++) {
if (*p >= end) {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
if (**p != '\\') {
@@ -213,7 +213,7 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t
} else if (**p >= 'A' && **p <= 'F') {
ch = (ch << 4) + (**p -'A'+10);
} else {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
}
@@ -238,10 +238,10 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t
-static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **q)
+static inline zend_long parse_iv2(const unsigned char *p, const unsigned char **q)
{
char cursor;
- php_int_t result = 0;
+ zend_long result = 0;
int neg = 0;
switch (*p) {
@@ -266,7 +266,7 @@ static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **
return result;
}
-static inline php_int_t parse_iv(const unsigned char *p)
+static inline zend_long parse_iv(const unsigned char *p)
{
return parse_iv2(p, NULL);
}
@@ -296,7 +296,7 @@ static inline size_t parse_uiv(const unsigned char *p)
#define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC
#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC
-static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_int_t elements, int objprops)
+static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, int objprops)
{
while (elements-- > 0) {
zval key, *data, d, *old_data;
@@ -307,7 +307,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_
return 0;
}
- if (Z_TYPE(key) != IS_INT && Z_TYPE(key) != IS_STRING) {
+ if (Z_TYPE(key) != IS_LONG && Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
return 0;
}
@@ -317,12 +317,12 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_
if (!objprops) {
switch (Z_TYPE(key)) {
- case IS_INT:
- if ((old_data = zend_hash_index_find(ht, Z_IVAL(key))) != NULL) {
+ case IS_LONG:
+ if ((old_data = zend_hash_index_find(ht, Z_LVAL(key))) != NULL) {
//??? update hash
var_push_dtor(var_hash, old_data);
}
- data = zend_hash_index_update(ht, Z_IVAL(key), &d);
+ data = zend_hash_index_update(ht, Z_LVAL(key), &d);
break;
case IS_STRING:
if ((old_data = zend_symtable_find(ht, Z_STR(key))) != NULL) {
@@ -380,14 +380,14 @@ static inline int finish_nested_data(UNSERIALIZE_PARAMETER)
static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
{
- php_int_t datalen;
+ zend_long datalen;
datalen = parse_iv2((*p) + 2, p);
(*p) += 2;
if (datalen < 0 || (*p) + datalen >= max) {
- zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %pd present", datalen, (php_int_t)(max - (*p)));
+ zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %pd present", datalen, (zend_long)(max - (*p)));
return 0;
}
@@ -403,9 +403,9 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
-static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
+static inline zend_long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
{
- php_int_t elements;
+ zend_long elements;
elements = parse_iv2((*p) + 2, p);
@@ -426,7 +426,7 @@ static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *
#ifdef PHP_WIN32
# pragma optimize("", off)
#endif
-static inline int object_common2(UNSERIALIZE_PARAMETER, php_int_t elements)
+static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements)
{
zval retval;
zval fname;
@@ -625,7 +625,7 @@ yy20:
#line 681 "ext/standard/var_unserializer.re"
{
size_t len, len2, len3, maxlen;
- php_int_t elements;
+ zend_long elements;
char *str;
zend_string *class_name;
zend_class_entry *ce;
@@ -669,7 +669,7 @@ yy20:
return 0;
}
- class_name = STR_INIT(str, len, 0);
+ class_name = zend_string_init(str, len, 0);
do {
/* Try to find class directly */
@@ -678,7 +678,7 @@ yy20:
if (ce) {
BG(serialize_lock)--;
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return 0;
}
break;
@@ -686,7 +686,7 @@ yy20:
BG(serialize_lock)--;
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return 0;
}
@@ -700,12 +700,12 @@ yy20:
/* Call unserialize callback */
ZVAL_STRING(&user_func, PG(unserialize_callback_func));
- ZVAL_STR(&args[0], STR_COPY(class_name));
+ ZVAL_STR(&args[0], zend_string_copy(class_name));
BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
BG(serialize_lock)--;
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
return 0;
@@ -720,7 +720,7 @@ yy20:
BG(serialize_lock)--;
zval_ptr_dtor(&retval);
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
return 0;
@@ -748,7 +748,7 @@ yy20:
if (ret && incomplete_class) {
php_store_class_name(rval, class_name->val, len2);
}
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return ret;
}
@@ -757,7 +757,7 @@ yy20:
if (incomplete_class) {
php_store_class_name(rval, class_name->val, len2);
}
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
@@ -817,7 +817,7 @@ yy34:
++YYCURSOR;
#line 652 "ext/standard/var_unserializer.re"
{
- php_int_t elements = parse_iv(start + 2);
+ zend_long elements = parse_iv(start + 2);
/* use iv() not uiv() in order to check data range */
*p = YYCURSOR;
@@ -874,7 +874,7 @@ yy41:
}
if (*(YYCURSOR) != '"') {
- STR_FREE(str);
+ zend_string_free(str);
*p = YYCURSOR;
return 0;
}
@@ -1141,10 +1141,10 @@ yy79:
digits--;
}
- /* Use double for large php_int_t values that were serialized on a 64-bit system */
- 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);
+ /* Use double for large zend_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 (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) {
goto use_double;
@@ -1155,7 +1155,7 @@ yy79:
}
#endif
*p = YYCURSOR;
- ZVAL_INT(rval, parse_iv(start + 2));
+ ZVAL_LONG(rval, parse_iv(start + 2));
return 1;
}
#line 1162 "ext/standard/var_unserializer.c"
@@ -1206,7 +1206,7 @@ yy91:
++YYCURSOR;
#line 511 "ext/standard/var_unserializer.re"
{
- php_int_t id;
+ zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
@@ -1252,7 +1252,7 @@ yy97:
++YYCURSOR;
#line 489 "ext/standard/var_unserializer.re"
{
- php_int_t id;
+ zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;