helly Mon Feb 4 16:47:06 2008 UTC
Modified files:
/php-src/ext/spl spl_array.c
/php-src/ext/spl/tests array_023.phpt bug41528.phpt bug42654.phpt
bug42703.phpt spl_autoload_001.phpt
spl_autoload_007.phpt spl_autoload_008.phpt
Log:
- Fix ArrayObject serializing
- Fix test expectations
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.136&r2=1.137&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.136 php-src/ext/spl/spl_array.c:1.137
--- php-src/ext/spl/spl_array.c:1.136 Mon Dec 31 07:12:14 2007
+++ php-src/ext/spl/spl_array.c Mon Feb 4 16:47:06 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.c,v 1.136 2007/12/31 07:12:14 sebastian Exp $ */
+/* $Id: spl_array.c,v 1.137 2008/02/04 16:47:06 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1483,16 +1483,14 @@
{
spl_array_object *intern =
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- zstr buf;
- unsigned int buf_len;
- UChar *p, *s;
- zend_uchar buf_type;
-
+ char *buf;
+ int buf_len;
+ const unsigned char *p, *s;
php_unserialize_data_t var_hash;
zval *pentry, *pmembers, *pflags = NULL;
long flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &buf,
&buf_len, &buf_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf,
&buf_len) == FAILURE) {
return;
}
@@ -1501,8 +1499,7 @@
return;
}
- s = p = (buf_type == IS_UNICODE ? buf.u : (UChar *)buf.s);
-
+ s = p = (const unsigned char*)buf;
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (*p!= 'x' || *++p != ':') {
@@ -1569,7 +1566,7 @@
outexcept:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
"Error at offset %ld of %d bytes", (long)((char*)p - (long)(buf_type ==
IS_UNICODE ? buf.u : (UChar *)buf.s)), buf_len);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
"Error at offset %ld of %d bytes", (long)((char*)p - (long)buf), buf_len);
return;
} /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/array_023.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/spl/tests/array_023.phpt
diff -u php-src/ext/spl/tests/array_023.phpt:1.2
php-src/ext/spl/tests/array_023.phpt:1.3
--- php-src/ext/spl/tests/array_023.phpt:1.2 Fri Dec 14 04:49:47 2007
+++ php-src/ext/spl/tests/array_023.phpt Mon Feb 4 16:47:06 2008
@@ -19,14 +19,14 @@
var_dump($a);
var_dump($a->var);
-class Sláinte extends ArrayObject
+class Bla extends ArrayObject
{
- public $var = 'tá';
- protected $bar = 'trÃ';
- private $foo = 'å¹´';
+ public $var = 'aaa';
+ protected $bar = 'bbb';
+ private $foo = 'ccc';
}
-$a = new Sláinte();
+$a = new Bla();
var_dump($a);
var_dump($a->var);
@@ -61,27 +61,76 @@
}
}
string(1) "a"
-object(Sláinte)#1 (4) {
+object(Bla)#1 (4) {
["var"]=>
- string(3) "tá"
+ string(3) "aaa"
["bar":protected]=>
- string(4) "trÃ"
- ["foo":"Sláinte":private]=>
- string(3) "å¹´"
+ string(3) "bbb"
+ ["foo":"Bla":private]=>
+ string(3) "ccc"
["storage":"ArrayObject":private]=>
array(0) {
}
}
-string(3) "tá"
-object(Sláinte)#2 (4) {
+string(3) "aaa"
+object(Bla)#2 (4) {
["var"]=>
- string(3) "tá"
+ string(3) "aaa"
["bar":protected]=>
- string(4) "trÃ"
- ["foo":"Sláinte":private]=>
- string(3) "å¹´"
+ string(3) "bbb"
+ ["foo":"Bla":private]=>
+ string(3) "ccc"
["storage":"ArrayObject":private]=>
array(0) {
}
}
-string(3) "tá"
+string(3) "aaa"
+--UEXPECT--
+object(Name)#1 (4) {
+ [u"var"]=>
+ unicode(1) "a"
+ [u"bar":protected]=>
+ unicode(1) "b"
+ [u"foo":u"Name":private]=>
+ unicode(1) "c"
+ [u"storage":u"ArrayObject":private]=>
+ array(0) {
+ }
+}
+unicode(1) "a"
+object(Name)#2 (4) {
+ [u"var"]=>
+ unicode(1) "a"
+ [u"bar":protected]=>
+ unicode(1) "b"
+ [u"foo":u"Name":private]=>
+ unicode(1) "c"
+ [u"storage":u"ArrayObject":private]=>
+ array(0) {
+ }
+}
+unicode(1) "a"
+object(Bla)#1 (4) {
+ [u"var"]=>
+ unicode(3) "aaa"
+ [u"bar":protected]=>
+ unicode(3) "bbb"
+ [u"foo":u"Bla":private]=>
+ unicode(3) "ccc"
+ [u"storage":u"ArrayObject":private]=>
+ array(0) {
+ }
+}
+unicode(3) "aaa"
+object(Bla)#2 (4) {
+ [u"var"]=>
+ unicode(3) "aaa"
+ [u"bar":protected]=>
+ unicode(3) "bbb"
+ [u"foo":u"Bla":private]=>
+ unicode(3) "ccc"
+ [u"storage":u"ArrayObject":private]=>
+ array(0) {
+ }
+}
+unicode(3) "aaa"
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug41528.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/spl/tests/bug41528.phpt
diff -u php-src/ext/spl/tests/bug41528.phpt:1.2
php-src/ext/spl/tests/bug41528.phpt:1.3
--- php-src/ext/spl/tests/bug41528.phpt:1.2 Fri Dec 14 04:23:09 2007
+++ php-src/ext/spl/tests/bug41528.phpt Mon Feb 4 16:47:06 2008
@@ -35,3 +35,20 @@
}
}
int(1)
+--UEXPECT--
+object(ClassOne)#1 (2) {
+ [u"a"]=>
+ int(1)
+ [u"storage":u"ArrayObject":private]=>
+ array(0) {
+ }
+}
+int(1)
+object(ClassOne)#2 (2) {
+ [u"a"]=>
+ int(1)
+ [u"storage":u"ArrayObject":private]=>
+ array(0) {
+ }
+}
+int(1)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42654.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/spl/tests/bug42654.phpt
diff -u php-src/ext/spl/tests/bug42654.phpt:1.2
php-src/ext/spl/tests/bug42654.phpt:1.3
--- php-src/ext/spl/tests/bug42654.phpt:1.2 Thu Oct 18 05:09:49 2007
+++ php-src/ext/spl/tests/bug42654.phpt Mon Feb 4 16:47:06 2008
@@ -156,3 +156,138 @@
[4]=>
string(5) "alter"
}
+--UEXPECTF--
+update 1
+object(RecursiveArrayIterator)#%d (1) {
+ [u"storage":u"ArrayIterator":private]=>
+ array(3) {
+ [1]=>
+ unicode(4) "val1"
+ [2]=>
+ array(2) {
+ [2]=>
+ unicode(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ unicode(4) "val3"
+ }
+ }
+ [4]=>
+ unicode(4) "val4"
+ }
+}
+object(RecursiveArrayIterator)#%d (1) {
+ [u"storage":u"ArrayIterator":private]=>
+ array(3) {
+ [1]=>
+ unicode(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ unicode(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ unicode(4) "val3"
+ }
+ }
+ [4]=>
+ unicode(4) "val4"
+ }
+}
+update 2
+object(RecursiveArrayIterator)#%d (1) {
+ [u"storage":u"ArrayIterator":private]=>
+ array(2) {
+ [2]=>
+ unicode(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ unicode(4) "val3"
+ }
+ }
+}
+object(RecursiveArrayIterator)#%d (1) {
+ [u"storage":u"ArrayIterator":private]=>
+ array(2) {
+ [2]=>
+ unicode(5) "alter"
+ [3]=>
+ array(1) {
+ [3]=>
+ unicode(4) "val3"
+ }
+ }
+}
+update 3
+object(RecursiveArrayIterator)#%d (1) {
+ [u"storage":u"ArrayIterator":private]=>
+ array(1) {
+ [3]=>
+ unicode(4) "val3"
+ }
+}
+object(RecursiveArrayIterator)#%d (1) {
+ [u"storage":u"ArrayIterator":private]=>
+ array(1) {
+ [3]=>
+ unicode(5) "alter"
+ }
+}
+update 4
+object(RecursiveArrayIterator)#%d (1) {
+ [u"storage":u"ArrayIterator":private]=>
+ array(3) {
+ [1]=>
+ unicode(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ unicode(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ unicode(4) "val3"
+ }
+ }
+ [4]=>
+ unicode(4) "val4"
+ }
+}
+object(RecursiveArrayIterator)#%d (1) {
+ [u"storage":u"ArrayIterator":private]=>
+ array(3) {
+ [1]=>
+ unicode(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ unicode(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ unicode(4) "val3"
+ }
+ }
+ [4]=>
+ unicode(5) "alter"
+ }
+}
+array(3) {
+ [1]=>
+ unicode(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ unicode(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ unicode(4) "val3"
+ }
+ }
+ [4]=>
+ unicode(5) "alter"
+}
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42703.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/spl/tests/bug42703.phpt
diff -u php-src/ext/spl/tests/bug42703.phpt:1.2
php-src/ext/spl/tests/bug42703.phpt:1.3
--- php-src/ext/spl/tests/bug42703.phpt:1.2 Thu Oct 18 05:09:49 2007
+++ php-src/ext/spl/tests/bug42703.phpt Mon Feb 4 16:47:06 2008
@@ -35,7 +35,11 @@
var_dump($itit->current());
var_dump($itit->key());
?>
---EXPECTF--
+--EXPECT--
string(3) "boo"
NULL
NULL
+--UEXPECT--
+unicode(3) "boo"
+NULL
+NULL
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_001.phpt?r1=1.7&r2=1.8&diff_format=u
Index: php-src/ext/spl/tests/spl_autoload_001.phpt
diff -u php-src/ext/spl/tests/spl_autoload_001.phpt:1.7
php-src/ext/spl/tests/spl_autoload_001.phpt:1.8
--- php-src/ext/spl/tests/spl_autoload_001.phpt:1.7 Mon Feb 4 14:02:01 2008
+++ php-src/ext/spl/tests/spl_autoload_001.phpt Mon Feb 4 16:47:06 2008
@@ -134,7 +134,7 @@
%stestclass.class.inc
bool(true)
===NOFUNCTION===
-Exception: Function 'unavailable_autoload_function' not found, (function
'unavailable_autoload_function' not found or invalid function name)
+Exception: Function 'unavailable_autoload_function' not found (function
'unavailable_autoload_function' not found or invalid function name)
===DONE===
--UEXPECTF--
===EMPTY===
@@ -165,5 +165,5 @@
%stestclass.class.inc
bool(true)
===NOFUNCTION===
-Exception: Function 'unavailable_autoload_function' not found, (function
'unavailable_autoload_function' not found or invalid function name)
+Exception: Function 'unavailable_autoload_function' not found (function
'unavailable_autoload_function' not found or invalid function name)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_007.phpt?r1=1.5&r2=1.6&diff_format=u
Index: php-src/ext/spl/tests/spl_autoload_007.phpt
diff -u php-src/ext/spl/tests/spl_autoload_007.phpt:1.5
php-src/ext/spl/tests/spl_autoload_007.phpt:1.6
--- php-src/ext/spl/tests/spl_autoload_007.phpt:1.5 Mon Feb 4 14:02:01 2008
+++ php-src/ext/spl/tests/spl_autoload_007.phpt Mon Feb 4 16:47:06 2008
@@ -59,16 +59,16 @@
<?php exit(0); ?>
--EXPECTF--
string(22) "MyAutoLoader::notExist"
-Function 'MyAutoLoader::notExist' not found, (class 'MyAutoLoader' does not
have a method 'notexist')
+Function 'MyAutoLoader::notExist' not found (class 'MyAutoLoader' does not
have a method 'notexist')
string(22) "MyAutoLoader::noAccess"
-Function 'MyAutoLoader::noAccess' not callable, (cannot access protected
method MyAutoLoader::noAccess())
+Function 'MyAutoLoader::noAccess' not callable (cannot access protected method
MyAutoLoader::noAccess())
string(22) "MyAutoLoader::autoLoad"
ok
string(22) "MyAutoLoader::dynaLoad"
-Function 'MyAutoLoader::dynaLoad' not callable, (non-static method
MyAutoLoader::dynaLoad() should not be called statically)
+Function 'MyAutoLoader::dynaLoad' not callable (non-static method
MyAutoLoader::dynaLoad() should not be called statically)
array(2) {
[0]=>
@@ -140,16 +140,16 @@
===DONE===
--UEXPECTF--
unicode(22) "MyAutoLoader::notExist"
-Function 'MyAutoLoader::notExist' not found, (class 'MyAutoLoader' does not
have a method 'notexist')
+Function 'MyAutoLoader::notExist' not found (class 'MyAutoLoader' does not
have a method 'notexist')
unicode(22) "MyAutoLoader::noAccess"
-Function 'MyAutoLoader::noAccess' not callable, (cannot access protected
method MyAutoLoader::noAccess())
+Function 'MyAutoLoader::noAccess' not callable (cannot access protected method
MyAutoLoader::noAccess())
unicode(22) "MyAutoLoader::autoLoad"
ok
unicode(22) "MyAutoLoader::dynaLoad"
-Function 'MyAutoLoader::dynaLoad' not callable, (non-static method
MyAutoLoader::dynaLoad() should not be called statically)
+Function 'MyAutoLoader::dynaLoad' not callable (non-static method
MyAutoLoader::dynaLoad() should not be called statically)
array(2) {
[0]=>
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_008.phpt?r1=1.5&r2=1.6&diff_format=u
Index: php-src/ext/spl/tests/spl_autoload_008.phpt
diff -u php-src/ext/spl/tests/spl_autoload_008.phpt:1.5
php-src/ext/spl/tests/spl_autoload_008.phpt:1.6
--- php-src/ext/spl/tests/spl_autoload_008.phpt:1.5 Mon Feb 4 15:43:09 2008
+++ php-src/ext/spl/tests/spl_autoload_008.phpt Mon Feb 4 16:47:06 2008
@@ -82,7 +82,7 @@
int(0)
====2====
string(22) "MyAutoLoader::dynaLoad"
-LogicException: Function 'MyAutoLoader::dynaLoad' not callable, (non-static
method MyAutoLoader::dynaLoad() should not be called statically)
+LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static
method MyAutoLoader::dynaLoad() should not be called statically)
int(0)
====3====
array(2) {
@@ -144,7 +144,7 @@
int(0)
====2====
unicode(22) "MyAutoLoader::dynaLoad"
-LogicException: Function 'MyAutoLoader::dynaLoad' not callable, (non-static
method MyAutoLoader::dynaLoad() should not be called statically)
+LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static
method MyAutoLoader::dynaLoad() should not be called statically)
int(0)
====3====
array(2) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php