Fixed regression introduced by patch for bug #67072

This applies to 5.4 and 5.5 only as a legacy fix.
This commit is contained in:
Anatol Belski 2014-06-03 20:43:58 +02:00
parent 0817a2c767
commit 20568e5028
3 changed files with 44 additions and 38 deletions

View File

@ -156,11 +156,9 @@ object(TestNAOld)#%d (0) {
} }
===NANew=== ===NANew===
unserializer(TestNANew) unserializer(TestNANew)
TestNew::__wakeup()
Warning: Erroneous data format for unserializing 'TestNANew' in %s005.php on line %d object(TestNANew)#1 (0) {
}
Notice: unserialize(): Error at offset 19 of 20 bytes in %s005.php on line %d
bool(false)
===NANew2=== ===NANew2===
unserializer(TestNANew2) unserializer(TestNANew2)
TestNew::unserialize() TestNew::unserialize()

View File

@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Fri Apr 18 15:07:27 2014 */ /* Generated by re2c 0.13.5 on Tue Jun 3 10:23:35 2014 */
#line 1 "ext/standard/var_unserializer.re" #line 1 "ext/standard/var_unserializer.re"
/* /*
+----------------------------------------------------------------------+ +----------------------------------------------------------------------+
@ -396,7 +396,11 @@ static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
(*p) += 2; (*p) += 2;
if (ce->serialize == NULL) { /* The internal class check here is a BC fix only, userspace classes implementing the
Serializable interface have eventually an inconsistent behavior at this place when
unserialized from a manipulated string. Additionaly the interal classes can possibly
crash PHP so they're still disabled here. */
if (ce->serialize == NULL || ZEND_INTERNAL_CLASS != ce->type) {
object_init_ex(*rval, ce); object_init_ex(*rval, ce);
} else { } else {
/* If this class implements Serializable, it should not land here but in object_custom(). The passed string /* If this class implements Serializable, it should not land here but in object_custom(). The passed string
@ -469,7 +473,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
#line 473 "ext/standard/var_unserializer.c" #line 477 "ext/standard/var_unserializer.c"
{ {
YYCTYPE yych; YYCTYPE yych;
static const unsigned char yybm[] = { static const unsigned char yybm[] = {
@ -529,9 +533,9 @@ yy2:
yych = *(YYMARKER = ++YYCURSOR); yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy95; if (yych == ':') goto yy95;
yy3: yy3:
#line 824 "ext/standard/var_unserializer.re" #line 828 "ext/standard/var_unserializer.re"
{ return 0; } { return 0; }
#line 535 "ext/standard/var_unserializer.c" #line 539 "ext/standard/var_unserializer.c"
yy4: yy4:
yych = *(YYMARKER = ++YYCURSOR); yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy89; if (yych == ':') goto yy89;
@ -574,13 +578,13 @@ yy13:
goto yy3; goto yy3;
yy14: yy14:
++YYCURSOR; ++YYCURSOR;
#line 818 "ext/standard/var_unserializer.re" #line 822 "ext/standard/var_unserializer.re"
{ {
/* this is the case where we have less data than planned */ /* 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 TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data");
return 0; /* not sure if it should be 0 or 1 here? */ return 0; /* not sure if it should be 0 or 1 here? */
} }
#line 584 "ext/standard/var_unserializer.c" #line 588 "ext/standard/var_unserializer.c"
yy16: yy16:
yych = *++YYCURSOR; yych = *++YYCURSOR;
goto yy3; goto yy3;
@ -610,7 +614,7 @@ yy20:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych != '"') goto yy18; if (yych != '"') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 672 "ext/standard/var_unserializer.re" #line 676 "ext/standard/var_unserializer.re"
{ {
size_t len, len2, len3, maxlen; size_t len, len2, len3, maxlen;
long elements; long elements;
@ -756,7 +760,7 @@ yy20:
return object_common2(UNSERIALIZE_PASSTHRU, elements); return object_common2(UNSERIALIZE_PASSTHRU, elements);
} }
#line 760 "ext/standard/var_unserializer.c" #line 764 "ext/standard/var_unserializer.c"
yy25: yy25:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych <= ',') { if (yych <= ',') {
@ -781,7 +785,7 @@ yy27:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych != '"') goto yy18; if (yych != '"') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 664 "ext/standard/var_unserializer.re" #line 668 "ext/standard/var_unserializer.re"
{ {
INIT_PZVAL(*rval); INIT_PZVAL(*rval);
@ -789,7 +793,7 @@ yy27:
return object_common2(UNSERIALIZE_PASSTHRU, return object_common2(UNSERIALIZE_PASSTHRU,
object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
} }
#line 793 "ext/standard/var_unserializer.c" #line 797 "ext/standard/var_unserializer.c"
yy32: yy32:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych == '+') goto yy33; if (yych == '+') goto yy33;
@ -810,7 +814,7 @@ yy34:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych != '{') goto yy18; if (yych != '{') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 644 "ext/standard/var_unserializer.re" #line 648 "ext/standard/var_unserializer.re"
{ {
long elements = parse_iv(start + 2); long elements = parse_iv(start + 2);
/* use iv() not uiv() in order to check data range */ /* use iv() not uiv() in order to check data range */
@ -830,7 +834,7 @@ yy34:
return finish_nested_data(UNSERIALIZE_PASSTHRU); return finish_nested_data(UNSERIALIZE_PASSTHRU);
} }
#line 834 "ext/standard/var_unserializer.c" #line 838 "ext/standard/var_unserializer.c"
yy39: yy39:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych == '+') goto yy40; if (yych == '+') goto yy40;
@ -851,7 +855,7 @@ yy41:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych != '"') goto yy18; if (yych != '"') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 615 "ext/standard/var_unserializer.re" #line 619 "ext/standard/var_unserializer.re"
{ {
size_t len, maxlen; size_t len, maxlen;
char *str; char *str;
@ -880,7 +884,7 @@ yy41:
ZVAL_STRINGL(*rval, str, len, 0); ZVAL_STRINGL(*rval, str, len, 0);
return 1; return 1;
} }
#line 884 "ext/standard/var_unserializer.c" #line 888 "ext/standard/var_unserializer.c"
yy46: yy46:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych == '+') goto yy47; if (yych == '+') goto yy47;
@ -901,7 +905,7 @@ yy48:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych != '"') goto yy18; if (yych != '"') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 587 "ext/standard/var_unserializer.re" #line 591 "ext/standard/var_unserializer.re"
{ {
size_t len, maxlen; size_t len, maxlen;
char *str; char *str;
@ -929,7 +933,7 @@ yy48:
ZVAL_STRINGL(*rval, str, len, 1); ZVAL_STRINGL(*rval, str, len, 1);
return 1; return 1;
} }
#line 933 "ext/standard/var_unserializer.c" #line 937 "ext/standard/var_unserializer.c"
yy53: yy53:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych <= '/') { if (yych <= '/') {
@ -1017,7 +1021,7 @@ yy61:
} }
yy63: yy63:
++YYCURSOR; ++YYCURSOR;
#line 577 "ext/standard/var_unserializer.re" #line 581 "ext/standard/var_unserializer.re"
{ {
#if SIZEOF_LONG == 4 #if SIZEOF_LONG == 4
use_double: use_double:
@ -1027,7 +1031,7 @@ use_double:
ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL)); ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL));
return 1; return 1;
} }
#line 1031 "ext/standard/var_unserializer.c" #line 1035 "ext/standard/var_unserializer.c"
yy65: yy65:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych <= ',') { if (yych <= ',') {
@ -1086,7 +1090,7 @@ yy73:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych != ';') goto yy18; if (yych != ';') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 562 "ext/standard/var_unserializer.re" #line 566 "ext/standard/var_unserializer.re"
{ {
*p = YYCURSOR; *p = YYCURSOR;
INIT_PZVAL(*rval); INIT_PZVAL(*rval);
@ -1101,7 +1105,7 @@ yy73:
return 1; return 1;
} }
#line 1105 "ext/standard/var_unserializer.c" #line 1109 "ext/standard/var_unserializer.c"
yy76: yy76:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych == 'N') goto yy73; if (yych == 'N') goto yy73;
@ -1128,7 +1132,7 @@ yy79:
if (yych <= '9') goto yy79; if (yych <= '9') goto yy79;
if (yych != ';') goto yy18; if (yych != ';') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 535 "ext/standard/var_unserializer.re" #line 539 "ext/standard/var_unserializer.re"
{ {
#if SIZEOF_LONG == 4 #if SIZEOF_LONG == 4
int digits = YYCURSOR - start - 3; int digits = YYCURSOR - start - 3;
@ -1155,7 +1159,7 @@ yy79:
ZVAL_LONG(*rval, parse_iv(start + 2)); ZVAL_LONG(*rval, parse_iv(start + 2));
return 1; return 1;
} }
#line 1159 "ext/standard/var_unserializer.c" #line 1163 "ext/standard/var_unserializer.c"
yy83: yy83:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych <= '/') goto yy18; if (yych <= '/') goto yy18;
@ -1163,24 +1167,24 @@ yy83:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych != ';') goto yy18; if (yych != ';') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 528 "ext/standard/var_unserializer.re" #line 532 "ext/standard/var_unserializer.re"
{ {
*p = YYCURSOR; *p = YYCURSOR;
INIT_PZVAL(*rval); INIT_PZVAL(*rval);
ZVAL_BOOL(*rval, parse_iv(start + 2)); ZVAL_BOOL(*rval, parse_iv(start + 2));
return 1; return 1;
} }
#line 1174 "ext/standard/var_unserializer.c" #line 1178 "ext/standard/var_unserializer.c"
yy87: yy87:
++YYCURSOR; ++YYCURSOR;
#line 521 "ext/standard/var_unserializer.re" #line 525 "ext/standard/var_unserializer.re"
{ {
*p = YYCURSOR; *p = YYCURSOR;
INIT_PZVAL(*rval); INIT_PZVAL(*rval);
ZVAL_NULL(*rval); ZVAL_NULL(*rval);
return 1; return 1;
} }
#line 1184 "ext/standard/var_unserializer.c" #line 1188 "ext/standard/var_unserializer.c"
yy89: yy89:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych <= ',') { if (yych <= ',') {
@ -1203,7 +1207,7 @@ yy91:
if (yych <= '9') goto yy91; if (yych <= '9') goto yy91;
if (yych != ';') goto yy18; if (yych != ';') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 498 "ext/standard/var_unserializer.re" #line 502 "ext/standard/var_unserializer.re"
{ {
long id; long id;
@ -1226,7 +1230,7 @@ yy91:
return 1; return 1;
} }
#line 1230 "ext/standard/var_unserializer.c" #line 1234 "ext/standard/var_unserializer.c"
yy95: yy95:
yych = *++YYCURSOR; yych = *++YYCURSOR;
if (yych <= ',') { if (yych <= ',') {
@ -1249,7 +1253,7 @@ yy97:
if (yych <= '9') goto yy97; if (yych <= '9') goto yy97;
if (yych != ';') goto yy18; if (yych != ';') goto yy18;
++YYCURSOR; ++YYCURSOR;
#line 477 "ext/standard/var_unserializer.re" #line 481 "ext/standard/var_unserializer.re"
{ {
long id; long id;
@ -1270,9 +1274,9 @@ yy97:
return 1; return 1;
} }
#line 1274 "ext/standard/var_unserializer.c" #line 1278 "ext/standard/var_unserializer.c"
} }
#line 826 "ext/standard/var_unserializer.re" #line 830 "ext/standard/var_unserializer.re"
return 0; return 0;

View File

@ -400,7 +400,11 @@ static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
(*p) += 2; (*p) += 2;
if (ce->serialize == NULL) { /* The internal class check here is a BC fix only, userspace classes implementing the
Serializable interface have eventually an inconsistent behavior at this place when
unserialized from a manipulated string. Additionaly the interal classes can possibly
crash PHP so they're still disabled here. */
if (ce->serialize == NULL || ZEND_INTERNAL_CLASS != ce->type) {
object_init_ex(*rval, ce); object_init_ex(*rval, ce);
} else { } else {
/* If this class implements Serializable, it should not land here but in object_custom(). The passed string /* If this class implements Serializable, it should not land here but in object_custom(). The passed string