2005-11-01 04:29:34 +08:00
|
|
|
--TEST--
|
2008-07-07 07:45:38 +08:00
|
|
|
SPL: SimpleXMLIterator and overriden count()
|
2005-11-01 04:29:34 +08:00
|
|
|
--SKIPIF--
|
|
|
|
<?php
|
|
|
|
if (!extension_loaded('simplexml')) print 'skip';
|
|
|
|
if (!extension_loaded("libxml")) print "skip LibXML not present";
|
|
|
|
?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$xml =<<<EOF
|
|
|
|
<?xml version='1.0'?>
|
|
|
|
<sxe>
|
|
|
|
<elem1/>
|
|
|
|
<elem2/>
|
|
|
|
<elem2/>
|
|
|
|
</sxe>
|
|
|
|
EOF;
|
|
|
|
|
|
|
|
class SXETest extends SimpleXMLIterator
|
|
|
|
{
|
|
|
|
function count()
|
|
|
|
{
|
|
|
|
echo __METHOD__ . "\n";
|
|
|
|
return parent::count();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-19 20:01:18 +08:00
|
|
|
$sxe = new SXETest((binary)$xml);
|
2005-11-01 04:29:34 +08:00
|
|
|
|
|
|
|
var_dump(count($sxe));
|
|
|
|
var_dump(count($sxe->elem1));
|
|
|
|
var_dump(count($sxe->elem2));
|
|
|
|
|
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--EXPECT--
|
|
|
|
SXETest::count
|
|
|
|
int(3)
|
|
|
|
SXETest::count
|
|
|
|
int(1)
|
|
|
|
SXETest::count
|
|
|
|
int(2)
|
|
|
|
===DONE===
|