diff options
author | Marcus Boerger <helly@php.net> | 2003-05-24 17:12:58 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2003-05-24 17:12:58 +0000 |
commit | 0b0e0e9511aa170b58e1d7421a40a404060e48b3 (patch) | |
tree | 704390a8451e86708b7fc41ffaf3add609b2260d /ext/standard/var_unserializer.c | |
parent | e035046ac2a6e969845a2f6c9f8efdcf0d5066c3 (diff) | |
download | php-git-0b0e0e9511aa170b58e1d7421a40a404060e48b3.tar.gz |
Update after fix
Diffstat (limited to 'ext/standard/var_unserializer.c')
-rw-r--r-- | ext/standard/var_unserializer.c | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 926bec6ba2..21a741073f 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.5 on Sun May 18 14:06:59 2003 */ +/* Generated by re2c 0.5 on Sat May 24 19:11:12 2003 */ #line 1 "/usr/src/php5/ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ @@ -339,7 +339,7 @@ yy3: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if(yych == ':') goto yy74; yy4: -#line 430 +#line 441 { return 0; } yy5: yych = *++YYCURSOR; if(yych == ';') goto yy72; @@ -374,7 +374,7 @@ yy12: yyaccept = 0; goto yy4; yy13: yych = *++YYCURSOR; yy14: -#line 424 +#line 435 { /* this is the case where we have less data than planned */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data"); @@ -405,6 +405,7 @@ yy22: int len2; char *class_name; zend_class_entry *ce; + zend_class_entry **pce; int incomplete_class = 0; zval *user_func; @@ -425,50 +426,60 @@ yy22: class_name[len] = class_name[len] - 'A' + 'a'; } } - - if (zend_hash_find(CG(class_table), class_name, len2 + 1, (void **) &ce) != SUCCESS) { + + do { + /* Try to find class directly */ + if (zend_lookup_ns_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + ce = *pce; + break; + } + + /* Check for unserialize callback */ if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) { incomplete_class = 1; ce = PHP_IC_ENTRY; + break; + } + + /* Call unserialize callback */ + MAKE_STD_ZVAL(user_func); + ZVAL_STRING(user_func, PG(unserialize_callback_func), 1); + args[0] = &arg_func_name; + MAKE_STD_ZVAL(arg_func_name); + ZVAL_STRING(arg_func_name, class_name, 1); + if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", user_func->value.str.val); + incomplete_class = 1; + ce = PHP_IC_ENTRY; + zval_ptr_dtor(&user_func); + zval_ptr_dtor(&arg_func_name); + break; + } + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + /* The callback function may have defined the class */ + if (zend_lookup_ns_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + ce = *pce; } else { - MAKE_STD_ZVAL(user_func); - ZVAL_STRING(user_func, PG(unserialize_callback_func), 1); - - args[0] = &arg_func_name; - MAKE_STD_ZVAL(arg_func_name); - ZVAL_STRING(arg_func_name, class_name, 1); - - if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", user_func->value.str.val); - incomplete_class = 1; - ce = PHP_IC_ENTRY; - } else { - if (zend_hash_find(CG(class_table), class_name, len2 + 1, (void **) &ce) != SUCCESS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "(%s) hasn't defined the class it was called for", user_func->value.str.val); - incomplete_class = 1; - ce = PHP_IC_ENTRY; - } else { -#ifdef ZEND_ENGINE_2 - ce = *(zend_class_entry **)ce; /* Bad hack, TBF! */ -#endif - efree(class_name); - } - } + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function %s() hasn't defined the class it was called for", user_func->value.str.val); + incomplete_class = 1; + ce = PHP_IC_ENTRY; } - } else { -#ifdef ZEND_ENGINE_2 - ce = *(zend_class_entry **)ce; /* Bad hack, TBF! */ -#endif - efree(class_name); - } + zval_ptr_dtor(&user_func); + zval_ptr_dtor(&arg_func_name); + break; + } while (1); + *p = YYCURSOR; elements = object_common1(UNSERIALIZE_PASSTHRU, ce); if (incomplete_class) { php_store_class_name(*rval, class_name, len2); - efree(class_name); } + efree(class_name); return object_common2(UNSERIALIZE_PASSTHRU, elements); } @@ -797,7 +808,7 @@ yy79: return 1; } } -#line 432 +#line 443 return 0; |