mirror of
https://github.com/php/php-src.git
synced 2024-09-23 10:57:26 +00:00
fix spl tests
This commit is contained in:
parent
ad1d0e6d65
commit
074615035f
@ -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>
|
||||
|
@ -33,41 +33,41 @@ 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"
|
||||
%s(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
%s(1) "1"
|
||||
}
|
||||
object(ArrayIterator)#%d (9) {
|
||||
[0]=>
|
||||
|
@ -97,50 +97,50 @@ object(ArrayIterator)#%d (7) {
|
||||
unicode(3) "1,2"
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(3) "1,2"
|
||||
unicode(3) "1,2"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
unicode(1) "1"
|
||||
[2]=>
|
||||
string(1) "2"
|
||||
unicode(1) "2"
|
||||
}
|
||||
unicode(5) "1,2,3"
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(3) "1,2"
|
||||
unicode(3) "1,2"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
unicode(1) "1"
|
||||
[2]=>
|
||||
string(1) "2"
|
||||
unicode(1) "2"
|
||||
}
|
||||
int(1)
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
unicode(1) "1"
|
||||
}
|
||||
unicode(3) "1,2"
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
unicode(1) "1"
|
||||
}
|
||||
unicode(5) "1,2,3"
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
unicode(1) "1"
|
||||
}
|
||||
int(0)
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "0"
|
||||
unicode(1) "0"
|
||||
[1]=>
|
||||
string(1) "0"
|
||||
unicode(1) "0"
|
||||
}
|
||||
object(ArrayIterator)#%d (7) {
|
||||
object(ArrayIterator)#1 (7) {
|
||||
[1]=>
|
||||
int(0)
|
||||
[u"1,2"]=>
|
||||
|
@ -312,3 +312,269 @@ object(ArrayIterator)#%d (9) {
|
||||
%s(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
--UEXPECTF--
|
||||
bool(true)
|
||||
int(0)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(1)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(3) "1,2"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "2"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(2)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(3) "1,2"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "2"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(3)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(4)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(5)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(6)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(7)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(8)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(0)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(1)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
unicode(1) "2"
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
unicode(1) "2"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(2)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
unicode(1) "2"
|
||||
[2]=>
|
||||
unicode(1) "3"
|
||||
}
|
||||
[1]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
unicode(1) "2"
|
||||
[2]=>
|
||||
unicode(1) "3"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(3)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(4)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(5)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(6)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(7)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(8)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
object(ArrayIterator)#%d (9) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
unicode(3) "1,2"
|
||||
[2]=>
|
||||
unicode(5) "1,2,3"
|
||||
[3]=>
|
||||
unicode(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
}
|
||||
[6]=>
|
||||
unicode(6) "FooBar"
|
||||
[7]=>
|
||||
unicode(1) ","
|
||||
[8]=>
|
||||
unicode(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
|
@ -312,3 +312,269 @@ object(ArrayIterator)#%d (9) {
|
||||
%s(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
--UEXPECTF--
|
||||
bool(true)
|
||||
int(0)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(1)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(2)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(3)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(4)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(5)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(6)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(7)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(8)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(0) {
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
[2]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(0)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "0"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "0"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(1)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(2)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "2"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "2"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(3)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "3"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "3"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(4)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "4"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "4"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(5)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "5"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "5"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(6)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "6"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "6"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(7)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "7"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "7"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(8)
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "8"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
unicode(1) "8"
|
||||
}
|
||||
}
|
||||
object(ArrayIterator)#%d (9) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
unicode(3) "1,2"
|
||||
[2]=>
|
||||
unicode(5) "1,2,3"
|
||||
[3]=>
|
||||
unicode(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
}
|
||||
[6]=>
|
||||
unicode(6) "FooBar"
|
||||
[7]=>
|
||||
unicode(1) ","
|
||||
[8]=>
|
||||
unicode(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
|
@ -82,3 +82,58 @@ object(ArrayIterator)#%d (9) {
|
||||
%s(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
--UEXPECTF--
|
||||
int(1)
|
||||
array(2) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
unicode(1) "2"
|
||||
}
|
||||
int(2)
|
||||
array(3) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
unicode(1) "2"
|
||||
[2]=>
|
||||
unicode(1) "3"
|
||||
}
|
||||
int(7)
|
||||
array(2) {
|
||||
[0]=>
|
||||
unicode(0) ""
|
||||
[1]=>
|
||||
unicode(0) ""
|
||||
}
|
||||
int(8)
|
||||
array(3) {
|
||||
[0]=>
|
||||
unicode(0) ""
|
||||
[1]=>
|
||||
unicode(0) ""
|
||||
[2]=>
|
||||
unicode(0) ""
|
||||
}
|
||||
object(ArrayIterator)#%d (9) {
|
||||
[0]=>
|
||||
unicode(1) "1"
|
||||
[1]=>
|
||||
unicode(3) "1,2"
|
||||
[2]=>
|
||||
unicode(5) "1,2,3"
|
||||
[3]=>
|
||||
unicode(0) ""
|
||||
[4]=>
|
||||
NULL
|
||||
[5]=>
|
||||
array(0) {
|
||||
}
|
||||
[6]=>
|
||||
unicode(6) "FooBar"
|
||||
[7]=>
|
||||
unicode(1) ","
|
||||
[8]=>
|
||||
unicode(2) ",,"
|
||||
}
|
||||
===DONE===
|
||||
|
@ -63,16 +63,16 @@ object(ArrayIterator)#%d (7) {
|
||||
unicode(3) "1,2"
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
unicode(0) ""
|
||||
[1]=>
|
||||
string(0) ""
|
||||
unicode(0) ""
|
||||
}
|
||||
unicode(5) "1,2,3"
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
unicode(0) ""
|
||||
[1]=>
|
||||
string(2) ",3"
|
||||
unicode(2) ",3"
|
||||
}
|
||||
object(ArrayIterator)#%d (7) {
|
||||
[1]=>
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user