mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
- Fix tests
- Update README.PARAMETER_PARSING_API
This commit is contained in:
parent
b489251177
commit
a541bb8078
@ -31,28 +31,38 @@ resources cannot be auto-converted.
|
||||
|
||||
Type specifiers
|
||||
---------------
|
||||
a - array
|
||||
b - boolean, stored in zend_bool
|
||||
d - double
|
||||
f - function or array containing php method call info (returned as
|
||||
zend_fcall_info* and zend_fcall_info_cache*)
|
||||
h - array (returned as HashTable*)
|
||||
l - long
|
||||
o - object (of any type)
|
||||
O - object (of specific type, specified by class entry)
|
||||
r - resource (stored in zval)
|
||||
s - string (with possible null bytes) and its length
|
||||
z - the actual zval
|
||||
The following list shows the type specifier, its meaning and the parameter
|
||||
types that need to be passed by address. All passed paramaters are set
|
||||
if the PHP parameter is non optional and untouched if optional and the
|
||||
parameter is not present. The only exception is O where the zend_class_entry*
|
||||
has to be provided on input and is used to verify the PHP parameter is an
|
||||
instance of that class.
|
||||
|
||||
a - array (zval*)
|
||||
b - boolean (zend_bool)
|
||||
C - class (zend_class_entry*)
|
||||
d - double (double)
|
||||
f - function or array containing php method call info (returned as
|
||||
zend_fcall_info and zend_fcall_info_cache)
|
||||
h - array (returned as HashTable*)
|
||||
l - long (long)
|
||||
o - object of any type (zval*)
|
||||
O - object of specific type given by class entry (zval*, zend_class_entry)
|
||||
r - resource (zval*)
|
||||
s - string (with possible null bytes) and its length (char*, int)
|
||||
z - the actual zval (zval*)
|
||||
Z - the actual zval (zval**)
|
||||
* - variable arguments list
|
||||
|
||||
The following characters also have a meaning in the specifier string:
|
||||
| - indicates that the remaining parameters are optional, they
|
||||
should be initialized to default values by the extension since they
|
||||
will not be touched by the parsing function if they are not
|
||||
passed to it.
|
||||
/ - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows
|
||||
! - the parameter it follows can be of specified type or NULL (only applies
|
||||
to 's', 'a', 'o', 'O', 'r', 'h', 'C', 'z', and 'Z'). If NULL is passed,
|
||||
the results pointer is set to NULL as well.
|
||||
| - indicates that the remaining parameters are optional, they
|
||||
should be initialized to default values by the extension since they
|
||||
will not be touched by the parsing function if they are not
|
||||
passed to it.
|
||||
/ - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows
|
||||
! - the parameter it follows can be of specified type or NULL (applies
|
||||
to all specifiers except for 'b', 'l', and 'd'). If NULL is passed, the
|
||||
results pointer is set to NULL as well.
|
||||
|
||||
Examples
|
||||
--------
|
||||
@ -62,8 +72,8 @@ char *s;
|
||||
int s_len;
|
||||
zval *param;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
|
||||
&l, &s, &s_len, ¶m) == FAILURE) {
|
||||
return;
|
||||
&l, &s, &s_len, ¶m) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -72,8 +82,8 @@ zval *obj;
|
||||
double d = 0.5;
|
||||
zend_class_entry *my_ce;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
|
||||
&obj, my_ce, &d) == FAILURE) {
|
||||
return;
|
||||
&obj, my_ce, &d) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -82,29 +92,18 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
|
||||
zval *obj;
|
||||
zval *arr;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a",
|
||||
&obj, &arr) == FAILURE) {
|
||||
return;
|
||||
&obj, &arr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Gets a separated array which can also be null. */
|
||||
zval *arr;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
|
||||
&arr) == FAILURE) {
|
||||
return;
|
||||
&arr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Get only the first three parameters (useful for varargs functions). */
|
||||
zval *z;
|
||||
zend_bool b;
|
||||
zval *r;
|
||||
if (zend_parse_parameters(3 TSRMLS_CC, "zbr!",
|
||||
&z, &b, &r) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Get either a set of 3 longs or a string. */
|
||||
long l1, l2, l3;
|
||||
char *s;
|
||||
@ -118,13 +117,72 @@ char *s;
|
||||
int length;
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"lll", &l1, &l2, &l3) == SUCCESS) {
|
||||
/* manipulate longs */
|
||||
"lll", &l1, &l2, &l3) == SUCCESS) {
|
||||
/* manipulate longs */
|
||||
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"s", &s, &length) == SUCCESS) {
|
||||
/* manipulate string */
|
||||
"s", &s, &length) == SUCCESS) {
|
||||
/* manipulate string */
|
||||
} else {
|
||||
/* output error */
|
||||
/* output error */
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Function that accepts only varargs (0 or more) */
|
||||
|
||||
int i, num_varargs;
|
||||
zval ***varargs = NULL;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &varargs, &num_varargs) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_varargs; i++) {
|
||||
/* do something with varargs[i] */
|
||||
}
|
||||
|
||||
if (varargs) {
|
||||
efree(varargs);
|
||||
}
|
||||
|
||||
|
||||
/* Function that accepts a string, followed by varargs (1 or more) */
|
||||
|
||||
char *str;
|
||||
int str_len;
|
||||
int i, num_varargs;
|
||||
zval ***varargs = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_varargs; i++) {
|
||||
/* do something with varargs[i] */
|
||||
}
|
||||
|
||||
if (varargs) {
|
||||
efree(varargs);
|
||||
}
|
||||
|
||||
|
||||
/* Function that takes an array, followed by varargs, and ending with a long */
|
||||
long num;
|
||||
zval *array;
|
||||
int i, num_varargs;
|
||||
zval ***varargs = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_varargs; i++) {
|
||||
/* do something with varargs[i] */
|
||||
}
|
||||
|
||||
if (varargs) {
|
||||
efree(varargs);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,5 @@ array_walk($array, array($nonesuchvar,'show'));
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: nonesuchvar in %s on line %d
|
||||
|
||||
Notice: Non-callable array passed to zend_call_function() in %s on line %d
|
||||
|
||||
Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d
|
||||
Warning: array_walk() expects parameter 2 to be valid callback, array given in %s on line %d
|
||||
===DONE===
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Bug #32290 (calling call_user_func_array() ends in infinite loop within child class)
|
||||
--INI--
|
||||
error_reporting=8191
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -98,9 +100,8 @@ var_dump($x->doSomethingStatic(1));
|
||||
===A===
|
||||
TestB::doSomething(1)
|
||||
|
||||
Strict Standards: Non-static method TestA::doSomething() cannot be called statically, assuming $this from compatible context TestB in %sbug32290.php on line %d
|
||||
TestA::doSomething(2)
|
||||
int(1)
|
||||
Warning: call_user_func_array() expects parameter 1 to be valid callback, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
===B===
|
||||
TestB::doSomethingThis(1)
|
||||
@ -110,9 +111,8 @@ int(1)
|
||||
===C===
|
||||
TestB::doSomethingParent(1)
|
||||
|
||||
Strict Standards: Non-static method TestA::doSomethingParent() cannot be called statically, assuming $this from compatible context TestB in %sbug32290.php on line %d
|
||||
TestA::doSomethingParent(2)
|
||||
int(1)
|
||||
Warning: call_user_func_array() expects parameter 1 to be valid callback, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
===D===
|
||||
TestB::doSomethingParentThis(1)
|
||||
|
@ -33,7 +33,7 @@ $ctx->comment_preview[0] = 1;
|
||||
$ctx->comment_preview[1] = 2;
|
||||
var_dump($ctx->comment_preview);
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
@ -46,9 +46,12 @@ array(2) {
|
||||
[1]=>
|
||||
int(2)
|
||||
}
|
||||
object(ArrayObject)#2 (2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
object(ArrayObject)#%d (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
}
|
||||
}
|
||||
|
@ -41,15 +41,15 @@ var_dump($B);
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(B)#%d (1) {
|
||||
["value:protected"]=>
|
||||
["value":protected]=>
|
||||
string(1) "B"
|
||||
}
|
||||
object(C)#%d (1) {
|
||||
["value:protected"]=>
|
||||
["value":protected]=>
|
||||
string(1) "C"
|
||||
}
|
||||
object(B)#%d (1) {
|
||||
["value:protected"]=>
|
||||
["value":protected]=>
|
||||
string(1) "C"
|
||||
}
|
||||
===DONE===
|
||||
|
@ -33,7 +33,7 @@ string(3) "bar"
|
||||
Notice: Undefined offset: 2 in %sbug37667.php on line 16
|
||||
NULL
|
||||
object(Test)#%d (1) {
|
||||
["property:protected"]=>
|
||||
["property":protected]=>
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
string(3) "bar"
|
||||
@ -44,7 +44,7 @@ Notice: Indirect modification of overloaded property Test::$property has no effe
|
||||
|
||||
Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 21
|
||||
object(Test)#%d (1) {
|
||||
["property:protected"]=>
|
||||
["property":protected]=>
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
string(3) "bar"
|
||||
|
@ -22,15 +22,15 @@ $rootNode->appendChild($rootNode);
|
||||
--EXPECTF--
|
||||
--- Catch exception with try/catch
|
||||
object(DOMException)#%d (6) {
|
||||
["message:protected"]=>
|
||||
["message":protected]=>
|
||||
string(23) "Hierarchy Request Error"
|
||||
["string:private"]=>
|
||||
["string":"Exception":private]=>
|
||||
string(0) ""
|
||||
["file:protected"]=>
|
||||
["file":protected]=>
|
||||
string(%d) "%sdom003.php"
|
||||
["line:protected"]=>
|
||||
["line":protected]=>
|
||||
int(8)
|
||||
["trace:private"]=>
|
||||
["trace":"Exception":private]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(6) {
|
||||
|
@ -32,15 +32,15 @@ try {
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(DOMException)#%d (6) {
|
||||
["message:protected"]=>
|
||||
["message":protected]=>
|
||||
string(20) "Wrong Document Error"
|
||||
["string:private"]=>
|
||||
["string":"Exception":private]=>
|
||||
string(0) ""
|
||||
["file:protected"]=>
|
||||
["file":protected]=>
|
||||
string(%d) "%sdom_set_attr_node.php"
|
||||
["line:protected"]=>
|
||||
["line":protected]=>
|
||||
int(%d)
|
||||
["trace:private"]=>
|
||||
["trace":"Exception":private]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(6) {
|
||||
|
@ -38,11 +38,14 @@ var_dump($ar);
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
object(ArrayObject)#1 (2) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[1]=>
|
||||
int(1)
|
||||
object(ArrayObject)#1 (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[1]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
int(2)
|
||||
int(3)
|
||||
@ -61,17 +64,20 @@ array(6) {
|
||||
int(5)
|
||||
}
|
||||
string(1) "a"
|
||||
object(ArrayObject)#1 (5) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[1]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
int(2)
|
||||
[3]=>
|
||||
int(3)
|
||||
["a"]=>
|
||||
string(1) "a"
|
||||
object(ArrayObject)#1 (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[1]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
int(2)
|
||||
[3]=>
|
||||
int(3)
|
||||
["a"]=>
|
||||
string(1) "a"
|
||||
}
|
||||
}
|
||||
int(0)
|
||||
|
||||
@ -84,20 +90,26 @@ NULL
|
||||
Notice: Undefined offset: 7 in %sarray_001.php on line %d
|
||||
|
||||
Notice: Undefined index: c in %sarray_001.php on line %d
|
||||
object(ArrayObject)#1 (2) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[2]=>
|
||||
int(2)
|
||||
object(ArrayObject)#1 (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[2]=>
|
||||
int(2)
|
||||
}
|
||||
}
|
||||
object(ArrayObject)#1 (4) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[2]=>
|
||||
int(2)
|
||||
[4]=>
|
||||
string(1) "3"
|
||||
[5]=>
|
||||
int(4)
|
||||
object(ArrayObject)#1 (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[2]=>
|
||||
int(2)
|
||||
[4]=>
|
||||
string(1) "3"
|
||||
[5]=>
|
||||
int(4)
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
@ -22,16 +22,22 @@ var_dump($arrayObject);
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
object(ArrayObject)#%d (5) {
|
||||
[1]=>
|
||||
string(3) "one"
|
||||
[2]=>
|
||||
string(3) "two"
|
||||
[3]=>
|
||||
string(5) "three"
|
||||
[4]=>
|
||||
string(4) "four"
|
||||
[5]=>
|
||||
string(4) "five"
|
||||
object(ArrayObject)#%d (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
object(ArrayObject)#1 (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(5) {
|
||||
[1]=>
|
||||
string(3) "one"
|
||||
[2]=>
|
||||
string(3) "two"
|
||||
[3]=>
|
||||
string(5) "three"
|
||||
[4]=>
|
||||
string(4) "four"
|
||||
[5]=>
|
||||
string(4) "five"
|
||||
}
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
@ -43,17 +43,21 @@ test Object
|
||||
(
|
||||
[pub] => public
|
||||
[pro:protected] => protected
|
||||
[pri:private] => private
|
||||
[pri:test:private] => private
|
||||
[imp] => implicit
|
||||
[dyn] => dynamic
|
||||
)
|
||||
ArrayObject Object
|
||||
(
|
||||
[pub] => public
|
||||
[pro:protected] => protected
|
||||
[pri:private] => private
|
||||
[imp] => implicit
|
||||
[dyn] => dynamic
|
||||
[storage:ArrayObject:private] => test Object
|
||||
(
|
||||
[pub] => public
|
||||
[pro:protected] => protected
|
||||
[pri:test:private] => private
|
||||
[imp] => implicit
|
||||
[dyn] => dynamic
|
||||
)
|
||||
|
||||
)
|
||||
pub => public
|
||||
imp => implicit
|
||||
|
@ -3,7 +3,7 @@ SPL: ArrayIterator
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("spl")) print "skip"; ?>
|
||||
--INI--
|
||||
allow_call_time_pass_reference=1
|
||||
error_reporting=2047
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -3,7 +3,7 @@ SPL: ArrayIterator without ArrayObject
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("spl")) print "skip"; ?>
|
||||
--INI--
|
||||
allow_call_time_pass_reference=1
|
||||
error_reporting=2047
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -47,17 +47,25 @@ test Object
|
||||
(
|
||||
[pub] => public
|
||||
[pro:protected] => protected
|
||||
[pri:private] => private
|
||||
[pri:test:private] => private
|
||||
[imp] => implicit
|
||||
[dyn] => dynamic
|
||||
)
|
||||
ArrayIterator Object
|
||||
(
|
||||
[pub] => public
|
||||
[pro:protected] => protected
|
||||
[pri:private] => private
|
||||
[imp] => implicit
|
||||
[dyn] => dynamic
|
||||
[storage:ArrayIterator:private] => ArrayObject Object
|
||||
(
|
||||
[storage:ArrayObject:private] => test Object
|
||||
(
|
||||
[pub] => public
|
||||
[pro:protected] => protected
|
||||
[pri:test:private] => private
|
||||
[imp] => implicit
|
||||
[dyn] => dynamic
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
pub => public
|
||||
imp => implicit
|
||||
|
@ -3,7 +3,7 @@ SPL: ArrayIterator and foreach reference
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("spl")) print "skip"; ?>
|
||||
--INI--
|
||||
allow_call_time_pass_reference=1
|
||||
error_reporting=2047
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -43,38 +43,47 @@ var_dump($ar);
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
object(ArrayObject)#%d (5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
object(ArrayObject)#%d (1) {
|
||||
%s"storage"%s"ArrayObject":private]=>
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
}
|
||||
|
||||
Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_015.php on line %d
|
||||
int(2)
|
||||
object(ArrayObject)#%d (4) {
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
object(ArrayObject)#%d (1) {
|
||||
%s"storage"%s"ArrayObject":private]=>
|
||||
array(4) {
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
}
|
||||
1=>2
|
||||
3=>4
|
||||
object(ArrayObject)#%d (2) {
|
||||
[1]=>
|
||||
int(2)
|
||||
[3]=>
|
||||
int(4)
|
||||
object(ArrayObject)#%d (1) {
|
||||
%s"storage"%s"ArrayObject":private]=>
|
||||
array(2) {
|
||||
[1]=>
|
||||
int(2)
|
||||
[3]=>
|
||||
int(4)
|
||||
}
|
||||
}
|
||||
1=>2
|
||||
|
||||
@ -82,6 +91,9 @@ Notice: main(): ArrayIterator::next(): Array was modified outside object and int
|
||||
3=>4
|
||||
|
||||
Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_015.php on line %d
|
||||
object(ArrayObject)#%d (0) {
|
||||
object(ArrayObject)#%d (1) {
|
||||
%s"storage"%s"ArrayObject":private]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
@ -148,13 +148,26 @@ array(3) {
|
||||
int(42)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayObjectEx)#1 (3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["a"]=>
|
||||
int(25)
|
||||
object(ArrayObjectEx)#%d (6) {
|
||||
["pub1"]=>
|
||||
int(42)
|
||||
int(1)
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["a"]=>
|
||||
int(25)
|
||||
["pub1"]=>
|
||||
int(42)
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayObjectEx::show()
|
||||
@ -172,13 +185,39 @@ array(3) {
|
||||
int(42)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayIteratorEx)#2 (3) {
|
||||
[0]=>
|
||||
object(ArrayIteratorEx)#%d (6) {
|
||||
["pub2"]=>
|
||||
int(1)
|
||||
["a"]=>
|
||||
int(25)
|
||||
["pub1"]=>
|
||||
int(42)
|
||||
["pro2":protected]=>
|
||||
int(2)
|
||||
["pri2":"ArrayIteratorEx":private]=>
|
||||
int(3)
|
||||
["imp2"]=>
|
||||
int(4)
|
||||
["dyn2"]=>
|
||||
int(5)
|
||||
["storage":"ArrayIterator":private]=>
|
||||
object(ArrayObjectEx)#%d (6) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["a"]=>
|
||||
int(25)
|
||||
["pub1"]=>
|
||||
int(42)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
@ -208,13 +247,39 @@ array(3) {
|
||||
int(42)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayIteratorEx)#3 (3) {
|
||||
[0]=>
|
||||
object(ArrayIteratorEx)#%d (6) {
|
||||
["pub2"]=>
|
||||
int(1)
|
||||
["a"]=>
|
||||
int(25)
|
||||
["pub1"]=>
|
||||
int(42)
|
||||
["pro2":protected]=>
|
||||
int(2)
|
||||
["pri2":"ArrayIteratorEx":private]=>
|
||||
int(3)
|
||||
["imp2"]=>
|
||||
int(4)
|
||||
["dyn2"]=>
|
||||
int(5)
|
||||
["storage":"ArrayIterator":private]=>
|
||||
object(ArrayObjectEx)#%d (6) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["a"]=>
|
||||
int(25)
|
||||
["pub1"]=>
|
||||
int(42)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
@ -260,17 +325,26 @@ array(3) {
|
||||
int(5)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayObjectEx)#1 (5) {
|
||||
object(ArrayObjectEx)#%d (6) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1:protected"]=>
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1:private"]=>
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["a"]=>
|
||||
int(25)
|
||||
["pub1"]=>
|
||||
int(42)
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayObjectEx::show()
|
||||
@ -294,17 +368,39 @@ array(3) {
|
||||
int(5)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayIteratorEx)#3 (5) {
|
||||
object(ArrayIteratorEx)#%d (6) {
|
||||
["pub2"]=>
|
||||
int(1)
|
||||
["pro2:protected"]=>
|
||||
["pro2":protected]=>
|
||||
int(2)
|
||||
["pri2:private"]=>
|
||||
["pri2":"ArrayIteratorEx":private]=>
|
||||
int(3)
|
||||
["imp2"]=>
|
||||
int(4)
|
||||
["dyn2"]=>
|
||||
int(5)
|
||||
["storage":"ArrayIterator":private]=>
|
||||
object(ArrayObjectEx)#%d (6) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["a"]=>
|
||||
int(25)
|
||||
["pub1"]=>
|
||||
int(42)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
@ -340,17 +436,39 @@ array(3) {
|
||||
int(5)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayIteratorEx)#2 (5) {
|
||||
object(ArrayIteratorEx)#%d (6) {
|
||||
["pub2"]=>
|
||||
int(1)
|
||||
["pro2:protected"]=>
|
||||
["pro2":protected]=>
|
||||
int(2)
|
||||
["pri2:private"]=>
|
||||
["pri2":"ArrayIteratorEx":private]=>
|
||||
int(3)
|
||||
["imp2"]=>
|
||||
int(4)
|
||||
["dyn2"]=>
|
||||
int(5)
|
||||
["storage":"ArrayIterator":private]=>
|
||||
object(ArrayObjectEx)#%d (6) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["a"]=>
|
||||
int(25)
|
||||
["pub1"]=>
|
||||
int(42)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
@ -398,12 +516,12 @@ array(3) {
|
||||
int(5)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayObjectEx)#1 (5) {
|
||||
object(ArrayObjectEx)#%d (5) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1:protected"]=>
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1:private"]=>
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
@ -430,17 +548,30 @@ array(3) {
|
||||
int(5)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayIteratorEx)#2 (5) {
|
||||
["pub1"]=>
|
||||
object(ArrayIteratorEx)#%d (6) {
|
||||
["pub2"]=>
|
||||
int(1)
|
||||
["pro1:protected"]=>
|
||||
["pro2":protected]=>
|
||||
int(2)
|
||||
["pri1:private"]=>
|
||||
["pri2":"ArrayIteratorEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
["imp2"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
["dyn2"]=>
|
||||
int(5)
|
||||
["storage":"ArrayIterator":private]=>
|
||||
object(ArrayObjectEx)#%d (5) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
}
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
@ -474,17 +605,30 @@ array(3) {
|
||||
int(5)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayIteratorEx)#3 (5) {
|
||||
["pub1"]=>
|
||||
object(ArrayIteratorEx)#%d (6) {
|
||||
["pub2"]=>
|
||||
int(1)
|
||||
["pro1:protected"]=>
|
||||
["pro2":protected]=>
|
||||
int(2)
|
||||
["pri1:private"]=>
|
||||
["pri2":"ArrayIteratorEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
["imp2"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
["dyn2"]=>
|
||||
int(5)
|
||||
["storage":"ArrayIterator":private]=>
|
||||
object(ArrayObjectEx)#%d (5) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
}
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
@ -530,12 +674,12 @@ array(3) {
|
||||
int(5)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayObjectEx)#1 (5) {
|
||||
object(ArrayObjectEx)#%d (5) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1:protected"]=>
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1:private"]=>
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
@ -564,17 +708,30 @@ array(3) {
|
||||
int(5)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayIteratorEx)#3 (5) {
|
||||
object(ArrayIteratorEx)#%d (6) {
|
||||
["pub2"]=>
|
||||
int(1)
|
||||
["pro2:protected"]=>
|
||||
["pro2":protected]=>
|
||||
int(2)
|
||||
["pri2:private"]=>
|
||||
["pri2":"ArrayIteratorEx":private]=>
|
||||
int(3)
|
||||
["imp2"]=>
|
||||
int(4)
|
||||
["dyn2"]=>
|
||||
int(5)
|
||||
["storage":"ArrayIterator":private]=>
|
||||
object(ArrayObjectEx)#%d (5) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
}
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
@ -610,17 +767,30 @@ array(3) {
|
||||
int(5)
|
||||
}
|
||||
["$this"]=>
|
||||
object(ArrayIteratorEx)#2 (5) {
|
||||
object(ArrayIteratorEx)#%d (6) {
|
||||
["pub2"]=>
|
||||
int(1)
|
||||
["pro2:protected"]=>
|
||||
["pro2":protected]=>
|
||||
int(2)
|
||||
["pri2:private"]=>
|
||||
["pri2":"ArrayIteratorEx":private]=>
|
||||
int(3)
|
||||
["imp2"]=>
|
||||
int(4)
|
||||
["dyn2"]=>
|
||||
int(5)
|
||||
["storage":"ArrayIterator":private]=>
|
||||
object(ArrayObjectEx)#%d (5) {
|
||||
["pub1"]=>
|
||||
int(1)
|
||||
["pro1":protected]=>
|
||||
int(2)
|
||||
["pri1":"ArrayObjectEx":private]=>
|
||||
int(3)
|
||||
["imp1"]=>
|
||||
int(4)
|
||||
["dyn1"]=>
|
||||
int(5)
|
||||
}
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
|
@ -34,9 +34,15 @@ var_dump($foo);
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
string(44) "An offset must not begin with \0 or be empty"
|
||||
object(ArrayObject)#%d (0) {
|
||||
object(ArrayObject)#%d (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
string(44) "An offset must not begin with \0 or be empty"
|
||||
object(ArrayObject)#%d (0) {
|
||||
object(ArrayObject)#%d (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
@ -52,21 +52,31 @@ object(MyArrayObject)#%d (1) {
|
||||
["bar"]=>
|
||||
string(3) "baz"
|
||||
}
|
||||
object(MyArrayObject)#%d (2) {
|
||||
object(MyArrayObject)#%d (3) {
|
||||
["bar"]=>
|
||||
string(3) "baz"
|
||||
["baz"]=>
|
||||
string(3) "Foo"
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(1) {
|
||||
["bar"]=>
|
||||
string(3) "baz"
|
||||
}
|
||||
}
|
||||
==ArrayIterator===
|
||||
object(MyArrayIterator)#%d (1) {
|
||||
["bar"]=>
|
||||
string(3) "baz"
|
||||
}
|
||||
object(MyArrayIterator)#%d (2) {
|
||||
object(MyArrayIterator)#%d (3) {
|
||||
["bar"]=>
|
||||
string(3) "baz"
|
||||
["baz"]=>
|
||||
string(3) "Foo"
|
||||
["storage":"ArrayIterator":private]=>
|
||||
object(MyArrayIterator)#%d (1) {
|
||||
["bar"]=>
|
||||
string(3) "baz"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
@ -52,7 +52,7 @@ FooBar::offsetSet(2, 2)
|
||||
CAUGHT: FAIL
|
||||
FooBar Object
|
||||
(
|
||||
[array:private] => Array
|
||||
[array:FooBar:private] => Array
|
||||
(
|
||||
[0] => 0
|
||||
[1] => 1
|
||||
|
@ -66,9 +66,17 @@ Collection::offsetGet(foo)
|
||||
string(3) "baz"
|
||||
Collection Object
|
||||
(
|
||||
[0] => foo
|
||||
[1] => bar
|
||||
[foo] => baz
|
||||
[data:Collection:private] => Array
|
||||
(
|
||||
)
|
||||
|
||||
[storage:ArrayObject:private] => Array
|
||||
(
|
||||
[0] => foo
|
||||
[1] => bar
|
||||
[foo] => baz
|
||||
)
|
||||
|
||||
)
|
||||
int(3)
|
||||
===DONE===
|
||||
|
@ -13,9 +13,9 @@ foreach ($diriter as $key => $file) {
|
||||
break;
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
string(%d) "%s"
|
||||
Done
|
||||
===DONE===
|
||||
|
@ -11,15 +11,9 @@ $idx = 0;
|
||||
foreach($it as $file)
|
||||
{
|
||||
echo "First\n";
|
||||
if("." != $file && ".." != $file)
|
||||
{
|
||||
var_Dump($file->getFilename());
|
||||
}
|
||||
var_Dump($file->getFilename());
|
||||
echo "Second\n";
|
||||
if($file != "." && $file != "..")
|
||||
{
|
||||
var_dump($file->getFilename());
|
||||
}
|
||||
var_dump($file->getFilename());
|
||||
if (++$idx > 1)
|
||||
{
|
||||
break;
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Bug #40872 (inconsistency in offsetSet, offsetExists treatment of string enclosed integers)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("spl")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class Project {
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Bug #41692 (ArrayObject shows weird behaviour in respect to inheritance)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("spl")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -21,20 +23,44 @@ var_dump($bar);
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Bar)#%d (3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
object(Bar)#%d (2) {
|
||||
["foo":"Bar":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
}
|
||||
object(Bar)#%d (3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
object(Bar)#%d (2) {
|
||||
["foo":"Bar":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
}
|
||||
Done
|
||||
|
@ -6,13 +6,21 @@ Bug #42364 (Crash when using getRealPath with DirectoryIterator)
|
||||
<?php
|
||||
$it = new DirectoryIterator(dirname(__FILE__));
|
||||
|
||||
$count = 0;
|
||||
|
||||
foreach ($it as $e) {
|
||||
if (gettype($e->getRealPath()) != "string") {
|
||||
$count++;
|
||||
$type = gettype($e->getRealPath());
|
||||
if ($type != "string" && $type != "unicode") {
|
||||
echo $e->getFilename(), " is a ", gettype($e->getRealPath()), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($count > 0) {
|
||||
echo "Found $count entries!\n";
|
||||
}
|
||||
echo "===DONE==="
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Found %i entries!
|
||||
===DONE===
|
||||
|
@ -23,98 +23,122 @@ var_dump($copy);
|
||||
?>
|
||||
--EXPECTF--
|
||||
update 1
|
||||
object(RecursiveArrayIterator)#%d (3) {
|
||||
[1]=>
|
||||
string(4) "val1"
|
||||
[2]=>
|
||||
array(2) {
|
||||
object(RecursiveArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(3) {
|
||||
[1]=>
|
||||
string(4) "val1"
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
array(1) {
|
||||
array(2) {
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
}
|
||||
}
|
||||
[4]=>
|
||||
string(4) "val4"
|
||||
}
|
||||
[4]=>
|
||||
string(4) "val4"
|
||||
}
|
||||
object(RecursiveArrayIterator)#%d (3) {
|
||||
[1]=>
|
||||
string(5) "alter"
|
||||
[2]=>
|
||||
array(2) {
|
||||
object(RecursiveArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(3) {
|
||||
[1]=>
|
||||
string(5) "alter"
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
array(1) {
|
||||
array(2) {
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
}
|
||||
}
|
||||
[4]=>
|
||||
string(4) "val4"
|
||||
}
|
||||
[4]=>
|
||||
string(4) "val4"
|
||||
}
|
||||
update 2
|
||||
object(RecursiveArrayIterator)#%d (2) {
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
array(1) {
|
||||
object(RecursiveArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(2) {
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
}
|
||||
}
|
||||
}
|
||||
object(RecursiveArrayIterator)#%d (2) {
|
||||
[2]=>
|
||||
string(5) "alter"
|
||||
[3]=>
|
||||
array(1) {
|
||||
object(RecursiveArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(2) {
|
||||
[2]=>
|
||||
string(5) "alter"
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
}
|
||||
}
|
||||
}
|
||||
update 3
|
||||
object(RecursiveArrayIterator)#%d (1) {
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
}
|
||||
}
|
||||
object(RecursiveArrayIterator)#%d (1) {
|
||||
[3]=>
|
||||
string(5) "alter"
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(5) "alter"
|
||||
}
|
||||
}
|
||||
update 4
|
||||
object(RecursiveArrayIterator)#%d (3) {
|
||||
[1]=>
|
||||
string(5) "alter"
|
||||
[2]=>
|
||||
array(2) {
|
||||
object(RecursiveArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(3) {
|
||||
[1]=>
|
||||
string(5) "alter"
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
array(1) {
|
||||
array(2) {
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
}
|
||||
}
|
||||
[4]=>
|
||||
string(4) "val4"
|
||||
}
|
||||
[4]=>
|
||||
string(4) "val4"
|
||||
}
|
||||
object(RecursiveArrayIterator)#%d (3) {
|
||||
[1]=>
|
||||
string(5) "alter"
|
||||
[2]=>
|
||||
array(2) {
|
||||
object(RecursiveArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(3) {
|
||||
[1]=>
|
||||
string(5) "alter"
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
array(1) {
|
||||
array(2) {
|
||||
[2]=>
|
||||
string(4) "val2"
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(4) "val3"
|
||||
}
|
||||
}
|
||||
[4]=>
|
||||
string(5) "alter"
|
||||
}
|
||||
[4]=>
|
||||
string(5) "alter"
|
||||
}
|
||||
array(3) {
|
||||
[1]=>
|
||||
|
@ -12,7 +12,9 @@ var_dump(is_string($d));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(DirectoryIterator)#%d (0) {
|
||||
object(DirectoryIterator)#%d (1) {
|
||||
%s"pathName"%s"SplFileInfo":private]=>
|
||||
%s(1) "."
|
||||
}
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
@ -45,14 +45,22 @@ test(dirname(__FILE__), substr(dirname(__FILE__),-1), 'l');
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===0===
|
||||
object(SplFileInfo)#%d (0) {
|
||||
object(SplFileInfo)#%d (2) {
|
||||
["pathName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
["fileName":"SplFileInfo":private]=>
|
||||
string(%d) "%sfileobject_001a.txt"
|
||||
}
|
||||
object(SplFileInfo)#%d (0) {
|
||||
object(SplFileInfo)#%d (2) {
|
||||
["pathName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
["fileName":"SplFileInfo":private]=>
|
||||
string(%d) "%sfileobject_001a.txt"
|
||||
}
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(%d) "%sfileobject_001a.txt"
|
||||
%s(%d) "%sfileobject_001a.txt"
|
||||
string(%d) "%sfileobject_001a.txt"
|
||||
bool(true)
|
||||
string(19) "fileobject_001a.txt"
|
||||
@ -63,14 +71,22 @@ string(%d) "%sfileobject_001a.txt"
|
||||
string(19) "fileobject_001a.txt"
|
||||
string(%d) "%stests"
|
||||
===1===
|
||||
object(SplFileInfo)#%d (0) {
|
||||
object(SplFileInfo)#%d (2) {
|
||||
["pathName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
["fileName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
}
|
||||
object(SplFileInfo)#%d (0) {
|
||||
object(SplFileInfo)#%d (2) {
|
||||
["pathName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
["fileName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
}
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(%d) "%stests/"
|
||||
%s(%d) "%stests/"
|
||||
string(%d) "%stests"
|
||||
bool(true)
|
||||
string(5) "tests"
|
||||
@ -81,14 +97,22 @@ string(%d) "%stests"
|
||||
string(%d) "%stests"
|
||||
string(%d) "%stests"
|
||||
===2===
|
||||
object(SplFileInfo)#1 (0) {
|
||||
object(SplFileInfo)#%d (2) {
|
||||
["pathName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
["fileName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
}
|
||||
object(SplFileInfo)#2 (0) {
|
||||
object(SplFileInfo)#%d (2) {
|
||||
["pathName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
["fileName":"SplFileInfo":private]=>
|
||||
string(%d) "%s"
|
||||
}
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(%d) "%stests"
|
||||
%s(%d) "%stests"
|
||||
string(%d) "%stests"
|
||||
bool(true)
|
||||
string(%d) "tests"
|
||||
|
@ -5,7 +5,7 @@ SPL: IteratorIterator and SimpleXMlElement
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$root = simplexml_load_string('<?xml version="1.0"?>
|
||||
$root = simplexml_load_string(b'<?xml version="1.0"?>
|
||||
<root>
|
||||
<child>Hello</child>
|
||||
<child>World</child>
|
||||
|
@ -20,7 +20,7 @@ foreach($it as $k=>$v)
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
0=>1
|
||||
hasNext: yes
|
||||
1=>2
|
||||
|
@ -40,41 +40,62 @@ foreach($it as $k => $v)
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
Error Argument 1 passed to AppendIterator::append() must implement interface Iterator, array given in %siterator_042.php on line %d
|
||||
object(ArrayIterator)#%d (2) {
|
||||
[0]=>
|
||||
object(ArrayIterator)#%d (1) {
|
||||
object(ArrayIterator)#%d (1) {
|
||||
%s"storage"%s"ArrayIterator":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
[1]=>
|
||||
object(ArrayIterator)#%d (2) {
|
||||
[0]=>
|
||||
int(21)
|
||||
object(ArrayIterator)#%d (1) {
|
||||
%s"storage"%s"ArrayIterator":private]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
int(22)
|
||||
object(ArrayIterator)#%d (1) {
|
||||
%s"storage"%s"ArrayIterator":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(21)
|
||||
[1]=>
|
||||
int(22)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
object(ArrayIterator)#%d (3) {
|
||||
[0]=>
|
||||
object(ArrayIterator)#%d (1) {
|
||||
object(ArrayIterator)#%d (1) {
|
||||
%s"storage"%s"ArrayIterator":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
[1]=>
|
||||
object(ArrayIterator)#%d (2) {
|
||||
[0]=>
|
||||
int(21)
|
||||
object(ArrayIterator)#%d (1) {
|
||||
%s"storage"%s"ArrayIterator":private]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
int(22)
|
||||
}
|
||||
[2]=>
|
||||
object(ArrayIterator)#5 (3) {
|
||||
[0]=>
|
||||
int(31)
|
||||
[1]=>
|
||||
int(32)
|
||||
object(ArrayIterator)#%d (1) {
|
||||
%s"storage"%s"ArrayIterator":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(21)
|
||||
[1]=>
|
||||
int(22)
|
||||
}
|
||||
}
|
||||
[2]=>
|
||||
int(33)
|
||||
object(ArrayIterator)#5 (1) {
|
||||
%s"storage"%s"ArrayIterator":private]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(31)
|
||||
[1]=>
|
||||
int(32)
|
||||
[2]=>
|
||||
int(33)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
===0===
|
||||
|
@ -88,14 +88,14 @@ int(4)
|
||||
int(4)
|
||||
===1===
|
||||
MyRecursiveArrayIterator::hasChildren()
|
||||
Exception: State 1: MyRecursiveArrayIterator::hasChildren() in %siterator_047.php on line %d
|
||||
Exception: State 1: MyRecursiveArrayIterator::hasChildren() in %s on line %d
|
||||
===2===
|
||||
MyRecursiveArrayIterator::hasChildren()
|
||||
int(0)
|
||||
int(0)
|
||||
MyRecursiveArrayIterator::hasChildren()
|
||||
MyRecursiveArrayIterator::getChildren()
|
||||
Exception: State 2: MyRecursiveArrayIterator::getChildren() in %siterator_047.php on line %d
|
||||
Exception: State 2: MyRecursiveArrayIterator::getChildren() in %s on line %d
|
||||
===3===
|
||||
MyRecursiveArrayIterator::hasChildren()
|
||||
int(0)
|
||||
|
@ -14,8 +14,11 @@ var_dump($ar->getArrayCopy());
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
object(ArrayIterator)#%d (1) {
|
||||
[""]=>
|
||||
NULL
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(1) {
|
||||
[""]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[""]=>
|
||||
|
Binary file not shown.
@ -33,61 +33,64 @@ var_dump($ar);
|
||||
int(1)
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(3) "1,2"
|
||||
%s(3) "1,2"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
%s(1) "1"
|
||||
[2]=>
|
||||
string(1) "2"
|
||||
%s(1) "2"
|
||||
}
|
||||
int(2)
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(3) "1,2"
|
||||
%s(3) "1,2"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
%s(1) "1"
|
||||
[2]=>
|
||||
string(1) "2"
|
||||
%s(1) "2"
|
||||
}
|
||||
int(0)
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
%s(1) "1"
|
||||
}
|
||||
int(1)
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
%s(1) "1"
|
||||
}
|
||||
int(2)
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
object(ArrayIterator)#%d (9) {
|
||||
[0]=>
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
%s(3) "1,2"
|
||||
[2]=>
|
||||
%s(5) "1,2,3"
|
||||
[3]=>
|
||||
%s(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
%s(1) "1"
|
||||
}
|
||||
object(ArrayIterator)#%d (1) {
|
||||
%s"storage"%s"ArrayIterator":private]=>
|
||||
array(9) {
|
||||
[0]=>
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
%s(3) "1,2"
|
||||
[2]=>
|
||||
%s(5) "1,2,3"
|
||||
[3]=>
|
||||
%s(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
}
|
||||
[6]=>
|
||||
%s(6) "FooBar"
|
||||
[7]=>
|
||||
%s(1) ","
|
||||
[8]=>
|
||||
%s(2) ",,"
|
||||
}
|
||||
[6]=>
|
||||
%s(6) "FooBar"
|
||||
[7]=>
|
||||
%s(1) ","
|
||||
[8]=>
|
||||
%s(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
|
@ -76,20 +76,23 @@ array(2) {
|
||||
[1]=>
|
||||
string(1) "0"
|
||||
}
|
||||
object(ArrayIterator)#%d (7) {
|
||||
[1]=>
|
||||
int(0)
|
||||
["1,2"]=>
|
||||
int(1)
|
||||
["1,2,3"]=>
|
||||
int(2)
|
||||
[0]=>
|
||||
int(3)
|
||||
["FooBar"]=>
|
||||
int(4)
|
||||
[","]=>
|
||||
int(5)
|
||||
[",,"]=>
|
||||
int(6)
|
||||
object(ArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(7) {
|
||||
[1]=>
|
||||
int(0)
|
||||
["1,2"]=>
|
||||
int(1)
|
||||
["1,2,3"]=>
|
||||
int(2)
|
||||
[0]=>
|
||||
int(3)
|
||||
["FooBar"]=>
|
||||
int(4)
|
||||
[","]=>
|
||||
int(5)
|
||||
[",,"]=>
|
||||
int(6)
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
@ -290,25 +290,28 @@ array(2) {
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
object(ArrayIterator)#%d (9) {
|
||||
[0]=>
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
%s(3) "1,2"
|
||||
[2]=>
|
||||
%s(5) "1,2,3"
|
||||
[3]=>
|
||||
%s(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
object(ArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(9) {
|
||||
[0]=>
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
%s(3) "1,2"
|
||||
[2]=>
|
||||
%s(5) "1,2,3"
|
||||
[3]=>
|
||||
%s(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
}
|
||||
[6]=>
|
||||
%s(6) "FooBar"
|
||||
[7]=>
|
||||
%s(1) ","
|
||||
[8]=>
|
||||
%s(2) ",,"
|
||||
}
|
||||
[6]=>
|
||||
%s(6) "FooBar"
|
||||
[7]=>
|
||||
%s(1) ","
|
||||
[8]=>
|
||||
%s(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
|
@ -290,25 +290,28 @@ array(2) {
|
||||
string(1) "8"
|
||||
}
|
||||
}
|
||||
object(ArrayIterator)#%d (9) {
|
||||
[0]=>
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
%s(3) "1,2"
|
||||
[2]=>
|
||||
%s(5) "1,2,3"
|
||||
[3]=>
|
||||
%s(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
object(ArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(9) {
|
||||
[0]=>
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
%s(3) "1,2"
|
||||
[2]=>
|
||||
%s(5) "1,2,3"
|
||||
[3]=>
|
||||
%s(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
}
|
||||
[6]=>
|
||||
%s(6) "FooBar"
|
||||
[7]=>
|
||||
%s(1) ","
|
||||
[8]=>
|
||||
%s(2) ",,"
|
||||
}
|
||||
[6]=>
|
||||
%s(6) "FooBar"
|
||||
[7]=>
|
||||
%s(1) ","
|
||||
[8]=>
|
||||
%s(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
|
@ -60,25 +60,28 @@ array(3) {
|
||||
[2]=>
|
||||
string(0) ""
|
||||
}
|
||||
object(ArrayIterator)#%d (9) {
|
||||
[0]=>
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
%s(3) "1,2"
|
||||
[2]=>
|
||||
%s(5) "1,2,3"
|
||||
[3]=>
|
||||
%s(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
object(ArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(9) {
|
||||
[0]=>
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
%s(3) "1,2"
|
||||
[2]=>
|
||||
%s(5) "1,2,3"
|
||||
[3]=>
|
||||
%s(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
}
|
||||
[6]=>
|
||||
%s(6) "FooBar"
|
||||
[7]=>
|
||||
%s(1) ","
|
||||
[8]=>
|
||||
%s(2) ",,"
|
||||
}
|
||||
[6]=>
|
||||
%s(6) "FooBar"
|
||||
[7]=>
|
||||
%s(1) ","
|
||||
[8]=>
|
||||
%s(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
|
@ -42,20 +42,23 @@ array(2) {
|
||||
[1]=>
|
||||
string(2) ",3"
|
||||
}
|
||||
object(ArrayIterator)#%d (7) {
|
||||
[1]=>
|
||||
int(0)
|
||||
["1,2"]=>
|
||||
int(1)
|
||||
["1,2,3"]=>
|
||||
int(2)
|
||||
[0]=>
|
||||
int(3)
|
||||
["FooBar"]=>
|
||||
int(4)
|
||||
[","]=>
|
||||
int(5)
|
||||
[",,"]=>
|
||||
int(6)
|
||||
object(ArrayIterator)#%d (1) {
|
||||
["storage":"ArrayIterator":private]=>
|
||||
array(7) {
|
||||
[1]=>
|
||||
int(0)
|
||||
["1,2"]=>
|
||||
int(1)
|
||||
["1,2,3"]=>
|
||||
int(2)
|
||||
[0]=>
|
||||
int(3)
|
||||
["FooBar"]=>
|
||||
int(4)
|
||||
[","]=>
|
||||
int(5)
|
||||
[",,"]=>
|
||||
int(6)
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
@ -62,17 +62,43 @@ var_dump($storage2);
|
||||
int(2)
|
||||
int(1)
|
||||
int(2)
|
||||
object(MyStorage)#%d (1) {
|
||||
object(MyStorage)#%d (2) {
|
||||
["bla"]=>
|
||||
int(26)
|
||||
["storage":"SplObjectStorage":private]=>
|
||||
array(2) {
|
||||
["%s"]=>
|
||||
object(TestClass)#%d (1) {
|
||||
["test"]=>
|
||||
int(1)
|
||||
}
|
||||
["%s"]=>
|
||||
object(TestClass)#%d (1) {
|
||||
["test"]=>
|
||||
int(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
string(%d) "%s"
|
||||
===UNSERIALIZE===
|
||||
int(2)
|
||||
int(1)
|
||||
int(2)
|
||||
object(MyStorage)#%d (1) {
|
||||
object(MyStorage)#%d (2) {
|
||||
["bla"]=>
|
||||
int(26)
|
||||
["storage":"SplObjectStorage":private]=>
|
||||
array(2) {
|
||||
["%s"]=>
|
||||
object(TestClass)#%d (1) {
|
||||
["test"]=>
|
||||
int(1)
|
||||
}
|
||||
["%s"]=>
|
||||
object(TestClass)#%d (1) {
|
||||
["test"]=>
|
||||
int(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
@ -83,9 +83,9 @@ object(TestClass)#%d (4) {
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(4)
|
||||
["pro:protected"]=>
|
||||
["pro":protected]=>
|
||||
int(5)
|
||||
["pri:private"]=>
|
||||
["pri":"TestClass":private]=>
|
||||
int(6)
|
||||
}
|
||||
object(TestClass)#%d (4) {
|
||||
@ -93,20 +93,45 @@ object(TestClass)#%d (4) {
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(7)
|
||||
["pro:protected"]=>
|
||||
["pro":protected]=>
|
||||
int(8)
|
||||
["pri:private"]=>
|
||||
["pri":"TestClass":private]=>
|
||||
int(9)
|
||||
}
|
||||
object(MyStorage)#%d (4) {
|
||||
object(MyStorage)#%d (5) {
|
||||
["def"]=>
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(1)
|
||||
["pro:protected"]=>
|
||||
["pro":protected]=>
|
||||
int(2)
|
||||
["pri:private"]=>
|
||||
["pri":"MyStorage":private]=>
|
||||
int(3)
|
||||
["storage":"SplObjectStorage":private]=>
|
||||
array(2) {
|
||||
["%s"]=>
|
||||
object(TestClass)#%d (4) {
|
||||
["def"]=>
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(4)
|
||||
["pro":protected]=>
|
||||
int(5)
|
||||
["pri":"TestClass":private]=>
|
||||
int(6)
|
||||
}
|
||||
["%s"]=>
|
||||
object(TestClass)#%d (4) {
|
||||
["def"]=>
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(7)
|
||||
["pro":protected]=>
|
||||
int(8)
|
||||
["pri":"TestClass":private]=>
|
||||
int(9)
|
||||
}
|
||||
}
|
||||
}
|
||||
string(%d) "%s"
|
||||
===UNSERIALIZE===
|
||||
@ -116,9 +141,9 @@ object(TestClass)#%d (4) {
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(4)
|
||||
["pro:protected"]=>
|
||||
["pro":protected]=>
|
||||
int(5)
|
||||
["pri:private"]=>
|
||||
["pri":"TestClass":private]=>
|
||||
int(6)
|
||||
}
|
||||
object(TestClass)#%d (4) {
|
||||
@ -126,19 +151,44 @@ object(TestClass)#%d (4) {
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(7)
|
||||
["pro:protected"]=>
|
||||
["pro":protected]=>
|
||||
int(8)
|
||||
["pri:private"]=>
|
||||
["pri":"TestClass":private]=>
|
||||
int(9)
|
||||
}
|
||||
object(MyStorage)#%d (4) {
|
||||
object(MyStorage)#%d (5) {
|
||||
["def"]=>
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(1)
|
||||
["pro:protected"]=>
|
||||
["pro":protected]=>
|
||||
int(2)
|
||||
["pri:private"]=>
|
||||
["pri":"MyStorage":private]=>
|
||||
int(3)
|
||||
["storage":"SplObjectStorage":private]=>
|
||||
array(2) {
|
||||
["%s"]=>
|
||||
object(TestClass)#%d (4) {
|
||||
["def"]=>
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(4)
|
||||
["pro":protected]=>
|
||||
int(5)
|
||||
["pri":"TestClass":private]=>
|
||||
int(6)
|
||||
}
|
||||
["%s"]=>
|
||||
object(TestClass)#%d (4) {
|
||||
["def"]=>
|
||||
int(24)
|
||||
["pub"]=>
|
||||
int(7)
|
||||
["pro":protected]=>
|
||||
int(8)
|
||||
["pri":"TestClass":private]=>
|
||||
int(9)
|
||||
}
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
@ -73,4 +73,4 @@ array(0) {
|
||||
}
|
||||
bool(false)
|
||||
bool(false)
|
||||
===DONE===
|
||||
===DONE===
|
||||
|
@ -79,7 +79,7 @@ int(4)
|
||||
Error: Argument 3 passed to iterator_apply() must be an array, integer given
|
||||
Error: iterator_apply() expects parameter 3 to be array, integer given
|
||||
NULL
|
||||
Error: iterator_apply() expects parameter 2 to be function,%sstring given
|
||||
Error: iterator_apply() expects parameter 2 to be valid callback,%sstring given
|
||||
NULL
|
||||
Error: iterator_apply() expects at most 3 parameters, 4 given
|
||||
NULL
|
||||
|
@ -1,8 +1,8 @@
|
||||
--TEST--
|
||||
SPL: spl_autoloadfunctions()
|
||||
SPL: spl_autoload_functions()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("spl")) die ("skip");
|
||||
if (!extension_loaded("spl")) die("skip");
|
||||
if (spl_autoload_functions() !== false) die('skip __autoload() registered by php.ini');
|
||||
?>
|
||||
--FILE--
|
||||
|
@ -26,7 +26,7 @@ $xml =<<<EOF
|
||||
</sxe>
|
||||
EOF;
|
||||
|
||||
var_dump(simplexml_load_string($xml, 'SimpleXMLIterator'));
|
||||
var_dump(simplexml_load_string((binary)$xml, 'SimpleXMLIterator'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
|
@ -37,7 +37,7 @@ $xml =<<<EOF
|
||||
</sxe>
|
||||
EOF;
|
||||
|
||||
$sxe = simplexml_load_string($xml, 'SimpleXMLIterator');
|
||||
$sxe = simplexml_load_string((binary)$xml, 'SimpleXMLIterator');
|
||||
|
||||
foreach(new RecursiveIteratorIterator($sxe, 1) as $name => $data) {
|
||||
var_dump($name);
|
||||
|
@ -37,7 +37,7 @@ $xml =<<<EOF
|
||||
</sxe>
|
||||
EOF;
|
||||
|
||||
$sxe = simplexml_load_string($xml, 'SimpleXMLIterator');
|
||||
$sxe = simplexml_load_string((binary)$xml, 'SimpleXMLIterator');
|
||||
|
||||
foreach($sxe->getChildren() as $name => $data) {
|
||||
var_dump($name);
|
||||
|
@ -76,7 +76,7 @@ class SXETest extends SimpleXMLIterator
|
||||
}
|
||||
}
|
||||
|
||||
$sxe = new SXETest($xml);
|
||||
$sxe = new SXETest((binary)$xml);
|
||||
$rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::SELF_FIRST);
|
||||
|
||||
foreach($rit as $data) {
|
||||
|
@ -28,7 +28,7 @@ class SXETest extends SimpleXMLIterator
|
||||
}
|
||||
}
|
||||
|
||||
$sxe = new SXETest($xml);
|
||||
$sxe = new SXETest((binary)$xml);
|
||||
|
||||
var_dump(count($sxe));
|
||||
var_dump(count($sxe->elem1));
|
||||
|
@ -29,7 +29,7 @@ foreach (array ('arsort', 'asort', 'krsort', 'ksort', 'rsort', 'sort') as $test_
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Unsorted data:
|
||||
array(8) {
|
||||
[0]=>
|
||||
|
@ -56,4 +56,4 @@ array(5) {
|
||||
string(6) "test10"
|
||||
[6]=>
|
||||
string(6) "test21"
|
||||
}
|
||||
}
|
||||
|
@ -84,16 +84,16 @@ echo"Done";
|
||||
--EXPECTF--
|
||||
*** Testing Error Conditions ***
|
||||
|
||||
Warning: Wrong parameter count for array_shift() in %s line %d
|
||||
Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: array_shift(): The argument should be an array in %s on line %d
|
||||
Warning: array_shift() expects parameter 1 to be array, integer given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: array_shift(): The argument should be an array in %s on line %d
|
||||
Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for array_shift() in %s on line %d
|
||||
Warning: array_shift() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
NULL
|
||||
|
||||
|
@ -61,10 +61,6 @@ class cr {
|
||||
if ($a->priv_member === $b->priv_member) return 0;
|
||||
return ($a->priv_member > $b->priv_member)? 1:-1;
|
||||
}
|
||||
|
||||
function __toString() {
|
||||
return "Object";
|
||||
}
|
||||
}
|
||||
|
||||
function comp_func($a, $b) {
|
||||
@ -112,12 +108,6 @@ echo 'var_dump(array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_fun
|
||||
var_dump(array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func"));
|
||||
|
||||
|
||||
echo '$a='.var_export($a,TRUE).";\n";
|
||||
echo '$b='.var_export($b,TRUE).";\n";
|
||||
echo 'var_dump(array_diff_assoc($a, $b));'."\n";
|
||||
var_dump(@array_diff_assoc($a, $b));
|
||||
|
||||
|
||||
echo '$a='.var_export($a,TRUE).";\n";
|
||||
echo '$b='.var_export($b,TRUE).";\n";
|
||||
echo 'var_dump(array_udiff($a, $b, "comp_func_cr"));'."\n";
|
||||
@ -314,21 +304,21 @@ var_dump(array_udiff_uassoc($a, $b, "comp_func_cr", "comp_func"));
|
||||
array(3) {
|
||||
["0.1"]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(9)
|
||||
["public_member"]=>
|
||||
int(9)
|
||||
}
|
||||
["0.5"]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(12)
|
||||
["public_member"]=>
|
||||
int(12)
|
||||
}
|
||||
[0]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(23)
|
||||
["public_member"]=>
|
||||
int(23)
|
||||
@ -392,21 +382,21 @@ var_dump(array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func"));
|
||||
array(3) {
|
||||
["0.1"]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(9)
|
||||
["public_member"]=>
|
||||
int(9)
|
||||
}
|
||||
["0.5"]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(12)
|
||||
["public_member"]=>
|
||||
int(12)
|
||||
}
|
||||
[0]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(23)
|
||||
["public_member"]=>
|
||||
int(23)
|
||||
@ -466,82 +456,18 @@ $b=array (
|
||||
'public_member' => -15,
|
||||
)),
|
||||
);
|
||||
var_dump(array_diff_assoc($a, $b));
|
||||
array(1) {
|
||||
["0.1"]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
int(9)
|
||||
["public_member"]=>
|
||||
int(9)
|
||||
}
|
||||
}
|
||||
$a=array (
|
||||
'0.1' =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => 9,
|
||||
'public_member' => 9,
|
||||
)),
|
||||
'0.5' =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => 12,
|
||||
'public_member' => 12,
|
||||
)),
|
||||
0 =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => 23,
|
||||
'public_member' => 23,
|
||||
)),
|
||||
1 =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => 4,
|
||||
'public_member' => 4,
|
||||
)),
|
||||
2 =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => -15,
|
||||
'public_member' => -15,
|
||||
)),
|
||||
);
|
||||
$b=array (
|
||||
'0.2' =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => 9,
|
||||
'public_member' => 9,
|
||||
)),
|
||||
'0.5' =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => 22,
|
||||
'public_member' => 22,
|
||||
)),
|
||||
0 =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => 3,
|
||||
'public_member' => 3,
|
||||
)),
|
||||
1 =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => 4,
|
||||
'public_member' => 4,
|
||||
)),
|
||||
2 =>
|
||||
cr::__set_state(array(
|
||||
'priv_member' => -15,
|
||||
'public_member' => -15,
|
||||
)),
|
||||
);
|
||||
var_dump(array_udiff($a, $b, "comp_func_cr"));
|
||||
array(2) {
|
||||
["0.5"]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(12)
|
||||
["public_member"]=>
|
||||
int(12)
|
||||
}
|
||||
[0]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(23)
|
||||
["public_member"]=>
|
||||
int(23)
|
||||
@ -605,21 +531,21 @@ var_dump(array_udiff_assoc($a, $b, "comp_func_cr"));
|
||||
array(3) {
|
||||
["0.1"]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(9)
|
||||
["public_member"]=>
|
||||
int(9)
|
||||
}
|
||||
["0.5"]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(12)
|
||||
["public_member"]=>
|
||||
int(12)
|
||||
}
|
||||
[0]=>
|
||||
object(cr)#%d (2) {
|
||||
["priv_member:private"]=>
|
||||
["priv_member":"cr":private]=>
|
||||
int(23)
|
||||
["public_member"]=>
|
||||
int(23)
|
||||
|
@ -114,89 +114,6 @@ var_dump( reset($int_var) );
|
||||
var_dump( reset($float_var) );
|
||||
var_dump( reset($string) );
|
||||
|
||||
echo "\n*** Testing operation on Objects ***\n";
|
||||
// class having members of different scope
|
||||
class test_class
|
||||
{
|
||||
private $private_var = "private_var";
|
||||
public $public_var = "public_var";
|
||||
protected $protected_var = "protected_var";
|
||||
private $var1 = 10;
|
||||
public $var2 = 30;
|
||||
protected $var3 = 40;
|
||||
var $integer = 3092;
|
||||
|
||||
private function private_fun() {
|
||||
echo "private_fun() called\n";
|
||||
}
|
||||
|
||||
protected function protected_fun() {
|
||||
echo "protected_fun() called\n";
|
||||
}
|
||||
|
||||
public function public_fun() {
|
||||
echo "public_fun() called\n";
|
||||
}
|
||||
}
|
||||
// class with no member variables
|
||||
class zero_member_var_class
|
||||
{
|
||||
public function fun() {
|
||||
echo "fun() called\n";
|
||||
}
|
||||
}
|
||||
// class with no members
|
||||
class zero_member_class
|
||||
{
|
||||
// no members
|
||||
}
|
||||
|
||||
//create object of all classes defined above
|
||||
$test_class_obj = new test_class();
|
||||
$zero_member_var_class_obj = new zero_member_var_class();
|
||||
$zero_member_class_obj = new zero_member_class();
|
||||
|
||||
$object_array = array (
|
||||
$test_class_obj,
|
||||
$zero_member_var_class_obj,
|
||||
$zero_member_class_obj
|
||||
);
|
||||
|
||||
/* loop to use function key(), current(), next() and reset()
|
||||
on different class objects */
|
||||
$loop_count = 1;
|
||||
foreach( $object_array as $object ) {
|
||||
echo "--- Outerloop Iteration $loop_count ---\n";
|
||||
|
||||
/* dump the object before performing operation on it */
|
||||
echo "Object before performing operations ...\n";
|
||||
var_dump($object) ;
|
||||
|
||||
/* loop to feach all the key/value pair from the object*/
|
||||
$inner_loop_count = 1;
|
||||
do {
|
||||
echo "-- Innerloop iteration $inner_loop_count of Outerloop Iteration $loop_count --\n";
|
||||
$inner_loop_count ++;
|
||||
|
||||
// print the key/value pair of the current value
|
||||
echo "current => "; var_dump( current($object) ); // key & value pair
|
||||
echo "key => "; var_dump( key($object) ); // key
|
||||
|
||||
$next_pair = next($object);
|
||||
echo "next => "; var_dump($next_pair);
|
||||
|
||||
} while( FALSE != $next_pair );
|
||||
|
||||
$loop_count++;
|
||||
|
||||
/* reset the object */
|
||||
echo "reset => "; var_dump( reset($object) );
|
||||
echo "current => "; var_dump( current($object) ); // first variable in object
|
||||
|
||||
echo "\nObject after performing operations ...\n";
|
||||
var_dump($object) ; // no change expected
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
@ -542,173 +459,77 @@ array(5) {
|
||||
|
||||
-- Testing variation: when array is unset --
|
||||
|
||||
Warning: current(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: current() expects parameter 1 to be array, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: key(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: key() expects parameter 1 to be array, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: next(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: next() expects parameter 1 to be array, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: reset(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: reset() expects parameter 1 to be array, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
*** Testing error conditions ***
|
||||
|
||||
Warning: Wrong parameter count for key() in %s on line %d
|
||||
Warning: key() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for current() in %s on line %d
|
||||
Warning: current() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for reset() in %s on line %d
|
||||
Warning: reset() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for next() in %s on line %d
|
||||
Warning: next() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for key() in %s on line %d
|
||||
Warning: key() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for current() in %s on line %d
|
||||
Warning: current() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for reset() in %s on line %d
|
||||
Warning: reset() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for next() in %s on line %d
|
||||
Warning: next() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: key(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: key() expects parameter 1 to be array, integer given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: key(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: key() expects parameter 1 to be array, double given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: key(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: key() expects parameter 1 to be array, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: current(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: current() expects parameter 1 to be array, integer given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: current(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: current() expects parameter 1 to be array, double given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: current(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: current() expects parameter 1 to be array, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: next(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: next() expects parameter 1 to be array, integer given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: next(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: next() expects parameter 1 to be array, double given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: next(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: next() expects parameter 1 to be array, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: reset(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: reset() expects parameter 1 to be array, integer given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: reset(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
Warning: reset() expects parameter 1 to be array, double given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: reset(): Passed variable is not an array or object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
*** Testing operation on Objects ***
|
||||
--- Outerloop Iteration 1 ---
|
||||
Object before performing operations ...
|
||||
object(test_class)#1 (7) {
|
||||
["private_var:private"]=>
|
||||
string(11) "private_var"
|
||||
["public_var"]=>
|
||||
string(10) "public_var"
|
||||
["protected_var:protected"]=>
|
||||
string(13) "protected_var"
|
||||
["var1:private"]=>
|
||||
int(10)
|
||||
["var2"]=>
|
||||
int(30)
|
||||
["var3:protected"]=>
|
||||
int(40)
|
||||
["integer"]=>
|
||||
int(3092)
|
||||
}
|
||||
-- Innerloop iteration 1 of Outerloop Iteration 1 --
|
||||
current => string(11) "private_var"
|
||||
key => string(23) " |