diff options
Diffstat (limited to 'ext/standard/var_unserializer.c')
| -rw-r--r-- | ext/standard/var_unserializer.c | 111 |
1 files changed, 52 insertions, 59 deletions
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 0217bba5fa..bcd00a6eba 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 */ +/* Generated by re2c 0.13.7.5 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ @@ -319,8 +319,8 @@ static inline size_t parse_uiv(const unsigned char *p) return result; } -#define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash, HashTable *classes TSRMLS_DC -#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash, classes TSRMLS_CC +#define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash, HashTable *classes +#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash, classes static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, int objprops) { @@ -329,7 +329,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend ZVAL_UNDEF(&key); - if (!php_var_unserialize_ex(&key, p, max, NULL, classes TSRMLS_CC)) { + if (!php_var_unserialize_ex(&key, p, max, NULL, classes)) { zval_dtor(&key); return 0; } @@ -362,26 +362,18 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend } else { /* object properties should include no integers */ convert_to_string(&key); -//??? -#if 1 - data = zend_hash_update_ind(ht, Z_STR(key), &d); -#else - if ((data = zend_hash_find(ht, Z_STR(key))) != NULL) { - if (Z_TYPE_P(data) == IS_INDIRECT) { - data = Z_INDIRECT_P(data); + if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) { + if (Z_TYPE_P(old_data) == IS_INDIRECT) { + old_data = Z_INDIRECT_P(old_data); } - zval_ptr_dtor(data); -//??? var_push_dtor(var_hash, data); - ZVAL_UNDEF(data); - } else { - data = zend_hash_update(ht, Z_STR(key), &d); - } -#endif + var_push_dtor(var_hash, old_data); + } + data = zend_hash_update_ind(ht, Z_STR(key), &d); } zval_dtor(&key); - if (!php_var_unserialize_ex(data, p, max, var_hash, classes TSRMLS_CC)) { + if (!php_var_unserialize_ex(data, p, max, var_hash, classes)) { return 0; } @@ -421,7 +413,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) if (ce->unserialize == NULL) { zend_error(E_WARNING, "Class %s has no unserializer", ce->name->val); object_init_ex(rval, ce); - } else if (ce->unserialize(rval, ce, (const unsigned char*)*p, datalen, (zend_unserialize_data *)var_hash TSRMLS_CC) != SUCCESS) { + } else if (ce->unserialize(rval, ce, (const unsigned char*)*p, datalen, (zend_unserialize_data *)var_hash) != SUCCESS) { return 0; } @@ -472,7 +464,7 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements) zend_hash_str_exists(&Z_OBJCE_P(rval)->function_table, "__wakeup", sizeof("__wakeup")-1)) { ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1); BG(serialize_lock)++; - call_user_function_ex(CG(function_table), rval, &fname, &retval, 0, 0, 1, NULL TSRMLS_CC); + call_user_function_ex(CG(function_table), rval, &fname, &retval, 0, 0, 1, NULL); BG(serialize_lock)--; zval_dtor(&fname); zval_dtor(&retval); @@ -489,7 +481,7 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements) # pragma optimize("", on) #endif -PHPAPI int php_var_unserialize(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC) +PHPAPI int php_var_unserialize(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash) { HashTable *classes = NULL; return php_var_unserialize_ex(UNSERIALIZE_PASSTHRU); @@ -515,7 +507,7 @@ PHPAPI int php_var_unserialize_ex(UNSERIALIZE_PARAMETER) start = cursor; -#line 519 "ext/standard/var_unserializer.c" +#line 511 "ext/standard/var_unserializer.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -575,9 +567,9 @@ yy2: yych = *(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy95; yy3: -#line 866 "ext/standard/var_unserializer.re" +#line 858 "ext/standard/var_unserializer.re" { return 0; } -#line 581 "ext/standard/var_unserializer.c" +#line 573 "ext/standard/var_unserializer.c" yy4: yych = *(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy89; @@ -620,13 +612,13 @@ yy13: goto yy3; yy14: ++YYCURSOR; -#line 860 "ext/standard/var_unserializer.re" +#line 852 "ext/standard/var_unserializer.re" { /* this is the case where we have less data than planned */ - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data"); + php_error_docref(NULL, E_NOTICE, "Unexpected end of serialized data"); return 0; /* not sure if it should be 0 or 1 here? */ } -#line 630 "ext/standard/var_unserializer.c" +#line 622 "ext/standard/var_unserializer.c" yy16: yych = *++YYCURSOR; goto yy3; @@ -652,11 +644,12 @@ yy20: if (yybm[0+yych] & 128) { goto yy20; } - if (yych != ':') goto yy18; + if (yych <= '/') goto yy18; + if (yych >= ';') goto yy18; yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 715 "ext/standard/var_unserializer.re" +#line 707 "ext/standard/var_unserializer.re" { size_t len, len2, len3, maxlen; zend_long elements; @@ -714,7 +707,7 @@ yy20: /* Try to find class directly */ BG(serialize_lock)++; - ce = zend_lookup_class(class_name TSRMLS_CC); + ce = zend_lookup_class(class_name); if (ce) { BG(serialize_lock)--; if (EG(exception)) { @@ -742,7 +735,7 @@ yy20: ZVAL_STR_COPY(&args[0], class_name); BG(serialize_lock)++; - if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) { + if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL) != SUCCESS) { BG(serialize_lock)--; if (EG(exception)) { zend_string_release(class_name); @@ -750,7 +743,7 @@ yy20: zval_ptr_dtor(&args[0]); return 0; } - php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", Z_STRVAL(user_func)); + php_error_docref(NULL, E_WARNING, "defined (%s) but not found", Z_STRVAL(user_func)); incomplete_class = 1; ce = PHP_IC_ENTRY; zval_ptr_dtor(&user_func); @@ -767,8 +760,8 @@ yy20: } /* The callback function may have defined the class */ - if ((ce = zend_lookup_class(class_name TSRMLS_CC)) == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function %s() hasn't defined the class it was called for", Z_STRVAL(user_func)); + if ((ce = zend_lookup_class(class_name)) == NULL) { + php_error_docref(NULL, E_WARNING, "Function %s() hasn't defined the class it was called for", Z_STRVAL(user_func)); incomplete_class = 1; ce = PHP_IC_ENTRY; } @@ -801,7 +794,7 @@ yy20: return object_common2(UNSERIALIZE_PASSTHRU, elements); } -#line 805 "ext/standard/var_unserializer.c" +#line 798 "ext/standard/var_unserializer.c" yy25: yych = *++YYCURSOR; if (yych <= ',') { @@ -826,7 +819,7 @@ yy27: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 707 "ext/standard/var_unserializer.re" +#line 699 "ext/standard/var_unserializer.re" { //??? INIT_PZVAL(rval); @@ -834,7 +827,7 @@ yy27: return object_common2(UNSERIALIZE_PASSTHRU, object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); } -#line 838 "ext/standard/var_unserializer.c" +#line 831 "ext/standard/var_unserializer.c" yy32: yych = *++YYCURSOR; if (yych == '+') goto yy33; @@ -855,7 +848,7 @@ yy34: yych = *++YYCURSOR; if (yych != '{') goto yy18; ++YYCURSOR; -#line 686 "ext/standard/var_unserializer.re" +#line 678 "ext/standard/var_unserializer.re" { zend_long elements = parse_iv(start + 2); /* use iv() not uiv() in order to check data range */ @@ -876,7 +869,7 @@ yy34: return finish_nested_data(UNSERIALIZE_PASSTHRU); } -#line 880 "ext/standard/var_unserializer.c" +#line 873 "ext/standard/var_unserializer.c" yy39: yych = *++YYCURSOR; if (yych == '+') goto yy40; @@ -897,7 +890,7 @@ yy41: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 658 "ext/standard/var_unserializer.re" +#line 650 "ext/standard/var_unserializer.re" { size_t len, maxlen; zend_string *str; @@ -925,7 +918,7 @@ yy41: ZVAL_STR(rval, str); return 1; } -#line 929 "ext/standard/var_unserializer.c" +#line 922 "ext/standard/var_unserializer.c" yy46: yych = *++YYCURSOR; if (yych == '+') goto yy47; @@ -946,7 +939,7 @@ yy48: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 631 "ext/standard/var_unserializer.re" +#line 623 "ext/standard/var_unserializer.re" { size_t len, maxlen; char *str; @@ -973,7 +966,7 @@ yy48: ZVAL_STRINGL(rval, str, len); return 1; } -#line 977 "ext/standard/var_unserializer.c" +#line 970 "ext/standard/var_unserializer.c" yy53: yych = *++YYCURSOR; if (yych <= '/') { @@ -1061,7 +1054,7 @@ yy61: } yy63: ++YYCURSOR; -#line 622 "ext/standard/var_unserializer.re" +#line 614 "ext/standard/var_unserializer.re" { #if SIZEOF_ZEND_LONG == 4 use_double: @@ -1070,7 +1063,7 @@ use_double: ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL)); return 1; } -#line 1074 "ext/standard/var_unserializer.c" +#line 1067 "ext/standard/var_unserializer.c" yy65: yych = *++YYCURSOR; if (yych <= ',') { @@ -1129,7 +1122,7 @@ yy73: yych = *++YYCURSOR; if (yych != ';') goto yy18; ++YYCURSOR; -#line 606 "ext/standard/var_unserializer.re" +#line 598 "ext/standard/var_unserializer.re" { *p = YYCURSOR; @@ -1145,7 +1138,7 @@ yy73: return 1; } -#line 1149 "ext/standard/var_unserializer.c" +#line 1142 "ext/standard/var_unserializer.c" yy76: yych = *++YYCURSOR; if (yych == 'N') goto yy73; @@ -1172,7 +1165,7 @@ yy79: if (yych <= '9') goto yy79; if (yych != ';') goto yy18; ++YYCURSOR; -#line 580 "ext/standard/var_unserializer.re" +#line 572 "ext/standard/var_unserializer.re" { #if SIZEOF_ZEND_LONG == 4 int digits = YYCURSOR - start - 3; @@ -1198,7 +1191,7 @@ yy79: ZVAL_LONG(rval, parse_iv(start + 2)); return 1; } -#line 1202 "ext/standard/var_unserializer.c" +#line 1195 "ext/standard/var_unserializer.c" yy83: yych = *++YYCURSOR; if (yych <= '/') goto yy18; @@ -1206,22 +1199,22 @@ yy83: yych = *++YYCURSOR; if (yych != ';') goto yy18; ++YYCURSOR; -#line 574 "ext/standard/var_unserializer.re" +#line 566 "ext/standard/var_unserializer.re" { *p = YYCURSOR; ZVAL_BOOL(rval, parse_iv(start + 2)); return 1; } -#line 1216 "ext/standard/var_unserializer.c" +#line 1209 "ext/standard/var_unserializer.c" yy87: ++YYCURSOR; -#line 568 "ext/standard/var_unserializer.re" +#line 560 "ext/standard/var_unserializer.re" { *p = YYCURSOR; ZVAL_NULL(rval); return 1; } -#line 1225 "ext/standard/var_unserializer.c" +#line 1218 "ext/standard/var_unserializer.c" yy89: yych = *++YYCURSOR; if (yych <= ',') { @@ -1244,7 +1237,7 @@ yy91: if (yych <= '9') goto yy91; if (yych != ';') goto yy18; ++YYCURSOR; -#line 545 "ext/standard/var_unserializer.re" +#line 537 "ext/standard/var_unserializer.re" { zend_long id; @@ -1267,7 +1260,7 @@ yy91: return 1; } -#line 1271 "ext/standard/var_unserializer.c" +#line 1264 "ext/standard/var_unserializer.c" yy95: yych = *++YYCURSOR; if (yych <= ',') { @@ -1290,7 +1283,7 @@ yy97: if (yych <= '9') goto yy97; if (yych != ';') goto yy18; ++YYCURSOR; -#line 523 "ext/standard/var_unserializer.re" +#line 515 "ext/standard/var_unserializer.re" { zend_long id; @@ -1312,9 +1305,9 @@ yy97: return 1; } -#line 1316 "ext/standard/var_unserializer.c" +#line 1309 "ext/standard/var_unserializer.c" } -#line 868 "ext/standard/var_unserializer.re" +#line 860 "ext/standard/var_unserializer.re" return 0; |
