]> granicus.if.org Git - php/commitdiff
Fixed bug #42919 (Unserializing of namespaced class object fails)
authorDmitry Stogov <dmitry@php.net>
Wed, 17 Oct 2007 10:36:33 +0000 (10:36 +0000)
committerDmitry Stogov <dmitry@php.net>
Wed, 17 Oct 2007 10:36:33 +0000 (10:36 +0000)
NEWS
ext/standard/tests/serialize/bug42919.phpt [new file with mode: 0755]
ext/standard/var_unserializer.c
ext/standard/var_unserializer.re

diff --git a/NEWS b/NEWS
index 2957842c3a2a5f214d2402739328fa5cf44b4b67..2987f39a0ee73c6dc7b2eae36999f8ef11fc7e9d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,7 @@ PHP                                                                        NEWS
 - Improved and cleaned CGI code. FastCGI is now always enabled and can not be
   disabled. See sapi/cgi/CHANGES for more details. (Dmitry)
 
+- Fixed bug #42919 (Unserializing of namespaced class object fails). (Dmitry)
 - Fixed bug #42859 (import always conflicts with internal classes).
   (cellog@php.net, Dmitry)
 - Fixed bug #42820 (defined() on constant with namespace prefixes tries to load
diff --git a/ext/standard/tests/serialize/bug42919.phpt b/ext/standard/tests/serialize/bug42919.phpt
new file mode 100755 (executable)
index 0000000..11cb81d
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Bug #42919 (Unserializing of namespaced class object fails)
+--FILE--
+<?php
+namespace Foo;
+class Bar {
+}
+echo serialize(new Bar) . "\n";
+$x = unserialize(serialize(new Bar));
+echo get_class($x) . "\n";
+?>
+--EXPECT--
+O:8:"Foo::Bar":0:{}
+Foo::Bar
index 11bf3a5004fa3095a1a7e2de69c00a611c2cff9c..64a2e238b0d392dd94dc403aeff120821a3bc2e4 100644 (file)
@@ -581,7 +581,7 @@ yy20:
                return 0;
        }
 
-       len3 = strspn(class_name, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377");
+       len3 = strspn(class_name, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377:");
        if (len3 != len)
        {
                *p = YYCURSOR + len3 - len;
index 3800c67f2fef1b5d00c36ae31078424fcc6daf55..7356e2406e5bd61de834d4d5c71b04d369b656d2 100644 (file)
@@ -617,7 +617,7 @@ object ":" uiv ":" ["]      {
                return 0;
        }
 
-       len3 = strspn(class_name, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377");
+       len3 = strspn(class_name, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377:");
        if (len3 != len)
        {
                *p = YYCURSOR + len3 - len;