[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] cvs: php-src /ext/spl spl_array.c  /ext/spl/tests array_025.phpt
From:       "Etienne Kneuss" <colder () php ! net>
Date:       2008-09-29 22:42:49
Message-ID: cvscolder1222728169 () cvsserver
[Download RAW message or body]

colder		Mon Sep 29 22:42:49 2008 UTC

  Added files:                 
    /php-src/ext/spl/tests	array_025.phpt 

  Modified files:              
    /php-src/ext/spl	spl_array.c 
  Log:
  Fix #46192 (Serialization of ArrayObject with objects as storage)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.149&r2=1.150&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.149 php-src/ext/spl/spl_array.c:1.150
--- php-src/ext/spl/spl_array.c:1.149	Fri Sep 19 12:48:45 2008
+++ php-src/ext/spl/spl_array.c	Mon Sep 29 22:42:48 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_array.c,v 1.149 2008/09/19 12:48:45 dmitry Exp $ */
+/* $Id: spl_array.c,v 1.150 2008/09/29 22:42:48 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1594,7 +1594,7 @@
 	++p;
 
 	if (*p!='m') {
-		if (*p!='a') {
+		if (*p!='a' && *p!='O' && *p!='C') {
 			goto outexcept;
 		}
 		intern->ar_flags &= ~SPL_ARRAY_CLONE_MASK;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/array_025.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/array_025.phpt
+++ php-src/ext/spl/tests/array_025.phpt
--TEST--
SPL: ArrayObject serialize with an object as storage
--FILE--
<?php
$obj1 = new ArrayObject(new ArrayObject(array(1,2)));
$s = serialize($obj1);
$obj2 = unserialize($s);

print_r($obj1);
echo "$s\n";
print_r($obj2);
?>
--EXPECT--
ArrayObject Object
(
    [storage:ArrayObject:private] => ArrayObject Object
        (
            [storage:ArrayObject:private] => Array
                (
                    [0] => 1
                    [1] => 2
                )

        )

)
C:11:"ArrayObject":76:{x:i:0;C:11:"ArrayObject":37:{x:i:0;a:2:{i:0;i:1;i:1;i:2;};m:a:0:{}};m:a:0:{}}
ArrayObject Object
(
    [storage:ArrayObject:private] => ArrayObject Object
        (
            [storage:ArrayObject:private] => Array
                (
                    [0] => 1
                    [1] => 2
                )

        )

)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic