diff options
Diffstat (limited to 'ext/spl/tests')
126 files changed, 0 insertions, 9902 deletions
diff --git a/ext/spl/tests/.htaccess b/ext/spl/tests/.htaccess deleted file mode 100755 index 5a01a1c16e..0000000000 --- a/ext/spl/tests/.htaccess +++ /dev/null @@ -1,3 +0,0 @@ -<IfModule mod_autoindex.c> - IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t *.php -</IfModule> diff --git a/ext/spl/tests/array_001.phpt b/ext/spl/tests/array_001.phpt deleted file mode 100755 index 1c7566ecb9..0000000000 --- a/ext/spl/tests/array_001.phpt +++ /dev/null @@ -1,103 +0,0 @@ ---TEST-- -SPL: ArrayObject ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = array(0=>0, 1=>1); -$ar = new ArrayObject($ar); - -var_dump($ar); - -$ar[2] = 2; -var_dump($ar[2]); -var_dump($ar["3"] = 3); - -var_dump(array_merge((array)$ar, array(4=>4, 5=>5))); - -var_dump($ar["a"] = "a"); - -var_dump($ar); -var_dump($ar[0]); -var_dump($ar[6]); -var_dump($ar["b"]); - -unset($ar[1]); -unset($ar["3"]); -unset($ar["a"]); -unset($ar[7]); -unset($ar["c"]); -var_dump($ar); - -$ar[] = '3'; -$ar[] = 4; -var_dump($ar); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -object(ArrayObject)#1 (2) { - [0]=> - int(0) - [1]=> - int(1) -} -int(2) -int(3) -array(6) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(4) - [5]=> - 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" -} -int(0) - -Notice: Undefined offset: 6 in %sarray_001.php on line %d -NULL - -Notice: Undefined index: b in %sarray_001.php on line %d -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 (4) { - [0]=> - int(0) - [2]=> - int(2) - [4]=> - string(1) "3" - [5]=> - int(4) -} -===DONE=== diff --git a/ext/spl/tests/array_002.phpt b/ext/spl/tests/array_002.phpt deleted file mode 100755 index 960253f335..0000000000 --- a/ext/spl/tests/array_002.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -SPL: ArrayObject copy constructor ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$array = array('1' => 'one', - '2' => 'two', - '3' => 'three'); - -$object = new ArrayObject($array); -$object[] = 'four'; - -$arrayObject = new ArrayObject($object); - -$arrayObject[] = 'five'; - -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" -} -===DONE=== diff --git a/ext/spl/tests/array_003.phpt b/ext/spl/tests/array_003.phpt deleted file mode 100755 index 386c7bcf7d..0000000000 --- a/ext/spl/tests/array_003.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -SPL: ArrayObject from object ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -// This test also needs to exclude the protected and private variables -// since they cannot be accessed from the external object which iterates -// them. - -class test -{ - public $pub = "public"; - protected $pro = "protected"; - private $pri = "private"; - - function __construct() - { - $this->imp = "implicit"; - } -}; - -$test = new test; -$test->dyn = "dynamic"; - -print_r($test); - -$object = new ArrayObject($test); - -print_r($object); - -foreach($test as $key => $val) -{ - echo "$key => $val\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -test Object -( - [pub] => public - [pro:protected] => protected - [pri:private] => private - [imp] => implicit - [dyn] => dynamic -) -ArrayObject Object -( - [pub] => public - [pro:protected] => protected - [pri:private] => private - [imp] => implicit - [dyn] => dynamic -) -pub => public -imp => implicit -dyn => dynamic -===DONE=== diff --git a/ext/spl/tests/array_004.phpt b/ext/spl/tests/array_004.phpt deleted file mode 100755 index e7abf2b1dc..0000000000 --- a/ext/spl/tests/array_004.phpt +++ /dev/null @@ -1,143 +0,0 @@ ---TEST-- -SPL: ArrayIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -allow_call_time_pass_reference=1 ---FILE-- -<?php - -echo "==Normal==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject($arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==UseRef==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==Modify==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==Delete==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==1 && $bk==1) { - unset($arr[1]); - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==Change==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==1 && $bk==1) { - $arr = NULL; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "Done\n"; -?> ---EXPECTF-- -==Normal== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>0 -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>0 -2=>2 - 1=>1 -2=>2 - 2=>2 -==UseRef== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>modify -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>modify -2=>2 - 1=>1 -2=>2 - 2=>2 -==Modify== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>modify -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>modify -2=>2 - 1=>1 -2=>2 - 2=>2 -==Delete== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>0 -1=>1 - 1=>1 - -Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_004.php on line %d -1=>1 - 0=>0 -1=>1 - 2=>2 - -Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_004.php on line %d -0=>0 - 0=>0 -0=>0 - 2=>2 -2=>2 - 0=>0 -2=>2 - 2=>2 -==Change== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>0 -1=>1 - 1=>1 - -Notice: main(): ArrayIterator::current(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d - -Notice: main(): ArrayIterator::valid(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d - -Notice: main(): ArrayIterator::current(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d - -Notice: main(): ArrayIterator::valid(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d -Done diff --git a/ext/spl/tests/array_005.phpt b/ext/spl/tests/array_005.phpt deleted file mode 100755 index 9214a4c92b..0000000000 --- a/ext/spl/tests/array_005.phpt +++ /dev/null @@ -1,93 +0,0 @@ ---TEST-- -SPL: ArrayObject/Iterator interaction ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class Student -{ - private $id; - private $name; - - public function __construct($id, $name) - { - $this->id = $id; - $this->name = $name; - } - - public function __toString() - { - return $this->id . ', ' . $this->name; - } - - public function getId() - { - return $this->id; - } -} - -class StudentIdFilter extends FilterIterator -{ - private $id; - - public function __construct(ArrayObject $students, Student $other) - { - FilterIterator::__construct($students->getIterator()); - $this->id = $other->getId(); - } - - public function accept() - { - echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n"; - return $this->current()->getId() == $this->id; - } -} - -class StudentList implements IteratorAggregate -{ - private $students; - - public function __construct() - { - $this->students = new ArrayObject(array()); - } - - public function add(Student $student) - { - if (!$this->contains($student)) { - $this->students[] = $student; - } - } - - public function contains(Student $student) - { - foreach ($this->students as $s) - { - if ($s->getId() == $student->getId()) { - return true; - } - } - return false; - } - - public function getIterator() { - return $this->students->getIterator(); - } -} - -$students = new StudentList(); -$students->add(new Student('01234123', 'Joe')); -$students->add(new Student('00000014', 'Bob')); -$students->add(new Student('00000014', 'Foo')); - -foreach ($students as $student) { - echo $student, "\n"; -} -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -01234123, Joe -00000014, Bob -===DONE=== diff --git a/ext/spl/tests/array_006.phpt b/ext/spl/tests/array_006.phpt deleted file mode 100755 index 5dd9bdec7a..0000000000 --- a/ext/spl/tests/array_006.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -SPL: ArrayIterator without ArrayObject ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -allow_call_time_pass_reference=1 ---FILE-- -<?php - -echo "==Normal==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayIterator($arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -==Normal== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -===DONE=== diff --git a/ext/spl/tests/array_007.phpt b/ext/spl/tests/array_007.phpt deleted file mode 100755 index 3e74e00da4..0000000000 --- a/ext/spl/tests/array_007.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -SPL: ArrayObject/Iterator from IteratorAggregate ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -// This test also needs to exclude the protected and private variables -// since they cannot be accessed from the external object which iterates -// them. - -class test implements IteratorAggregate -{ - public $pub = "public"; - protected $pro = "protected"; - private $pri = "private"; - - function __construct() - { - $this->imp = "implicit"; - } - - function getIterator() - { - $it = new ArrayObject($this); - return $it->getIterator(); - } -}; - -$test = new test; -$test->dyn = "dynamic"; - -print_r($test); - -print_r($test->getIterator()); - -foreach($test as $key => $val) -{ - echo "$key => $val\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -test Object -( - [pub] => public - [pro:protected] => protected - [pri:private] => private - [imp] => implicit - [dyn] => dynamic -) -ArrayIterator Object -( - [pub] => public - [pro:protected] => protected - [pri:private] => private - [imp] => implicit - [dyn] => dynamic -) -pub => public -imp => implicit -dyn => dynamic -===DONE=== diff --git a/ext/spl/tests/array_008.phpt b/ext/spl/tests/array_008.phpt deleted file mode 100755 index 613e324776..0000000000 --- a/ext/spl/tests/array_008.phpt +++ /dev/null @@ -1,62 +0,0 @@ ---TEST-- -SPL: ArrayIterator and foreach reference ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -allow_call_time_pass_reference=1 ---FILE-- -<?php - -echo "==Normal==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject($arr); - -foreach($obj as $ak=>&$av) { - foreach($obj as $bk=>&$bv) { - if ($ak==0 && $bk==0) { - $bv = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==UseRef==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>&$av) { - foreach($obj as $bk=>&$bv) { - if ($ak==0 && $bk==0) { - $bv = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -==Normal== -0=>modify - 0=>modify -0=>modify - 1=>1 -0=>modify - 2=>2 -1=>1 - 0=>modify -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>modify -2=>2 - 1=>1 -2=>2 - 2=>2 -==UseRef== -0=>modify - 0=>modify -0=>modify - 1=>1 -0=>modify - 2=>2 -1=>1 - 0=>modify -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>modify -2=>2 - 1=>1 -2=>2 - 2=>2 -===DONE=== diff --git a/ext/spl/tests/array_009.phpt b/ext/spl/tests/array_009.phpt deleted file mode 100755 index 0431cca77e..0000000000 --- a/ext/spl/tests/array_009.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -SPL: ArrayIterator implementing RecursiveIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3); - -$dir = new RecursiveIteratorIterator(new RecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY); - -foreach ($dir as $file) { - print "$file\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -1 -21 -221 -222 -231 -3 -===DONE=== diff --git a/ext/spl/tests/array_009a.phpt b/ext/spl/tests/array_009a.phpt deleted file mode 100755 index aebac08ba6..0000000000 --- a/ext/spl/tests/array_009a.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -SPL: ArrayIterator implementing RecursiveIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveArrayIterator extends ArrayIterator implements RecursiveIterator -{ - function hasChildren() - { - return is_array($this->current()); - } - - function getChildren() - { - return new MyRecursiveArrayIterator($this->current()); - } -} - -$array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3); - -$dir = new RecursiveIteratorIterator(new MyRecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY); - -foreach ($dir as $file) { - print "$file\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -1 -21 -221 -222 -231 -3 -===DONE=== diff --git a/ext/spl/tests/array_010.phpt b/ext/spl/tests/array_010.phpt deleted file mode 100755 index dae6b93d6d..0000000000 --- a/ext/spl/tests/array_010.phpt +++ /dev/null @@ -1,146 +0,0 @@ ---TEST-- -SPL: ArrayIterator implements ArrayAccess ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$obj = new ArrayObject(array('1st', 1, 2=>'3rd', '4th'=>4)); - -var_dump($obj->getArrayCopy()); - -echo "===EMPTY===\n"; -var_dump(empty($obj[0])); -var_dump(empty($obj[1])); -var_dump(empty($obj[2])); -var_dump(empty($obj['4th'])); -var_dump(empty($obj['5th'])); -var_dump(empty($obj[6])); - -echo "===isset===\n"; -var_dump(isset($obj[0])); -var_dump(isset($obj[1])); -var_dump(isset($obj[2])); -var_dump(isset($obj['4th'])); -var_dump(isset($obj['5th'])); -var_dump(isset($obj[6])); - -echo "===offsetGet===\n"; -var_dump($obj[0]); -var_dump($obj[1]); -var_dump($obj[2]); -var_dump($obj['4th']); -var_dump($obj['5th']); -var_dump($obj[6]); - -echo "===offsetSet===\n"; -echo "WRITE 1\n"; -$obj[1] = 'Changed 1'; -var_dump($obj[1]); -echo "WRITE 2\n"; -$obj['4th'] = 'Changed 4th'; -var_dump($obj['4th']); -echo "WRITE 3\n"; -$obj['5th'] = 'Added 5th'; -var_dump($obj['5th']); -echo "WRITE 4\n"; -$obj[6] = 'Added 6'; -var_dump($obj[6]); - -var_dump($obj[0]); -var_dump($obj[2]); - -$x = $obj[6] = 'changed 6'; -var_dump($obj[6]); -var_dump($x); - -echo "===unset===\n"; -var_dump($obj->getArrayCopy()); -unset($obj[2]); -unset($obj['4th']); -unset($obj[7]); -unset($obj['8th']); -var_dump($obj->getArrayCopy()); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(4) { - [0]=> - string(3) "1st" - [1]=> - int(1) - [2]=> - string(3) "3rd" - ["4th"]=> - int(4) -} -===EMPTY=== -bool(false) -bool(false) -bool(false) -bool(false) -bool(true) -bool(true) -===isset=== -bool(true) -bool(true) -bool(true) -bool(true) -bool(false) -bool(false) -===offsetGet=== -string(3) "1st" -int(1) -string(3) "3rd" -int(4) - -Notice: Undefined index: 5th in %sarray_010.php on line %d -NULL - -Notice: Undefined offset: 6 in %sarray_010.php on line %d -NULL -===offsetSet=== -WRITE 1 -string(9) "Changed 1" -WRITE 2 -string(11) "Changed 4th" -WRITE 3 -string(9) "Added 5th" -WRITE 4 -string(7) "Added 6" -string(3) "1st" -string(3) "3rd" -string(9) "changed 6" -string(9) "changed 6" -===unset=== -array(6) { - [0]=> - string(3) "1st" - [1]=> - string(9) "Changed 1" - [2]=> - string(3) "3rd" - ["4th"]=> - string(11) "Changed 4th" - ["5th"]=> - string(9) "Added 5th" - [6]=> - string(9) "changed 6" -} - -Notice: Undefined offset: 7 in %sarray_010.php on line %d - -Notice: Undefined index: 8th in %sarray_010.php on line %d -array(4) { - [0]=> - string(3) "1st" - [1]=> - string(9) "Changed 1" - ["5th"]=> - string(9) "Added 5th" - [6]=> - string(9) "changed 6" -} -===DONE=== diff --git a/ext/spl/tests/array_011.phpt b/ext/spl/tests/array_011.phpt deleted file mode 100755 index 09b132cfef..0000000000 --- a/ext/spl/tests/array_011.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -SPL: ArrayIterator, LimitIterator and string keys ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$a = array('zero' => 0, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5); -//foreach (new ArrayIterator($a) as $k => $v) -foreach (new LimitIterator(new ArrayIterator($a), 1, 3) as $k => $v) -{ - var_dump(array($k, $v)); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -array(2) { - [0]=> - string(3) "one" - [1]=> - int(1) -} -array(2) { - [0]=> - string(3) "two" - [1]=> - int(2) -} -array(2) { - [0]=> - string(5) "three" - [1]=> - int(3) -} -===DONE=== diff --git a/ext/spl/tests/array_012.phpt b/ext/spl/tests/array_012.phpt deleted file mode 100755 index a8889654a5..0000000000 --- a/ext/spl/tests/array_012.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -SPL: ArrayIterator::count ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "===Array===\n"; - -$a = array('zero' => 0, 'one' => 1, 'two' => 2); -$it = new ArrayIterator($a); - -var_dump($it->count()); -foreach($it as $key => $val) -{ - echo "$key=>$val\n"; - var_dump($it->count()); -} -var_dump($it->count()); - -echo "===Object===\n"; - -class test -{ - public $zero = 0; - protected $pro; - public $one = 1; - private $pri; - public $two = 2; -} - -$o = new test; -$it = new ArrayIterator($o); - -var_dump($it->count()); -foreach($it as $key => $val) -{ - echo "$key=>$val\n"; - var_dump($it->count()); -} -var_dump($it->count()); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -===Array=== -int(3) -zero=>0 -int(3) -one=>1 -int(3) -two=>2 -int(3) -int(3) -===Object=== -int(3) -zero=>0 -int(3) -one=>1 -int(3) -two=>2 -int(3) -int(3) -===DONE=== diff --git a/ext/spl/tests/array_013.phpt b/ext/spl/tests/array_013.phpt deleted file mode 100755 index 905b8339c9..0000000000 --- a/ext/spl/tests/array_013.phpt +++ /dev/null @@ -1,81 +0,0 @@ ---TEST-- -SPL: ArrayIterator::append ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -if (!class_exists('NoRewindIterator', false)) -{ - require_once(dirname(__FILE__) . '/../examples/norewinditerator.inc'); -} - -echo "===Array===\n"; - -$a = array(0 => 'zero', 1 => 'one', 2 => 'two'); -$it = new ArrayIterator($a); - -foreach($it as $key => $val) -{ - echo "$key=>$val\n"; -} - -echo "===Append===\n"; - -$it->append('three'); -$it->append('four'); - -foreach(new NoRewindIterator($it) as $key => $val) -{ - echo "$key=>$val\n"; -} - -echo "===Object===\n"; - -class test -{ - public $zero = 0; - protected $pro; - public $one = 1; - private $pri; - public $two = 2; -} - -$o = new test; -$it = new ArrayIterator($o); - -foreach($it as $key => $val) -{ - echo "$key=>$val\n"; -} - -echo "===Append===\n"; - -$it->append('three'); -$it->append('four'); - -foreach(new NoRewindIterator($it) as $key => $val) -{ - echo "$key=>$val\n"; -} - -var_dump($o->{0}); /* doesn't wotk anyway */ - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===Array=== -0=>zero -1=>one -2=>two -===Append=== -3=>three -4=>four -===Object=== -zero=>0 -one=>1 -two=>2 -===Append=== - -Catchable fatal error: ArrayIterator::append(): Cannot append properties to objects, use ArrayIterator::offsetSet() instead in %sarray_013.php on line %d diff --git a/ext/spl/tests/array_014.phpt b/ext/spl/tests/array_014.phpt deleted file mode 100755 index ad9bc6c4ac..0000000000 --- a/ext/spl/tests/array_014.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -SPL: ArrayIterator::seek() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$it = new ArrayIterator(range(0,10)); -var_dump($it->count()); -$it->seek(5); -var_dump($it->current()); -$it->seek(4); -var_dump($it->current()); -try -{ - $it->seek(-1); - var_dump($it->current()); -} -catch(Exception $e) -{ - echo $e->getMessage() . "\n"; -} - -try -{ - $it->seek(12); - var_dump($it->current()); -} -catch(Exception $e) -{ - echo $e->getMessage() . "\n"; -} - -$pos = 0; -foreach($it as $v) -{ - $it->seek($pos++); - var_dump($v); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -int(11) -int(5) -int(4) -Seek position -1 is out of range -Seek position 12 is out of range -int(0) -int(1) -int(2) -int(3) -int(4) -int(5) -int(6) -int(7) -int(8) -int(9) -int(10) -===DONE=== diff --git a/ext/spl/tests/array_015.phpt b/ext/spl/tests/array_015.phpt deleted file mode 100755 index 79d6a867f0..0000000000 --- a/ext/spl/tests/array_015.phpt +++ /dev/null @@ -1,87 +0,0 @@ ---TEST-- -SPL: ArrayIterator::next() with internal arrays ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = new ArrayObject(); - -$ar[0] = 1; -$ar[1] = 2; -$ar[2] = 3; -$ar[3] = 4; -$ar[4] = 5; - -var_dump($ar); - -$it = $ar->getIterator(); - -$ar->offsetUnset($it->key()); -$it->next(); - -var_dump($it->current()); -var_dump($ar); - -foreach($it as $k => $v) -{ - $ar->offsetUnset($k+1); - echo "$k=>$v\n"; -} - -var_dump($ar); - -foreach($it as $k => $v) -{ - $ar->offsetUnset($k); - echo "$k=>$v\n"; -} - -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) -} - -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) -} -1=>2 -3=>4 -object(ArrayObject)#%d (2) { - [1]=> - int(2) - [3]=> - int(4) -} -1=>2 - -Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_015.php on line %d -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) { -} -===DONE=== diff --git a/ext/spl/tests/array_016.phpt b/ext/spl/tests/array_016.phpt deleted file mode 100755 index f5a2854200..0000000000 --- a/ext/spl/tests/array_016.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -SPL: ArrayIterator/Object and IteratorIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$it = new ArrayIterator(range(0,3)); - -foreach(new IteratorIterator($it) as $v) -{ - var_dump($v); -} - -$it = new ArrayObject(range(0,3)); - -foreach(new IteratorIterator($it) as $v) -{ - var_dump($v); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -int(0) -int(1) -int(2) -int(3) -int(0) -int(1) -int(2) -int(3) -===DONE=== diff --git a/ext/spl/tests/array_017.phpt b/ext/spl/tests/array_017.phpt deleted file mode 100755 index 72bf639986..0000000000 --- a/ext/spl/tests/array_017.phpt +++ /dev/null @@ -1,649 +0,0 @@ ---TEST-- -SPL: ArrayObject::exchangeArray($this) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class ArrayIteratorEx extends ArrayIterator -{ - public $pub2 = 1; - protected $pro2 = 2; - private $pri2 = 3; - - function __construct($ar, $flags = 0) - { - echo __METHOD__ . "()\n"; - parent::__construct($ar, $flags); - $this->imp2 = 4; - } - - function dump() - { - echo __METHOD__ . "()\n"; - var_dump(array('Flags'=>$this->getFlags() - ,'OVars'=>get_object_vars($this) - ,'$this'=>$this)); - } - - function setFlags($flags) - { - echo __METHOD__ . "($flags)\n"; - ArrayIterator::setFlags($flags); - } -} - -class ArrayObjectEx extends ArrayObject -{ - public $pub1 = 1; - protected $pro1 = 2; - private $pri1 = 3; - - function __construct($ar = array(), $flags = 0) - { - echo __METHOD__ . "()\n"; - parent::__construct($ar, $flags); - $this->imp1 = 4; - } - - function exchange() - { - echo __METHOD__ . "()\n"; - $this->exchangeArray($this); - } - - function dump() - { - echo __METHOD__ . "()\n"; - var_dump(array('Flags'=>$this->getFlags() - ,'OVars'=>get_object_vars($this) - ,'$this'=>$this)); - } - - function show() - { - echo __METHOD__ . "()\n"; - foreach($this as $n => $v) - { - var_dump(array($n => $v)); - } - } - - function setFlags($flags) - { - echo __METHOD__ . "($flags)\n"; - ArrayObject::setFlags($flags); - } - - function getIterator() - { - echo __METHOD__ . "()\n"; - $it = new ArrayIteratorEx($this, $this->getFlags()); - $it->dyn2 = 5; - $it->dump(); - return $it; - } -} - -function check($obj, $flags) -{ - echo "===CHECK===\n"; - - $obj->setFlags($flags); - $obj->dump(); - $obj->show(); - - echo "===FOREACH===\n"; - - $it = $obj->getIterator(); - foreach($it as $n => $v) - { - var_dump(array($n => $v)); - } - - echo "===PROPERTY===\n"; - - var_dump($obj->pub1); - var_dump(isset($obj->a)); - $obj->setFlags($flags | 2); - var_dump($obj->pub1); - var_dump(isset($obj->a)); - - var_dump($it->pub2); - var_dump(isset($it->pub1)); - $it->setFlags($flags | 2); - var_dump($it->pub2); - var_dump(isset($it->pub1)); -} - -$obj = new ArrayObjectEx(array(0=>1,'a'=>25, 'pub1'=>42), 0); -$obj->dyn1 = 5; - -check($obj, 0); -check($obj, 1); - -echo "#####EXCHANGE#####\n"; - -$obj->exchange(); - -check($obj, 0); -check($obj, 1); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -ArrayObjectEx::__construct() -===CHECK=== -ArrayObjectEx::setFlags(0) -ArrayObjectEx::dump() -array(3) { - ["Flags"]=> - int(0) - ["OVars"]=> - array(2) { - ["a"]=> - int(25) - ["pub1"]=> - int(42) - } - ["$this"]=> - object(ArrayObjectEx)#1 (3) { - [0]=> - int(1) - ["a"]=> - int(25) - ["pub1"]=> - int(42) - } -} -ArrayObjectEx::show() -ArrayObjectEx::getIterator() -ArrayIteratorEx::__construct() -ArrayIteratorEx::dump() -array(3) { - ["Flags"]=> - int(0) - ["OVars"]=> - array(2) { - ["a"]=> - int(25) - ["pub1"]=> - int(42) - } - ["$this"]=> - object(ArrayIteratorEx)#2 (3) { - [0]=> - int(1) - ["a"]=> - int(25) - ["pub1"]=> - int(42) - } -} -array(1) { - [0]=> - int(1) -} -array(1) { - ["a"]=> - int(25) -} -array(1) { - ["pub1"]=> - int(42) -} -===FOREACH=== -ArrayObjectEx::getIterator() -ArrayIteratorEx::__construct() -ArrayIteratorEx::dump() -array(3) { - ["Flags"]=> - int(0) - ["OVars"]=> - array(2) { - ["a"]=> - int(25) - ["pub1"]=> - int(42) - } - ["$this"]=> - object(ArrayIteratorEx)#3 (3) { - [0]=> - int(1) - ["a"]=> - int(25) - ["pub1"]=> - int(42) - } -} -array(1) { - [0]=> - int(1) -} -array(1) { - ["a"]=> - int(25) -} -array(1) { - ["pub1"]=> - int(42) -} -===PROPERTY=== -int(1) -bool(false) -ArrayObjectEx::setFlags(2) -int(1) -bool(true) -int(1) -bool(false) -ArrayIteratorEx::setFlags(2) -int(1) -bool(true) -===CHECK=== -ArrayObjectEx::setFlags(1) -ArrayObjectEx::dump() -array(3) { - ["Flags"]=> - int(1) - ["OVars"]=> - array(5) { - ["pub1"]=> - int(1) - ["pro1"]=> - int(2) - ["pri1"]=> - int(3) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } - ["$this"]=> - object(ArrayObjectEx)#1 (5) { - ["pub1"]=> - int(1) - ["pro1:protected"]=> - int(2) - ["pri1:private"]=> - int(3) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } -} -ArrayObjectEx::show() -ArrayObjectEx::getIterator() -ArrayIteratorEx::__construct() -ArrayIteratorEx::dump() -array(3) { - ["Flags"]=> - int(1) - ["OVars"]=> - array(5) { - ["pub2"]=> - int(1) - ["pro2"]=> - int(2) - ["pri2"]=> - int(3) - ["imp2"]=> - int(4) - ["dyn2"]=> - int(5) - } - ["$this"]=> - object(ArrayIteratorEx)#3 (5) { - ["pub2"]=> - int(1) - ["pro2:protected"]=> - int(2) - ["pri2:private"]=> - int(3) - ["imp2"]=> - int(4) - ["dyn2"]=> - int(5) - } -} -array(1) { - [0]=> - int(1) -} -array(1) { - ["a"]=> - int(25) -} -array(1) { - ["pub1"]=> - int(42) -} -===FOREACH=== -ArrayObjectEx::getIterator() -ArrayIteratorEx::__construct() -ArrayIteratorEx::dump() -array(3) { - ["Flags"]=> - int(1) - ["OVars"]=> - array(5) { - ["pub2"]=> - int(1) - ["pro2"]=> - int(2) - ["pri2"]=> - int(3) - ["imp2"]=> - int(4) - ["dyn2"]=> - int(5) - } - ["$this"]=> - object(ArrayIteratorEx)#2 (5) { - ["pub2"]=> - int(1) - ["pro2:protected"]=> - int(2) - ["pri2:private"]=> - int(3) - ["imp2"]=> - int(4) - ["dyn2"]=> - int(5) - } -} -array(1) { - [0]=> - int(1) -} -array(1) { - ["a"]=> - int(25) -} -array(1) { - ["pub1"]=> - int(42) -} -===PROPERTY=== -int(1) -bool(false) -ArrayObjectEx::setFlags(3) -int(1) -bool(true) -int(1) -bool(false) -ArrayIteratorEx::setFlags(3) -int(1) -bool(true) -#####EXCHANGE##### -ArrayObjectEx::exchange() -===CHECK=== -ArrayObjectEx::setFlags(0) -ArrayObjectEx::dump() -array(3) { - ["Flags"]=> - int(0) - ["OVars"]=> - array(5) { - ["pub1"]=> - int(1) - ["pro1"]=> - int(2) - ["pri1"]=> - int(3) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } - ["$this"]=> - object(ArrayObjectEx)#1 (5) { - ["pub1"]=> - int(1) - ["pro1:protected"]=> - int(2) - ["pri1:private"]=> - int(3) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } -} -ArrayObjectEx::show() -ArrayObjectEx::getIterator() -ArrayIteratorEx::__construct() -ArrayIteratorEx::dump() -array(3) { - ["Flags"]=> - int(0) - ["OVars"]=> - array(4) { - ["pub1"]=> - int(1) - ["pro1"]=> - int(2) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } - ["$this"]=> - object(ArrayIteratorEx)#2 (5) { - ["pub1"]=> - int(1) - ["pro1:protected"]=> - int(2) - ["pri1:private"]=> - int(3) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } -} -array(1) { - ["pub1"]=> - int(1) -} -array(1) { - ["imp1"]=> - int(4) -} -array(1) { - ["dyn1"]=> - int(5) -} -===FOREACH=== -ArrayObjectEx::getIterator() -ArrayIteratorEx::__construct() -ArrayIteratorEx::dump() -array(3) { - ["Flags"]=> - int(0) - ["OVars"]=> - array(4) { - ["pub1"]=> - int(1) - ["pro1"]=> - int(2) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } - ["$this"]=> - object(ArrayIteratorEx)#3 (5) { - ["pub1"]=> - int(1) - ["pro1:protected"]=> - int(2) - ["pri1:private"]=> - int(3) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } -} -array(1) { - ["pub1"]=> - int(1) -} -array(1) { - ["imp1"]=> - int(4) -} -array(1) { - ["dyn1"]=> - int(5) -} -===PROPERTY=== -int(1) -bool(false) -ArrayObjectEx::setFlags(2) -int(1) -bool(false) -int(1) -bool(false) -ArrayIteratorEx::setFlags(2) -int(1) -bool(true) -===CHECK=== -ArrayObjectEx::setFlags(1) -ArrayObjectEx::dump() -array(3) { - ["Flags"]=> - int(1) - ["OVars"]=> - array(5) { - ["pub1"]=> - int(1) - ["pro1"]=> - int(2) - ["pri1"]=> - int(3) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } - ["$this"]=> - object(ArrayObjectEx)#1 (5) { - ["pub1"]=> - int(1) - ["pro1:protected"]=> - int(2) - ["pri1:private"]=> - int(3) - ["imp1"]=> - int(4) - ["dyn1"]=> - int(5) - } -} -ArrayObjectEx::show() -ArrayObjectEx::getIterator() -ArrayIteratorEx::__construct() -ArrayIteratorEx::dump() -array(3) { - ["Flags"]=> - int(1) - ["OVars"]=> - array(5) { - ["pub2"]=> - int(1) - ["pro2"]=> - int(2) - ["pri2"]=> - int(3) - ["imp2"]=> - int(4) - ["dyn2"]=> - int(5) - } - ["$this"]=> - object(ArrayIteratorEx)#3 (5) { - ["pub2"]=> - int(1) - ["pro2:protected"]=> - int(2) - ["pri2:private"]=> - int(3) - ["imp2"]=> - int(4) - ["dyn2"]=> - int(5) - } -} -array(1) { - ["pub1"]=> - int(1) -} -array(1) { - ["imp1"]=> - int(4) -} -array(1) { - ["dyn1"]=> - int(5) -} -===FOREACH=== -ArrayObjectEx::getIterator() -ArrayIteratorEx::__construct() -ArrayIteratorEx::dump() -array(3) { - ["Flags"]=> - int(1) - ["OVars"]=> - array(5) { - ["pub2"]=> - int(1) - ["pro2"]=> - int(2) - ["pri2"]=> - int(3) - ["imp2"]=> - int(4) - ["dyn2"]=> - int(5) - } - ["$this"]=> - object(ArrayIteratorEx)#2 (5) { - ["pub2"]=> - int(1) - ["pro2:protected"]=> - int(2) - ["pri2:private"]=> - int(3) - ["imp2"]=> - int(4) - ["dyn2"]=> - int(5) - } -} -array(1) { - ["pub1"]=> - int(1) -} -array(1) { - ["imp1"]=> - int(4) -} -array(1) { - ["dyn1"]=> - int(5) -} -===PROPERTY=== -int(1) -bool(false) -ArrayObjectEx::setFlags(3) -int(1) -bool(false) -int(1) -bool(false) -ArrayIteratorEx::setFlags(3) -int(1) -bool(true) -===DONE=== diff --git a/ext/spl/tests/array_018.phpt b/ext/spl/tests/array_018.phpt deleted file mode 100755 index ef48b97493..0000000000 --- a/ext/spl/tests/array_018.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -SPL: ArrayObject and \0 ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -try -{ - $foo = new ArrayObject(); - $foo->offsetSet("\0", "Foo"); -} -catch (Exception $e) -{ - var_dump($e->getMessage()); -} - -var_dump($foo); - -try -{ - $foo = new ArrayObject(); - $data = explode("=", "=Foo"); - $foo->offsetSet($data[0], $data[1]); -} -catch (Exception $e) -{ - var_dump($e->getMessage()); -} - -var_dump($foo); - -?> -===DONE=== ---EXPECTF-- -string(44) "An offset must not begin with \0 or be empty" -object(ArrayObject)#%d (0) { -} -string(44) "An offset must not begin with \0 or be empty" -object(ArrayObject)#%d (0) { -} -===DONE=== diff --git a/ext/spl/tests/array_019.phpt b/ext/spl/tests/array_019.phpt deleted file mode 100755 index 43d53b1273..0000000000 --- a/ext/spl/tests/array_019.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -SPL: ArrayIterator and foreach by reference ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = new ArrayObject(array(1)); foreach($ar as &$v) var_dump($v); -$ar = new ArrayIterator(array(2)); foreach($ar as &$v) var_dump($v); -$ar = new RecursiveArrayIterator(array(3)); foreach($ar as &$v) var_dump($v); - -class ArrayIteratorEx extends ArrayIterator -{ - function current() - { - return ArrayIterator::current(); - } -} - -$ar = new ArrayIteratorEx(array(4)); foreach($ar as $v) var_dump($v); -$ar = new ArrayIteratorEx(array(5)); foreach($ar as &$v) var_dump($v); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -int(1) -int(2) -int(3) -int(4) - -Fatal error: An iterator cannot be used with foreach by reference in %sarray_019.php on line %d diff --git a/ext/spl/tests/array_020.phpt b/ext/spl/tests/array_020.phpt deleted file mode 100755 index cdeb4a216c..0000000000 --- a/ext/spl/tests/array_020.phpt +++ /dev/null @@ -1,66 +0,0 @@ ---TEST-- -SPL: ArrayIterator overloading ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class ArrayIteratorEx extends ArrayIterator -{ - function rewind() - { - echo __METHOD__ . "\n"; - ArrayIterator::rewind(); - } - - function valid() - { - echo __METHOD__ . "\n"; - return ArrayIterator::valid(); - } - - function key() - { - echo __METHOD__ . "\n"; - return ArrayIterator::key(); - } - - function current() - { - echo __METHOD__ . "\n"; - return ArrayIterator::current(); - } - - function next() - { - echo __METHOD__ . "\n"; - return ArrayIterator::next(); - } -} - -$ar = new ArrayIteratorEx(array(1,2)); -foreach($ar as $k => $v) -{ - var_dump($k); - var_dump($v); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -ArrayIteratorEx::rewind -ArrayIteratorEx::valid -ArrayIteratorEx::current -ArrayIteratorEx::key -int(0) -int(1) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::current -ArrayIteratorEx::key -int(1) -int(2) -ArrayIteratorEx::next -ArrayIteratorEx::valid -===DONE=== diff --git a/ext/spl/tests/array_021.phpt b/ext/spl/tests/array_021.phpt deleted file mode 100755 index b38cedf0cd..0000000000 --- a/ext/spl/tests/array_021.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -SPL: ArrayObject::seek() and exceptions ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class foo extends ArrayObject -{ - public function seek($key) - { - echo __METHOD__ . "($key)\n"; - throw new Exception("hi"); - } -} - -$test = new foo(array(1,2,3)); - -try -{ - $test->seek('bar'); -} -catch (Exception $e) -{ - echo "got exception\n"; -} - -?> -===DONE=== ---EXPECT-- -foo::seek(bar) -got exception -===DONE=== diff --git a/ext/spl/tests/array_022.phpt b/ext/spl/tests/array_022.phpt deleted file mode 100755 index 9cb2193f10..0000000000 --- a/ext/spl/tests/array_022.phpt +++ /dev/null @@ -1,72 +0,0 @@ ---TEST-- -SPL: ArrayObject/Iterator and reference to self ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -==ArrayObject=== -<?php - -class MyArrayObject extends ArrayObject -{ - public function __construct() - { - parent::__construct($this); - $this['bar'] = 'baz'; - } -} - -$a = new MyArrayObject; - -$b = clone $a; -$b['baz'] = 'Foo'; - -var_dump($a); -var_dump($b); - -?> -==ArrayIterator=== -<?php - -class MyArrayIterator extends ArrayIterator -{ - public function __construct() - { - parent::__construct($this); - $this['bar'] = 'baz'; - } -} - -$a = new MyArrayIterator; - -$b = clone $a; -$b['baz'] = 'Foo'; - -var_dump($a); -var_dump($b); - -?> -===DONE=== ---EXPECTF-- -==ArrayObject=== -object(MyArrayObject)#%d (1) { - ["bar"]=> - string(3) "baz" -} -object(MyArrayObject)#%d (2) { - ["bar"]=> - string(3) "baz" - ["baz"]=> - string(3) "Foo" -} -==ArrayIterator=== -object(MyArrayIterator)#%d (1) { - ["bar"]=> - string(3) "baz" -} -object(MyArrayIterator)#%d (2) { - ["bar"]=> - string(3) "baz" - ["baz"]=> - string(3) "Foo" -} -===DONE=== diff --git a/ext/spl/tests/bug28822.phpt b/ext/spl/tests/bug28822.phpt deleted file mode 100755 index 0cf5575367..0000000000 --- a/ext/spl/tests/bug28822.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug #28822 (ArrayObject::offsetExists() works inverted) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$array = new ArrayObject(); -$array->offsetSet('key', 'value'); -var_dump($array->offsetExists('key')); -var_dump($array->offsetExists('nokey')); - -?> -===DONE=== ---EXPECT-- -bool(true) -bool(false) -===DONE=== diff --git a/ext/spl/tests/bug31185.phpt b/ext/spl/tests/bug31185.phpt deleted file mode 100755 index 421eb89ec1..0000000000 --- a/ext/spl/tests/bug31185.phpt +++ /dev/null @@ -1,63 +0,0 @@ ---TEST-- -Bug #31185 (Crash when exceptions thrown from ArrayAccess::offsetUnset()) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class FooBar implements ArrayAccess { - private $array = array(); - - public function offsetExists($index) { - return isset($this->array[$index]); - } - - public function offsetGet($index) { - return $this->array[$index]; - } - - public function offsetSet($index, $value) { - echo __METHOD__ . "($index, $value)\n"; - $this->array[$index] = $value; - } - - public function offsetUnset($index) { - throw new Exception('FAIL'); - unset($this->array[$index]); - } - -} - -$i = 0; $j = 0; -$foo = new FooBar(); -$foo[$j++] = $i++; -$foo[$j++] = $i++; -$foo[$j++] = $i++; -try -{ - unset($foo[1]); -} -catch (Exception $e) -{ - echo "CAUGHT: " . $e->getMessage() . "\n"; -} - -print_R($foo); -?> -===DONE=== ---EXPECT-- -FooBar::offsetSet(0, 0) -FooBar::offsetSet(1, 1) -FooBar::offsetSet(2, 2) -CAUGHT: FAIL -FooBar Object -( - [array:private] => Array - ( - [0] => 0 - [1] => 1 - [2] => 2 - ) - -) -===DONE=== diff --git a/ext/spl/tests/bug31346.phpt b/ext/spl/tests/bug31346.phpt deleted file mode 100755 index ed1b50d685..0000000000 --- a/ext/spl/tests/bug31346.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #31486 (ArrayIterator::next segfaults) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php -$obj = new stdClass; -$obj->var1=1; - -$ao = new ArrayObject($obj); - -$i = $ao->getIterator(); - -$ao->offsetUnset($i->key()); -$i->next(); - -?> -===DONE=== ---EXPECTF-- -Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sbug31346.php on line %d -===DONE=== diff --git a/ext/spl/tests/bug31348.phpt b/ext/spl/tests/bug31348.phpt deleted file mode 100755 index dcb627af22..0000000000 --- a/ext/spl/tests/bug31348.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug #31348 (CachingIterator::rewind() leaks) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php -$a = Array("some","blah"); -$i = new ArrayIterator($a); - -$ci = new CachingIterator($i); - -$ci->rewind(); - -?> -===DONE=== ---EXPECT-- -===DONE=== diff --git a/ext/spl/tests/bug31926.phpt b/ext/spl/tests/bug31926.phpt deleted file mode 100755 index 50246b35ca..0000000000 --- a/ext/spl/tests/bug31926.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug #31926 (php in free() error with RecursiveArrayIterator) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$array = array(0 => array('world')); - -$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($array)); -foreach($it as $key => $val) { - var_dump($key, $val); -} - -?> ---EXPECT-- -int(0) -string(5) "world" diff --git a/ext/spl/tests/bug32134.phpt b/ext/spl/tests/bug32134.phpt deleted file mode 100755 index e8527cd15a..0000000000 --- a/ext/spl/tests/bug32134.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -Bug #32134 (Overloading offsetGet/offsetSet) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class myArray extends ArrayIterator -{ - - public function __construct($array = array()) - { - parent::__construct($array); - } - - public function offsetGet($index) - { - static $i = 0; - echo __METHOD__ . "($index)\n"; - if (++$i > 3) exit(1); - return parent::offsetGet($index); - } - - public function offsetSet($index, $newval) - { - echo __METHOD__ . "($index,$newval)\n"; - return parent::offsetSet($index, $newval); - } - -} - -$myArray = new myArray(); - -$myArray->offsetSet('one', 'one'); -var_dump($myArray->offsetGet('one')); - -$myArray['two'] = 'two'; -var_dump($myArray['two']); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -myArray::offsetSet(one,one) -myArray::offsetGet(one) -string(3) "one" -myArray::offsetSet(two,two) -myArray::offsetGet(two) -string(3) "two" -===DONE=== diff --git a/ext/spl/tests/bug32394.phpt b/ext/spl/tests/bug32394.phpt deleted file mode 100755 index ac72e0fa16..0000000000 --- a/ext/spl/tests/bug32394.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Bug #32394 (offsetUnset() segfaults in a foreach) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$object = new ArrayIterator; -$object->append(1); - -foreach($object as $key => $value) -{ - $object->offsetUnset($key); -} - -?> -===DONE=== ---EXPECT-- -===DONE=== diff --git a/ext/spl/tests/bug33136.phpt b/ext/spl/tests/bug33136.phpt deleted file mode 100755 index 13b0583073..0000000000 --- a/ext/spl/tests/bug33136.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -Bug #33136 method offsetSet in class extended from ArrayObject crash PHP ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class Collection extends ArrayObject -{ - private $data; - - function __construct() - { - $this->data = array(); - parent::__construct($this->data); - } - - function offsetGet($index) - { - echo __METHOD__ . "($index)\n"; - return parent::offsetGet($index); - } - - function offsetSet($index, $value) - { - echo __METHOD__ . "(" . (is_null($index) ? "NULL" : $index) . ",$value)\n"; - parent::offsetSet($index, $value); - } -} - -echo "\n\nInitiate Obj\n"; -$arrayObj = new Collection(); - -echo "Assign values\n"; - -$arrayObj[] = "foo"; -var_dump($arrayObj[0]); - -$arrayObj[] = "bar"; -var_dump($arrayObj[0]); -var_dump($arrayObj[1]); - -$arrayObj["foo"] = "baz"; -var_dump($arrayObj["foo"]); - -print_r($arrayObj); - -var_dump(count($arrayObj)); - -?> -===DONE=== -<?php //exit(0); ?> ---EXPECT-- -Initiate Obj -Assign values -Collection::offsetSet(NULL,foo) -Collection::offsetGet(0) -string(3) "foo" -Collection::offsetSet(NULL,bar) -Collection::offsetGet(0) -string(3) "foo" -Collection::offsetGet(1) -string(3) "bar" -Collection::offsetSet(foo,baz) -Collection::offsetGet(foo) -string(3) "baz" -Collection Object -( - [0] => foo - [1] => bar - [foo] => baz -) -int(3) -===DONE=== diff --git a/ext/spl/tests/bug34548.phpt b/ext/spl/tests/bug34548.phpt deleted file mode 100644 index 73262a8061..0000000000 --- a/ext/spl/tests/bug34548.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Bug #34548 (Method append() in class extended from ArrayObject crashes PHP) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class Collection extends ArrayObject -{ - public function add($dataArray) - { - foreach($dataArray as $value) $this->append($value); - } - - public function offsetSet($index, $value) - { - parent::offsetSet($index, $value); - } -} - -$data1=array('one', 'two', 'three'); -$data2=array('four', 'five'); - -$foo=new Collection($data1); -$foo->add($data2); - -print_r($foo->getArrayCopy()); - -echo "Done\n"; -?> ---EXPECT-- -Array -( - [0] => one - [1] => two - [2] => three - [3] => four - [4] => five -) -Done diff --git a/ext/spl/tests/bug36258.phpt b/ext/spl/tests/bug36258.phpt deleted file mode 100644 index 297c7f5978..0000000000 --- a/ext/spl/tests/bug36258.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #36258 (SplFileObject::getPath() may lead to segfault) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$diriter = new RecursiveIteratorIterator( new RecursiveDirectoryIterator('.') ); - -foreach ($diriter as $key => $file) { - var_dump($file->getFilename()); - var_dump($file->getPath()); - break; -} - -echo "Done\n"; -?> ---EXPECTF-- -string(%d) "%s" -string(%d) "%s" -Done diff --git a/ext/spl/tests/bug36287.phpt b/ext/spl/tests/bug36287.phpt deleted file mode 100755 index 29ae0e2c9d..0000000000 --- a/ext/spl/tests/bug36287.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Bug #36287 ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("."), true); - -$idx = 0; -foreach($it as $file) -{ - echo "First\n"; - if("." != $file && ".." != $file) - { - var_Dump($file->getFilename()); - } - echo "Second\n"; - if($file != "." && $file != "..") - { - var_dump($file->getFilename()); - } - if (++$idx > 1) - { - break; - } -} - -?> -===DONE=== ---EXPECTF-- -First -string(%d) "%s" -Second -string(%d) "%s" -First -string(%d) "%s" -Second -string(%d) "%s" -===DONE=== diff --git a/ext/spl/tests/bug36825.phpt b/ext/spl/tests/bug36825.phpt deleted file mode 100644 index 503ec43a43..0000000000 --- a/ext/spl/tests/bug36825.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Bug #36825 (Exceptions thrown in ArrayObject::offsetGet cause segfault) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class foo extends ArrayObject -{ - public function offsetGet($key) - { - echo __METHOD__ . "($key)\n"; - throw new Exception("hi"); - } -} - -$test = new foo(); - -try -{ - var_dump($test['bar']); -} -catch (Exception $e) -{ - echo "got exception\n"; -} - -?> -===DONE=== ---EXPECT-- -foo::offsetGet(bar) -got exception -===DONE=== diff --git a/ext/spl/tests/bug36941.phpt b/ext/spl/tests/bug36941.phpt deleted file mode 100755 index 2ae03b4481..0000000000 --- a/ext/spl/tests/bug36941.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -Bug #36941 (ArrayIterator does not clone itself) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -===ArrayObject=== -<?php -$a = new ArrayObject(); -$a[] = 1; - -$b = clone $a; - -var_dump($a[0], $b[0]); -$b[0] = $b[0] + 1; -var_dump($a[0], $b[0]); -$b[0] = 3; -var_dump($a[0], $b[0]); -?> -===ArrayIterator=== -<?php -$a = new ArrayIterator(); -$a[] = 1; - -$b = clone $a; - -var_dump($a[0], $b[0]); -$b[0] = $b[0] + 1; -var_dump($a[0], $b[0]); -$b[0] = 3; -var_dump($a[0], $b[0]); -?> -===DONE=== ---EXPECT-- -===ArrayObject=== -int(1) -int(1) -int(1) -int(2) -int(1) -int(3) -===ArrayIterator=== -int(1) -int(1) -int(2) -int(2) -int(3) -int(3) -===DONE=== diff --git a/ext/spl/tests/bug37457.phpt b/ext/spl/tests/bug37457.phpt deleted file mode 100755 index 4395287bcd..0000000000 --- a/ext/spl/tests/bug37457.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -Bug #37457 (Crash when an exception is thrown in accept() method of FilterIterator) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class Collection implements Iterator -{ - protected $array, $valid = false; - - public function __construct(array $a) - { - echo __METHOD__ . "\n"; - $this->array = $a; - } - - public function current() - { - echo __METHOD__ . "\n"; - return current($this->array); - } - - public function key() - { - echo __METHOD__ . "\n"; - return key($this->array); - } - - public function next() - { - echo __METHOD__ . "\n"; - $this->valid = (false !== next($this->array)); - } - - public function valid() - { - echo __METHOD__ . "\n"; - return $this->valid; - } - - public function rewind() - { - echo __METHOD__ . "\n"; - $this->valid = (false !== reset($this->array)); - } -} - -class TestFilter extends FilterIterator -{ - public function accept() - { - echo __METHOD__ . "\n"; - throw new Exception("Failure in Accept"); - } -} - -$test = new TestFilter(new Collection(array(0))); - -try -{ - foreach ($test as $item) - { - echo $item; - } -} -catch (Exception $e) -{ - var_dump($e->getMessage()); -} - -?> -===DONE=== ---EXPECTF-- -Collection::__construct -Collection::rewind -Collection::valid -Collection::current -Collection::key -TestFilter::accept -string(17) "Failure in Accept" -===DONE=== diff --git a/ext/spl/tests/dit_001.phpt b/ext/spl/tests/dit_001.phpt deleted file mode 100755 index f02291c77b..0000000000 --- a/ext/spl/tests/dit_001.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -SPL: Problem with casting to string ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php -$d = new DirectoryIterator('.'); -var_dump($d); -var_dump(is_string($d)); -preg_match('/x/', $d); -var_dump(is_string($d)); -?> -===DONE=== ---EXPECTF-- -object(DirectoryIterator)#%d (0) { -} -bool(false) -bool(false) -===DONE=== diff --git a/ext/spl/tests/fileobject_001.phpt b/ext/spl/tests/fileobject_001.phpt deleted file mode 100755 index 957223b169..0000000000 --- a/ext/spl/tests/fileobject_001.phpt +++ /dev/null @@ -1,90 +0,0 @@ ---TEST-- -SPL: SplFileObject::seek'ing ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$o = new SplFileObject(dirname(__FILE__) . '/fileobject_001a.txt'); - -var_dump($o->key()); -var_dump($o->current()); -$o->setFlags(SplFileObject::DROP_NEW_LINE); -var_dump($o->key()); -var_dump($o->current()); -var_dump($o->key()); -$o->next(); -var_dump($o->key()); -var_dump($o->current()); -var_dump($o->key()); -$o->rewind(); -var_dump($o->key()); -var_dump($o->current()); -var_dump($o->key()); -$o->seek(4); -var_dump($o->key()); -var_dump($o->current()); -var_dump($o->key()); - -echo "===A===\n"; -foreach($o as $n => $l) -{ - var_dump($n, $l); -} - -echo "===B===\n"; -$o = new SplFileObject(dirname(__FILE__) . '/fileobject_001b.txt'); -$o->setFlags(SplFileObject::DROP_NEW_LINE); -foreach($o as $n => $l) -{ - var_dump($n, $l); -} - -?> -===DONE=== ---EXPECT-- -int(0) -string(2) "0 -" -int(0) -string(2) "0 -" -int(0) -int(1) -string(1) "1" -int(1) -int(0) -string(1) "0" -int(0) -int(4) -string(1) "4" -int(4) -===A=== -int(0) -string(1) "0" -int(1) -string(1) "1" -int(2) -string(1) "2" -int(3) -string(1) "3" -int(4) -string(1) "4" -int(5) -string(1) "5" -int(6) -string(0) "" -===B=== -int(0) -string(1) "0" -int(1) -string(1) "1" -int(2) -string(1) "2" -int(3) -string(1) "3" -int(4) -string(1) "4" -int(5) -string(1) "5" -===DONE=== diff --git a/ext/spl/tests/fileobject_001a.txt b/ext/spl/tests/fileobject_001a.txt deleted file mode 100755 index e8371f0060..0000000000 --- a/ext/spl/tests/fileobject_001a.txt +++ /dev/null @@ -1,6 +0,0 @@ -0 -1 -2 -3 -4 -5 diff --git a/ext/spl/tests/fileobject_001b.txt b/ext/spl/tests/fileobject_001b.txt deleted file mode 100755 index 0c4a8b5cd3..0000000000 --- a/ext/spl/tests/fileobject_001b.txt +++ /dev/null @@ -1,6 +0,0 @@ -0 -1 -2 -3 -4 -5
\ No newline at end of file diff --git a/ext/spl/tests/fileobject_002.phpt b/ext/spl/tests/fileobject_002.phpt deleted file mode 100755 index 0b944f2a7c..0000000000 --- a/ext/spl/tests/fileobject_002.phpt +++ /dev/null @@ -1,124 +0,0 @@ ---TEST-- -SPL: SplFileObject::fgetc ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -function test($name) -{ - echo "===$name===\n"; - - $o = new SplFileObject(dirname(__FILE__) . '/' . $name); - - var_dump($o->key()); - while(($c = $o->fgetc()) !== false) - { - var_dump($o->key(), $c, $o->eof()); - } - echo "===EOF?===\n"; - var_dump($o->eof()); - var_dump($o->key()); - var_dump($o->eof()); -} - -test('fileobject_001a.txt'); -test('fileobject_001b.txt'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -===fileobject_001a.txt=== -int(0) -int(0) -string(1) "0" -bool(false) -int(1) -string(1) " -" -bool(false) -int(1) -string(1) "1" -bool(false) -int(2) -string(1) " -" -bool(false) -int(2) -string(1) "2" -bool(false) -int(3) -string(1) " -" -bool(false) -int(3) -string(1) "3" -bool(false) -int(4) -string(1) " -" -bool(false) -int(4) -string(1) "4" -bool(false) -int(5) -string(1) " -" -bool(false) -int(5) -string(1) "5" -bool(false) -int(6) -string(1) " -" -bool(false) -===EOF?=== -bool(true) -int(6) -bool(true) -===fileobject_001b.txt=== -int(0) -int(0) -string(1) "0" -bool(false) -int(1) -string(1) " -" -bool(false) -int(1) -string(1) "1" -bool(false) -int(2) -string(1) " -" -bool(false) -int(2) -string(1) "2" -bool(false) -int(3) -string(1) " -" -bool(false) -int(3) -string(1) "3" -bool(false) -int(4) -string(1) " -" -bool(false) -int(4) -string(1) "4" -bool(false) -int(5) -string(1) " -" -bool(false) -int(5) -string(1) "5" -bool(false) -===EOF?=== -bool(true) -int(5) -bool(true) -===DONE=== diff --git a/ext/spl/tests/fileobject_003.phpt b/ext/spl/tests/fileobject_003.phpt deleted file mode 100755 index 74f2002d00..0000000000 --- a/ext/spl/tests/fileobject_003.phpt +++ /dev/null @@ -1,89 +0,0 @@ ---TEST-- -SPL: SplFileInfo cloning ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -function test($name, $lc, $lp) -{ - static $i = 0; - echo "===$i===\n"; - $i++; - - $o = new SplFileInfo($name); - - var_dump($o); - $c = clone $o; - var_dump($c); - var_dump($o === $c); - var_dump($o == $c); - var_dump($o->getPathname() == $c->getPathname()); - - $f = new SplFileObject($name); - var_dump($name); - var_dump($f->getPathName()); - $l = substr($f->getPathName(), -1); - var_dump($l != '/' && $l != '\\' && $l == $lc); - var_dump($f->getFileName()); - $l = substr($f->getFileName(), -1); - var_dump($l != '/' && $l != '\\' && $l == $lc); - var_dump($f->getPath()); - $l = substr($f->getPath(), -1); - var_dump($l != '/' && $l != '\\' && $l == $lp); -} - -test(dirname(__FILE__) . '/' . 'fileobject_001a.txt', 't', substr(dirname(__FILE__),-1)); -test(dirname(__FILE__) . '/', substr(dirname(__FILE__),-1), 'l'); -test(dirname(__FILE__), substr(dirname(__FILE__),-1), 'l'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===0=== -object(SplFileInfo)#%d (0) { -} -object(SplFileInfo)#%d (0) { -} -bool(false) -bool(true) -bool(true) -string(%d) "%sfileobject_001a.txt" -string(%d) "%sfileobject_001a.txt" -bool(true) -string(%d) "%sfileobject_001a.txt" -bool(true) -string(%d) "%stests" -bool(true) -===1=== -object(SplFileInfo)#%d (0) { -} -object(SplFileInfo)#%d (0) { -} -bool(false) -bool(true) -bool(true) -string(%d) "%stests/" -string(%d) "%stests" -bool(true) -string(%d) "%stests" -bool(true) -string(%d) "%sspl" -bool(true) -===2=== -object(SplFileInfo)#1 (0) { -} -object(SplFileInfo)#2 (0) { -} -bool(false) -bool(true) -bool(true) -string(%d) "%stests" -string(%d) "%stests" -bool(true) -string(%d) "%stests" -bool(true) -string(%d) "%sspl" -bool(true) -===DONE=== diff --git a/ext/spl/tests/iterator_001.phpt b/ext/spl/tests/iterator_001.phpt deleted file mode 100755 index 2239417778..0000000000 --- a/ext/spl/tests/iterator_001.phpt +++ /dev/null @@ -1,173 +0,0 @@ ---TEST-- -SPL: Iterator aggregating inner iterator's methods ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class NumericArrayIterator implements Iterator -{ - protected $a; - protected $i = 0; - - public function __construct($a) - { - echo __METHOD__ . "\n"; - $this->a = $a; - } - - public function rewind() - { - echo __METHOD__ . "\n"; - $this->i = 0; - } - - public function valid() - { - $ret = $this->i < count($this->a); - echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n"; - return $ret; - } - - public function key() - { - echo __METHOD__ . "\n"; - return $this->i; - } - - public function current() - { - echo __METHOD__ . "\n"; - return $this->a[$this->i]; - } - - public function next() - { - echo __METHOD__ . "\n"; - $this->i++; - } - - public function greaterThan($comp) - { - echo get_class($this) . '::' . __FUNCTION__ . '(' . $comp . ")\n"; - return $this->current() > $comp; - } -} - -class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator -{ - public function seek($index) - { - if ($index < count($this->a)) { - $this->i = $index; - } - echo __METHOD__ . '(' . $index . ")\n"; - } -} - -$a = array(1, 2, 3, 4, 5); -$it = new LimitIterator(new NumericArrayIterator($a), 1, 3); -foreach ($it as $v) -{ - print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n"; -} - -echo "===SEEKABLE===\n"; -$a = array(1, 2, 3, 4, 5); -$it = new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3); -foreach($it as $v) -{ - print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n"; -} - -echo "===STACKED===\n"; -echo "Shows '2 is greater than 2' because the test is actually done with the current value which is 3.\n"; -$a = array(1, 2, 3, 4, 5); -$it = new CachingIterator(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3)); -foreach($it as $v) -{ - print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -NumericArrayIterator::__construct -NumericArrayIterator::rewind -NumericArrayIterator::valid(true) -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -NumericArrayIterator::greaterThan(2) -NumericArrayIterator::current -2 is less than or equal 2 -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -NumericArrayIterator::greaterThan(2) -NumericArrayIterator::current -3 is greater than 2 -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -NumericArrayIterator::greaterThan(2) -NumericArrayIterator::current -4 is greater than 2 -NumericArrayIterator::next -===SEEKABLE=== -NumericArrayIterator::__construct -NumericArrayIterator::rewind -SeekableNumericArrayIterator::seek(1) -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -SeekableNumericArrayIterator::greaterThan(2) -NumericArrayIterator::current -2 is less than or equal 2 -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -SeekableNumericArrayIterator::greaterThan(2) -NumericArrayIterator::current -3 is greater than 2 -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -SeekableNumericArrayIterator::greaterThan(2) -NumericArrayIterator::current -4 is greater than 2 -NumericArrayIterator::next -===STACKED=== -Shows '2 is greater than 2' because the test is actually done with the current value which is 3. -NumericArrayIterator::__construct -NumericArrayIterator::rewind -SeekableNumericArrayIterator::seek(1) -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -SeekableNumericArrayIterator::greaterThan(2) -NumericArrayIterator::current -2 is greater than 2 -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -SeekableNumericArrayIterator::greaterThan(2) -NumericArrayIterator::current -3 is greater than 2 -NumericArrayIterator::next -SeekableNumericArrayIterator::greaterThan(2) -NumericArrayIterator::current -4 is greater than 2 -===DONE=== diff --git a/ext/spl/tests/iterator_002.phpt b/ext/spl/tests/iterator_002.phpt deleted file mode 100755 index d56a551c3f..0000000000 --- a/ext/spl/tests/iterator_002.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -SPL: Iterator using getInnerIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class RecursiceArrayIterator extends ArrayIterator implements RecursiveIterator -{ - function hasChildren() - { - return is_array($this->current()); - } - - function getChildren() - { - return new RecursiceArrayIterator($this->current()); - } -} - -class CrashIterator extends FilterIterator implements RecursiveIterator -{ - function accept() - { - return true; - } - - function hasChildren() - { - return $this->getInnerIterator()->hasChildren(); - } - - function getChildren() - { - return new RecursiceArrayIterator($this->getInnerIterator()->current()); - } -} - -$array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3); - -$dir = new RecursiveIteratorIterator(new CrashIterator(new RecursiceArrayIterator($array)), RecursiveIteratorIterator::LEAVES_ONLY); - -foreach ($dir as $file) { - print "$file\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -1 -21 -221 -222 -231 -3 -===DONE=== diff --git a/ext/spl/tests/iterator_003.phpt b/ext/spl/tests/iterator_003.phpt deleted file mode 100755 index c60776cb33..0000000000 --- a/ext/spl/tests/iterator_003.phpt +++ /dev/null @@ -1,97 +0,0 @@ ---TEST-- -SPL: CachingIterator and __toString() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class Student -{ - private $id; - private $name; - - public function __construct($id, $name) - { - $this->id = $id; - $this->name = $name; - } - - public function __toString() - { - return $this->id . ', ' . $this->name; - } - - public function getId() - { - return $this->id; - } -} - -class StudentIdFilter extends FilterIterator -{ - private $id; - - public function __construct(ArrayObject $students, Student $other) - { - FilterIterator::__construct($students->getIterator()); - $this->id = $other->getId(); - } - - public function accept() - { - echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n"; - return $this->current()->getId() == $this->id; - } -} - -class StudentList implements IteratorAggregate -{ - private $students; - - public function __construct() - { - $this->students = new ArrayObject(array()); - } - - public function add(Student $student) - { - if (!$this->contains($student)) { - $this->students[] = $student; - } - } - - public function contains(Student $student) - { - foreach ($this->students as $s) - { - if ($s->getId() == $student->getId()) { - return true; - } - } - return false; - } - - public function getIterator() { - return new CachingIterator($this->students->getIterator(), true); - } -} - -$students = new StudentList(); -$students->add(new Student('01234123', 'Joe')); -$students->add(new Student('00000014', 'Bob')); -$students->add(new Student('00000014', 'Foo')); - -// The goal is to verify we can access the cached string value even if it was -// generated by a call to __toString(). To check this we need to access the -// iterator's __toString() method. -$it = $students->getIterator(); -foreach ($it as $student) { - echo $it->__toString(), "\n"; -} -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -01234123, Joe -00000014, Bob -===DONE=== diff --git a/ext/spl/tests/iterator_004.phpt b/ext/spl/tests/iterator_004.phpt deleted file mode 100755 index 4e6006621b..0000000000 --- a/ext/spl/tests/iterator_004.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -SPL: SeekableIterator and string keys ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class NumericArrayIterator implements Iterator -{ - protected $a; - protected $i; - - public function __construct($a) - { - echo __METHOD__ . "\n"; - $this->a = $a; - } - - public function rewind() - { - echo __METHOD__ . "\n"; - $this->i = 0; - } - - public function valid() - { - $ret = $this->i < count($this->a); - echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n"; - return $ret; - } - - public function key() - { - echo __METHOD__ . "\n"; - return $this->i; - } - - public function current() - { - echo __METHOD__ . "\n"; - return $this->a[$this->i]; - } - - public function next() - { - echo __METHOD__ . "\n"; - $this->i++; - } -} - -class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator -{ - public function seek($index) - { - if ($index < count($this->a)) { - $this->i = $index; - } - echo __METHOD__ . '(' . $index . ")\n"; - } -} - -$a = array(1, 2, 3, 4, 5); -foreach (new LimitIterator(new NumericArrayIterator($a), 1, 3) as $v) -{ - print "$v\n"; -} - -echo "===SEEKABLE===\n"; -$a = array(1, 2, 3, 4, 5); -foreach(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3) as $v) -{ - print "$v\n"; -} - -echo "===SEEKING===\n"; -$a = array(1, 2, 3, 4, 5); -$l = new LimitIterator(new SeekableNumericArrayIterator($a)); -for($i = 1; $i < 4; $i++) -{ - $l->seek($i); - print $l->current() . "\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -NumericArrayIterator::__construct -NumericArrayIterator::rewind -NumericArrayIterator::valid(true) -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -2 -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -3 -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -4 -NumericArrayIterator::next -===SEEKABLE=== -NumericArrayIterator::__construct -NumericArrayIterator::rewind -SeekableNumericArrayIterator::seek(1) -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -2 -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -3 -NumericArrayIterator::next -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -4 -NumericArrayIterator::next -===SEEKING=== -NumericArrayIterator::__construct -SeekableNumericArrayIterator::seek(1) -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -2 -SeekableNumericArrayIterator::seek(2) -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -3 -SeekableNumericArrayIterator::seek(3) -NumericArrayIterator::valid(true) -NumericArrayIterator::current -NumericArrayIterator::key -4 -===DONE=== diff --git a/ext/spl/tests/iterator_005.phpt b/ext/spl/tests/iterator_005.phpt deleted file mode 100755 index 4aae600169..0000000000 --- a/ext/spl/tests/iterator_005.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -SPL: IteratorIterator and ArrayIterator/Object ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class ArrayIteratorEx extends ArrayIterator -{ - function rewind() - { - echo __METHOD__ . "\n"; - return parent::rewind(); - } -} - -$it = new ArrayIteratorEx(range(0,3)); - -foreach(new IteratorIterator($it) as $v) -{ - var_dump($v); -} - -class ArrayObjectEx extends ArrayObject -{ - function getIterator() - { - echo __METHOD__ . "\n"; - return parent::getIterator(); - } -} - -$it = new ArrayObjectEx(range(0,3)); - -foreach(new IteratorIterator($it) as $v) -{ - var_dump($v); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -ArrayIteratorEx::rewind -int(0) -int(1) -int(2) -int(3) -ArrayObjectEx::getIterator -int(0) -int(1) -int(2) -int(3) -===DONE=== diff --git a/ext/spl/tests/iterator_006.phpt b/ext/spl/tests/iterator_006.phpt deleted file mode 100755 index 05a1cc5a94..0000000000 --- a/ext/spl/tests/iterator_006.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -SPL: IteratorIterator and SimpleXMlElement ---SKIPIF-- -<?php if (!extension_loaded("spl") || !extension_loaded('simplexml')) print "skip"; ?> ---FILE-- -<?php - -$root = simplexml_load_string('<?xml version="1.0"?> -<root> - <child>Hello</child> - <child>World</child> -</root> -'); - -foreach (new IteratorIterator($root->child) as $child) { - echo $child."\n"; -} -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -Hello -World -===DONE=== diff --git a/ext/spl/tests/iterator_007.phpt b/ext/spl/tests/iterator_007.phpt deleted file mode 100755 index eb87977ac9..0000000000 --- a/ext/spl/tests/iterator_007.phpt +++ /dev/null @@ -1,168 +0,0 @@ ---TEST-- -SPL: NoRewindIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class ArrayIteratorEx extends ArrayIterator -{ - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } -} - -class NoRewindIteratorEx extends NoRewindIterator -{ - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } -} - -$it = new NoRewindIteratorEx(new ArrayIteratorEx(range(0,3))); - -echo "===0===\n"; -foreach ($it->getInnerIterator() as $v) { - var_dump($v); -} - -echo "===1===\n"; -foreach ($it as $v) { - var_dump($v); -} - -$pos =0; - -$it = new NoRewindIteratorEx(new ArrayIteratorEx(range(0,3))); - -echo "===2===\n"; -foreach ($it as $v) { - var_dump($v); - if ($pos++ > 1) { - break; - } -} - -echo "===3===\n"; -foreach ($it as $v) { - var_dump($v); -} - -echo "===4===\n"; -foreach ($it as $v) { - var_dump($v); -} -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -===0=== -ArrayIteratorEx::rewind -ArrayIteratorEx::valid -ArrayIteratorEx::current -int(0) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::current -int(1) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::current -int(2) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::current -int(3) -ArrayIteratorEx::next -ArrayIteratorEx::valid -===1=== -NoRewindIteratorEx::rewind -NoRewindIteratorEx::valid -ArrayIteratorEx::valid -===2=== -NoRewindIteratorEx::rewind -NoRewindIteratorEx::valid -ArrayIteratorEx::valid -NoRewindIteratorEx::current -ArrayIteratorEx::current -int(0) -NoRewindIteratorEx::next -ArrayIteratorEx::next -NoRewindIteratorEx::valid -ArrayIteratorEx::valid -NoRewindIteratorEx::current -ArrayIteratorEx::current -int(1) -NoRewindIteratorEx::next -ArrayIteratorEx::next -NoRewindIteratorEx::valid -ArrayIteratorEx::valid -NoRewindIteratorEx::current -ArrayIteratorEx::current -int(2) -===3=== -NoRewindIteratorEx::rewind -NoRewindIteratorEx::valid -ArrayIteratorEx::valid -NoRewindIteratorEx::current -int(2) -NoRewindIteratorEx::next -ArrayIteratorEx::next -NoRewindIteratorEx::valid -ArrayIteratorEx::valid -NoRewindIteratorEx::current -ArrayIteratorEx::current -int(3) -NoRewindIteratorEx::next -ArrayIteratorEx::next -NoRewindIteratorEx::valid -ArrayIteratorEx::valid -===4=== -NoRewindIteratorEx::rewind -NoRewindIteratorEx::valid -ArrayIteratorEx::valid -===DONE=== diff --git a/ext/spl/tests/iterator_008.phpt b/ext/spl/tests/iterator_008.phpt deleted file mode 100755 index 5f3c7d89df..0000000000 --- a/ext/spl/tests/iterator_008.phpt +++ /dev/null @@ -1,91 +0,0 @@ ---TEST-- -SPL: InfiniteIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class ArrayIteratorEx extends ArrayIterator -{ - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } -} - -$it = new InfiniteIterator(new ArrayIteratorEx(range(0,2))); - -$pos =0; - -foreach ($it as $v) { - var_dump($v); - if ($pos++ > 5) { - break; - } -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -ArrayIteratorEx::rewind -ArrayIteratorEx::valid -ArrayIteratorEx::current -ArrayIteratorEx::key -int(0) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::current -ArrayIteratorEx::key -int(1) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::current -ArrayIteratorEx::key -int(2) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::rewind -ArrayIteratorEx::valid -ArrayIteratorEx::current -ArrayIteratorEx::key -int(0) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::current -ArrayIteratorEx::key -int(1) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::current -ArrayIteratorEx::key -int(2) -ArrayIteratorEx::next -ArrayIteratorEx::valid -ArrayIteratorEx::rewind -ArrayIteratorEx::valid -ArrayIteratorEx::current -ArrayIteratorEx::key -int(0) -===DONE=== diff --git a/ext/spl/tests/iterator_009.phpt b/ext/spl/tests/iterator_009.phpt deleted file mode 100755 index 27a3e0655f..0000000000 --- a/ext/spl/tests/iterator_009.phpt +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -SPL: EmptyIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class EmptyIteratorEx extends EmptyIterator -{ - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } -} - -foreach (new EmptyIteratorEx() as $v) { - var_dump($v); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -EmptyIteratorEx::rewind -EmptyIteratorEx::valid -===DONE=== diff --git a/ext/spl/tests/iterator_010.phpt b/ext/spl/tests/iterator_010.phpt deleted file mode 100755 index e7e1a519b6..0000000000 --- a/ext/spl/tests/iterator_010.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -SPL: EmptyIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "===EmptyIterator===\n"; - -foreach(new LimitIterator(new EmptyIterator(), 0, 3) as $key => $val) -{ - echo "$key=>$val\n"; -} - -?> -===DONE=== -<?php exit(0); ---EXPECTF-- -===EmptyIterator=== -===DONE=== diff --git a/ext/spl/tests/iterator_011.phpt b/ext/spl/tests/iterator_011.phpt deleted file mode 100755 index aed1ed5e3e..0000000000 --- a/ext/spl/tests/iterator_011.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -SPL: InfiniteIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "===EmptyIterator===\n"; - -foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===InfiniteIterator===\n"; - -$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D')); -$it = new InfiniteIterator($it); -$it = new LimitIterator($it, 2, 5); -foreach($it as $val=>$key) -{ - echo "$val=>$key\n"; -} - -echo "===Infinite/LimitIterator===\n"; - -$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D')); -$it = new LimitIterator($it, 1, 2); -$it = new InfiniteIterator($it); -$it = new LimitIterator($it, 2, 5); -foreach($it as $val=>$key) -{ - echo "$val=>$key\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===EmptyIterator=== -===InfiniteIterator=== -2=>C -3=>D -0=>A -1=>B -2=>C -===Infinite/LimitIterator=== -1=>B -2=>C -1=>B -2=>C -1=>B -===DONE=== diff --git a/ext/spl/tests/iterator_012.phpt b/ext/spl/tests/iterator_012.phpt deleted file mode 100755 index c6eb86eefb..0000000000 --- a/ext/spl/tests/iterator_012.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -SPL: NoRewindIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "===Current===\n"; - -$it = new NoRewindIterator(new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C'))); - -echo $it->key() . '=>' . $it->current() . "\n"; - -echo "===Next===\n"; - -$it->next(); - -echo "===Foreach===\n"; - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===Current=== -0=>A -===Next=== -===Foreach=== -1=>B -2=>C -===DONE=== diff --git a/ext/spl/tests/iterator_013.phpt b/ext/spl/tests/iterator_013.phpt deleted file mode 100755 index 56aea98504..0000000000 --- a/ext/spl/tests/iterator_013.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -SPL: AppendIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "===Empty===\n"; - -$it = new AppendIterator; - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===Append===\n"; - -$it->append(new ArrayIterator(array(0 => 'A', 1 => 'B'))); - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===Rewind===\n"; - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===Append===\n"; - -$it->append(new ArrayIterator(array(2 => 'C', 3 => 'D'))); - -foreach(new NoRewindIterator($it) as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===Rewind===\n"; - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===Empty=== -===Append=== -0=>A -1=>B -===Rewind=== -0=>A -1=>B -===Append=== -2=>C -3=>D -===Rewind=== -0=>A -1=>B -2=>C -3=>D -===DONE=== diff --git a/ext/spl/tests/iterator_014.phpt b/ext/spl/tests/iterator_014.phpt deleted file mode 100755 index 8f9020bf81..0000000000 --- a/ext/spl/tests/iterator_014.phpt +++ /dev/null @@ -1,140 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator and beginChildren/endChildren ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveArrayIterator extends RecursiveArrayIterator -{ - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . " = false\n"; - return false; - } - else - { - return true; - } - } - - function getChildren() - { - echo __METHOD__ . "\n"; - return parent::getChildren(); - } -} - -class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator -{ - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } - - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } - - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } -} - -foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d"))) as $k=>$v) -{ - echo "$k=>$v\n"; -} -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -RecursiveArrayIteratorIterator::rewind -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>a -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::getChildren -RecursiveArrayIteratorIterator::beginChildren(1) -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>ba -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::getChildren -RecursiveArrayIteratorIterator::beginChildren(2) -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>bba -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -1=>bbb -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(2) -MyRecursiveArrayIterator::getChildren -RecursiveArrayIteratorIterator::beginChildren(2) -MyRecursiveArrayIterator::getChildren -RecursiveArrayIteratorIterator::beginChildren(3) -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>bcaa -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(3) -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(2) -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(1) -MyRecursiveArrayIterator::getChildren -RecursiveArrayIteratorIterator::beginChildren(1) -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>ca -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(1) -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -3=>d -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::valid -MyRecursiveArrayIterator::valid = false -===DONE=== diff --git a/ext/spl/tests/iterator_015.phpt b/ext/spl/tests/iterator_015.phpt deleted file mode 100755 index 57b9899e6c..0000000000 --- a/ext/spl/tests/iterator_015.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator and beginChildren/endChildren ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator -{ - function rewind() - { - echo "<ul>\n"; - parent::rewind(); - } - function beginChildren() - { - echo str_repeat(' ',$this->getDepth())."<ul>\n"; - } - - function endChildren() - { - echo str_repeat(' ',$this->getDepth())."</ul>\n"; - } - function valid() - { - if (!parent::valid()) { - echo "<ul>\n"; - return false; - } - return true; - } -} - -$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d"); -$obj = new RecursiveArrayIterator($arr); -$rit = new RecursiveArrayIteratorIterator($obj); -foreach($rit as $k=>$v) -{ - echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n"; -} -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -<ul> - 0=>a - <ul> - 0=>ba - <ul> - 0=>bba - 1=>bbb - </ul> - <ul> - <ul> - 0=>bcaa - </ul> - </ul> - </ul> - <ul> - 0=>ca - </ul> - 3=>d -<ul> -===DONE=== diff --git a/ext/spl/tests/iterator_016.phpt b/ext/spl/tests/iterator_016.phpt deleted file mode 100755 index 4801835a1b..0000000000 --- a/ext/spl/tests/iterator_016.phpt +++ /dev/null @@ -1,78 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator and beginChildren/endChildren ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class Menu extends ArrayObject -{ - function getIterator() - { - echo __METHOD__ . "\n"; - return new RecursiveArrayIterator($this); - } -} - -class MenuOutput extends RecursiveIteratorIterator -{ - function __construct(Menu $it) - { - parent::__construct($it); - } - function rewind() - { - echo "<ul>\n"; - parent::rewind(); - } - function beginChildren() - { - echo str_repeat(' ',$this->getDepth())."<ul>\n"; - } - - function endChildren() - { - echo str_repeat(' ',$this->getDepth())."</ul>\n"; - } - function valid() - { - if (!parent::valid()) { - echo "<ul>\n"; - return false; - } - return true; - } -} - -$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d"); -$obj = new Menu($arr); -$rit = new MenuOutput($obj); -foreach($rit as $k=>$v) -{ - echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n"; -} -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Menu::getIterator -<ul> - 0=>a - <ul> - 0=>ba - <ul> - 0=>bba - 1=>bbb - </ul> - <ul> - <ul> - 0=>bcaa - </ul> - </ul> - </ul> - <ul> - 0=>ca - </ul> - 3=>d -<ul> -===DONE=== diff --git a/ext/spl/tests/iterator_017.phpt b/ext/spl/tests/iterator_017.phpt deleted file mode 100755 index e7e1a519b6..0000000000 --- a/ext/spl/tests/iterator_017.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -SPL: EmptyIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "===EmptyIterator===\n"; - -foreach(new LimitIterator(new EmptyIterator(), 0, 3) as $key => $val) -{ - echo "$key=>$val\n"; -} - -?> -===DONE=== -<?php exit(0); ---EXPECTF-- -===EmptyIterator=== -===DONE=== diff --git a/ext/spl/tests/iterator_018.phpt b/ext/spl/tests/iterator_018.phpt deleted file mode 100755 index 3cb68eeea8..0000000000 --- a/ext/spl/tests/iterator_018.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -SPL: InfiniteIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "===EmptyIterator===\n"; - -foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===InfiniteIterator===\n"; - -$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D')); -$it = new InfiniteIterator($it); -$it = new LimitIterator($it, 2, 5); -foreach($it as $val=>$key) -{ - echo "$val=>$key\n"; -} - -echo "===Infinite/LimitIterator===\n"; - -$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D')); -$it = new LimitIterator($it, 1, 2); -$it = new InfiniteIterator($it); -$it = new LimitIterator($it, 2, 5); -foreach($it as $val=>$key) -{ - echo "$val=>$key\n"; -} - -?> -===DONE=== -<?php exit(0); ---EXPECTF-- -===EmptyIterator=== -===InfiniteIterator=== -2=>C -3=>D -0=>A -1=>B -2=>C -===Infinite/LimitIterator=== -1=>B -2=>C -1=>B -2=>C -1=>B -===DONE=== diff --git a/ext/spl/tests/iterator_019.phpt b/ext/spl/tests/iterator_019.phpt deleted file mode 100755 index c6eb86eefb..0000000000 --- a/ext/spl/tests/iterator_019.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -SPL: NoRewindIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "===Current===\n"; - -$it = new NoRewindIterator(new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C'))); - -echo $it->key() . '=>' . $it->current() . "\n"; - -echo "===Next===\n"; - -$it->next(); - -echo "===Foreach===\n"; - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===Current=== -0=>A -===Next=== -===Foreach=== -1=>B -2=>C -===DONE=== diff --git a/ext/spl/tests/iterator_020.phpt b/ext/spl/tests/iterator_020.phpt deleted file mode 100755 index 56aea98504..0000000000 --- a/ext/spl/tests/iterator_020.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -SPL: AppendIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "===Empty===\n"; - -$it = new AppendIterator; - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===Append===\n"; - -$it->append(new ArrayIterator(array(0 => 'A', 1 => 'B'))); - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===Rewind===\n"; - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===Append===\n"; - -$it->append(new ArrayIterator(array(2 => 'C', 3 => 'D'))); - -foreach(new NoRewindIterator($it) as $key=>$val) -{ - echo "$key=>$val\n"; -} - -echo "===Rewind===\n"; - -foreach($it as $key=>$val) -{ - echo "$key=>$val\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===Empty=== -===Append=== -0=>A -1=>B -===Rewind=== -0=>A -1=>B -===Append=== -2=>C -3=>D -===Rewind=== -0=>A -1=>B -2=>C -3=>D -===DONE=== diff --git a/ext/spl/tests/iterator_021.phpt b/ext/spl/tests/iterator_021.phpt deleted file mode 100755 index 1dbd245bc8..0000000000 --- a/ext/spl/tests/iterator_021.phpt +++ /dev/null @@ -1,182 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator and hasChildren ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveArrayIterator extends RecursiveArrayIterator -{ - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . " = false\n"; - return false; - } - else - { - return true; - } - } - - function getChildren() - { - echo __METHOD__ . "\n"; - return parent::getChildren(); - } -} - -class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator -{ - private $max_depth; - private $over = 0; - private $skip = false; - - function __construct($it, $max_depth) - { - $this->max_depth = $max_depth; - parent::__construct($it); - } - - function rewind() - { - echo __METHOD__ . "\n"; - $this->skip = false; - parent::rewind(); - } - - function valid() - { - echo __METHOD__ . "\n"; - if ($this->skip) - { - $this->skip = false; - $this->next(); - } - return parent::valid(); - } - - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } - - function callHasChildren() - { - $this->skip = false; - $has = parent::callHasChildren(); - $res = $this->getDepth() < $this->max_depth && $has; - echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; - if ($has && !$res) - { - $this->over++; - if ($this->over == 2) { - $this->skip = true; - } - } - return $res; - } - - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } - - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } -} - -foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v) -{ - if (is_array($v)) $v = join('',$v); - echo "$k=>$v\n"; -} -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -RecursiveArrayIteratorIterator::rewind -RecursiveArrayIteratorIterator::callHasChildren(0) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>a -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes -MyRecursiveArrayIterator::getChildren -RecursiveArrayIteratorIterator::beginChildren(1) -RecursiveArrayIteratorIterator::callHasChildren(1) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>ba -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes -MyRecursiveArrayIterator::getChildren -RecursiveArrayIteratorIterator::beginChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(2) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>bba -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(2) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -1=>bbb -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes -MyRecursiveArrayIterator::getChildren -RecursiveArrayIteratorIterator::beginChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>bcaa -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(2) -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(1) -RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes -MyRecursiveArrayIterator::getChildren -RecursiveArrayIteratorIterator::beginChildren(1) -RecursiveArrayIteratorIterator::callHasChildren(1) = no/no -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>ca -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(1) -RecursiveArrayIteratorIterator::callHasChildren(0) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -3=>d -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::valid -MyRecursiveArrayIterator::valid = false -===DONE=== diff --git a/ext/spl/tests/iterator_022.phpt b/ext/spl/tests/iterator_022.phpt deleted file mode 100755 index 1f1e6e951a..0000000000 --- a/ext/spl/tests/iterator_022.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator and callHasChildren/callGetChildren ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveArrayIterator extends RecursiveArrayIterator -{ - function getChildren() - { - echo __METHOD__ . "\n"; - return $this->current(); - } - - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . " = false\n"; - return false; - } - else - { - return true; - } - } -} - -class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator -{ - private $max_depth; - private $over = 0; - private $skip = false; - - function __construct($it, $max_depth) - { - $this->max_depth = $max_depth; - parent::__construct($it); - } - - function rewind() - { - echo __METHOD__ . "\n"; - $this->skip = false; - parent::rewind(); - } - - function valid() - { - echo __METHOD__ . "\n"; - if ($this->skip) - { - $this->skip = false; - $this->next(); - } - return parent::valid(); - } - - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } - - function callHasChildren() - { - $this->skip = false; - $has = parent::callHasChildren(); - $res = $this->getDepth() < $this->max_depth && $has; - echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; - if ($has && !$res) - { - $this->over++; - if ($this->over == 2) { - $this->skip = true; - } - } - return $res; - } - - function callGetChildren() - { - if ($this->over == 2) - { - echo __METHOD__ . "(skip)\n"; - return NULL; - } - echo __METHOD__ . "(ok:{$this->over})\n"; - return new MyRecursiveArrayIterator($this->current()); - } - - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } - - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } -} - -try -{ - foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v) - { - if (is_array($v)) $v = join('',$v); - echo "$k=>$v\n"; - } -} -catch(UnexpectedValueException $e) -{ - echo $e->getMessage() . "\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -RecursiveArrayIteratorIterator::rewind -RecursiveArrayIteratorIterator::callHasChildren(0) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>a -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes -RecursiveArrayIteratorIterator::callGetChildren(ok:0) -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::beginChildren(1) -RecursiveArrayIteratorIterator::callHasChildren(1) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>ba -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes -RecursiveArrayIteratorIterator::callGetChildren(ok:0) -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::beginChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(2) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>bba -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(2) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -1=>bbb -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes -RecursiveArrayIteratorIterator::callGetChildren(ok:0) -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::beginChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>bcaa -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(2) -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(1) -RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes -RecursiveArrayIteratorIterator::callGetChildren(skip) -Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator -===DONE=== diff --git a/ext/spl/tests/iterator_023.phpt b/ext/spl/tests/iterator_023.phpt deleted file mode 100755 index 00b831e116..0000000000 --- a/ext/spl/tests/iterator_023.phpt +++ /dev/null @@ -1,195 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator and catch getChildren ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveArrayIterator extends RecursiveArrayIterator -{ - function getChildren() - { - echo __METHOD__ . "\n"; - return $this->current(); - } - - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . " = false\n"; - return false; - } - else - { - return true; - } - } -} - -class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator -{ - private $max_depth; - private $over = 0; - private $skip = false; - - function __construct($it, $max_depth) - { - $this->max_depth = $max_depth; - parent::__construct($it, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); - } - - function rewind() - { - echo __METHOD__ . "\n"; - $this->skip = false; - parent::rewind(); - } - - function valid() - { - echo __METHOD__ . "\n"; - if ($this->skip) - { - $this->skip = false; - $this->next(); - } - return parent::valid(); - } - - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - - function next() - { - echo __METHOD__ . "\n"; - parent::next(); - } - - function callHasChildren() - { - $this->skip = false; - $has = parent::callHasChildren(); - $res = $this->getDepth() < $this->max_depth && $has; - echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; - if ($has && !$res) - { - $this->over++; - if ($this->over == 2) { - $this->skip = true; - } - } - return $res; - } - - function callGetChildren() - { - if ($this->over == 2) - { - echo __METHOD__ . "(throw)\n"; - throw new Exception("Thrown in callGetChildren()"); - } - echo __METHOD__ . "(ok:{$this->over})\n"; - return new MyRecursiveArrayIterator($this->current()); - } - - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } - - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - } -} - -try -{ - foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v) - { - if (is_array($v)) $v = join('',$v); - echo "$k=>$v\n"; - } -} -catch(UnexpectedValueException $e) -{ - echo $e->getMessage() . "\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -RecursiveArrayIteratorIterator::rewind -RecursiveArrayIteratorIterator::callHasChildren(0) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>a -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes -RecursiveArrayIteratorIterator::callGetChildren(ok:0) -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::beginChildren(1) -RecursiveArrayIteratorIterator::callHasChildren(1) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>ba -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes -RecursiveArrayIteratorIterator::callGetChildren(ok:0) -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::beginChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(2) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>bba -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(2) = no/no -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -1=>bbb -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes -RecursiveArrayIteratorIterator::callGetChildren(ok:0) -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::beginChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -0=>bcaa -RecursiveArrayIteratorIterator::next -RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes -RecursiveArrayIteratorIterator::valid -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(2) -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::endChildren(1) -RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes -RecursiveArrayIteratorIterator::callGetChildren(throw) -RecursiveArrayIteratorIterator::callHasChildren(0) = no/no -RecursiveArrayIteratorIterator::current -RecursiveArrayIteratorIterator::key -3=>d -RecursiveArrayIteratorIterator::next -MyRecursiveArrayIterator::valid = false -RecursiveArrayIteratorIterator::valid -MyRecursiveArrayIterator::valid = false -===DONE=== diff --git a/ext/spl/tests/iterator_024.phpt b/ext/spl/tests/iterator_024.phpt deleted file mode 100755 index 8a6fe210cc..0000000000 --- a/ext/spl/tests/iterator_024.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator with custom iterator class ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = array(1, 2, array(31, 32, array(331)), 4); - -foreach(new RecursiveIteratorIterator(new ArrayObject($ar, 0, "RecursiveArrayIterator")) as $v) echo "$v\n"; - -$it = new ArrayObject($ar); -var_dump($it->getIteratorClass()); - -try -{ - foreach(new RecursiveIteratorIterator(new ArrayObject($ar)) as $v) echo "$v\n"; -} -catch (InvalidArgumentException $e) -{ - echo $e->getMessage() . "\n"; -} - -echo "===MANUAL===\n"; - -$it->setIteratorClass("RecursiveArrayIterator"); -var_dump($it->getIteratorClass()); -foreach(new RecursiveIteratorIterator($it) as $v) echo "$v\n"; - - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -1 -2 -31 -32 -331 -4 -string(13) "ArrayIterator" -An instance of RecursiveIterator or IteratorAggregate creating it is required -===MANUAL=== -string(22) "RecursiveArrayIterator" -1 -2 -31 -32 -331 -4 -===DONE=== diff --git a/ext/spl/tests/iterator_025.phpt b/ext/spl/tests/iterator_025.phpt deleted file mode 100755 index 737b8f6664..0000000000 --- a/ext/spl/tests/iterator_025.phpt +++ /dev/null @@ -1,94 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator and begin/endIteration() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveIteratorIterator extends RecursiveIteratorIterator -{ - function beginIteration() - { - echo __METHOD__ . "()\n"; - } - - function endIteration() - { - echo __METHOD__ . "()\n"; - } -} - -$ar = array(1, 2, array(31, 32, array(331)), 4); - -$it = new MyRecursiveIteratorIterator(new ArrayObject($ar, 0, "RecursiveArrayIterator")); - -foreach($it as $v) echo "$v\n"; - -echo "===MORE===\n"; - -foreach($it as $v) echo "$v\n"; - -echo "===MORE===\n"; - -$it->rewind(); -foreach($it as $v) echo "$v\n"; -var_dump($it->valid()); - -echo "===MANUAL===\n"; - -$it->rewind(); -while($it->valid()) -{ - echo $it->current() . "\n"; - $it->next(); - break; -} -$it->rewind(); -while($it->valid()) -{ - echo $it->current() . "\n"; - $it->next(); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -MyRecursiveIteratorIterator::beginIteration() -1 -2 -31 -32 -331 -4 -MyRecursiveIteratorIterator::endIteration() -===MORE=== -MyRecursiveIteratorIterator::beginIteration() -1 -2 -31 -32 -331 -4 -MyRecursiveIteratorIterator::endIteration() -===MORE=== -MyRecursiveIteratorIterator::beginIteration() -1 -2 -31 -32 -331 -4 -MyRecursiveIteratorIterator::endIteration() -bool(false) -===MANUAL=== -MyRecursiveIteratorIterator::beginIteration() -1 -1 -2 -31 -32 -331 -4 -MyRecursiveIteratorIterator::endIteration() -===DONE=== diff --git a/ext/spl/tests/iterator_026.phpt b/ext/spl/tests/iterator_026.phpt deleted file mode 100755 index 4c6fcf73b5..0000000000 --- a/ext/spl/tests/iterator_026.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -SPL: CachingIterator::hasNext() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = array(1, 2, array(31, 32, array(331)), 4); - -$it = new RecursiveArrayIterator($ar); -$it = new RecursiveCachingIterator($it); -$it = new RecursiveIteratorIterator($it); - -foreach($it as $k=>$v) -{ - echo "$k=>$v\n"; - echo "hasNext: " . ($it->getInnerIterator()->hasNext() ? "yes" : "no") . "\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -0=>1 -hasNext: yes -1=>2 -hasNext: yes -0=>31 -hasNext: yes -1=>32 -hasNext: yes -0=>331 -hasNext: no -3=>4 -hasNext: no -===DONE=== diff --git a/ext/spl/tests/iterator_027.phpt b/ext/spl/tests/iterator_027.phpt deleted file mode 100755 index 601515e8fd..0000000000 --- a/ext/spl/tests/iterator_027.phpt +++ /dev/null @@ -1,85 +0,0 @@ ---TEST-- -SPL: CachingIterator::FULL_CACHE ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = array(1, 2, array(31, 32, array(331)), 4); - -$it = new RecursiveArrayIterator($ar); -$it = new RecursiveIteratorIterator($it); -$it = new CachingIterator($it, CachingIterator::FULL_CACHE); - -foreach($it as $k=>$v) -{ - echo "$k=>$v\n"; -} - -echo "===CHECK===\n"; - -for ($i = 0; $i < 4; $i++) -{ - if (isset($it[$i])) - { - var_dump($i, $it[$i]); - } -} - -$it[2] = 'foo'; -$it[3] = 'bar'; -$it['baz'] = '25'; - -var_dump($it[2]); -var_dump($it[3]); -var_dump($it['baz']); - -unset($it[0]); -unset($it[2]); -unset($it['baz']); - -var_dump(isset($it[0])); // unset -var_dump(isset($it[1])); // still present -var_dump(isset($it[2])); // unset -var_dump(isset($it[3])); // still present -var_dump(isset($it['baz'])); - -echo "===REWIND===\n"; - -$it->rewind(); // cleans and reads first element -var_dump(isset($it[0])); // pre-fetched -var_dump(isset($it[1])); // deleted -var_dump(isset($it[2])); // unset -var_dump(isset($it[3])); // deleted - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -0=>1 -1=>2 -0=>31 -1=>32 -0=>331 -3=>4 -===CHECK=== -int(0) -int(331) -int(1) -int(32) -int(3) -int(4) -string(3) "foo" -string(3) "bar" -string(2) "25" -bool(false) -bool(true) -bool(false) -bool(true) -bool(false) -===REWIND=== -bool(true) -bool(false) -bool(false) -bool(false) -===DONE=== diff --git a/ext/spl/tests/iterator_028.phpt b/ext/spl/tests/iterator_028.phpt deleted file mode 100755 index 8fef74d776..0000000000 --- a/ext/spl/tests/iterator_028.phpt +++ /dev/null @@ -1,114 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator and setMaxDepth() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = array(1, 2, array(31, 32, array(331, array(3321, array(33221)))), 4); - -$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($ar)); - -echo "===?===\n"; -var_dump($it->getMaxDepth()); -foreach($it as $v) echo $it->getDepth() . ": $v\n"; - -echo "===2===\n"; -$it->setMaxDepth(2); -var_dump($it->getMaxDepth()); -foreach($it as $v) echo $it->getDepth() . ": $v\n"; - -echo "===X===\n"; -$it->setMaxDepth(); -var_dump($it->getMaxDepth()); -foreach($it as $v) echo $it->getDepth() . ": $v\n"; - -echo "===3===\n"; -$it->setMaxDepth(3); -var_dump($it->getMaxDepth()); -foreach($it as $v) echo $it->getDepth() . ": $v\n"; - -echo "===5===\n"; -$it->setMaxDepth(5); -var_dump($it->getMaxDepth()); -foreach($it as $v) echo $it->getDepth() . ": $v\n"; - -echo "===0===\n"; -$it->setMaxDepth(0); -var_dump($it->getMaxDepth()); -foreach($it as $v) echo $it->getDepth() . ": $v\n"; - -echo "===-1===\n"; -$it->setMaxDepth(-1); -var_dump($it->getMaxDepth()); -try -{ - $it->setMaxDepth(4); - $it->setMaxDepth(-2); -} -catch(Exception $e) -{ - var_dump($e->getMessage()); -} -var_dump($it->getMaxDepth()); -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -===?=== -bool(false) -0: 1 -0: 2 -1: 31 -1: 32 -2: 331 -3: 3321 -4: 33221 -0: 4 -===2=== -int(2) -0: 1 -0: 2 -1: 31 -1: 32 -2: 331 -0: 4 -===X=== -bool(false) -0: 1 -0: 2 -1: 31 -1: 32 -2: 331 -3: 3321 -4: 33221 -0: 4 -===3=== -int(3) -0: 1 -0: 2 -1: 31 -1: 32 -2: 331 -3: 3321 -0: 4 -===5=== -int(5) -0: 1 -0: 2 -1: 31 -1: 32 -2: 331 -3: 3321 -4: 33221 -0: 4 -===0=== -int(0) -0: 1 -0: 2 -0: 4 -===-1=== -bool(false) -string(33) "Parameter max_depth must be >= -1" -int(4) -===DONE=== diff --git a/ext/spl/tests/iterator_029.phpt b/ext/spl/tests/iterator_029.phpt deleted file mode 100755 index 3e836adef6..0000000000 --- a/ext/spl/tests/iterator_029.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -SPL: RegexIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = array(0, "123", 123, 22 => "abc", "a2b", 22, "a2d" => 7, 42); - -foreach(new RegexIterator(new ArrayIterator($ar), "/2/") as $k => $v) -{ - echo "$k=>$v\n"; -} - -?> -===KEY=== -<?php - -foreach(new RegexIterator(new ArrayIterator($ar), "/2/", 0, RegexIterator::USE_KEY) as $k => $v) -{ - echo "$k=>$v\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -1=>123 -2=>123 -23=>a2b -24=>22 -25=>42 -===KEY=== -2=>123 -22=>abc -23=>a2b -24=>22 -a2d=>7 -25=>42 -===DONE=== diff --git a/ext/spl/tests/iterator_030.phpt b/ext/spl/tests/iterator_030.phpt deleted file mode 100755 index 6ed8035ac1..0000000000 --- a/ext/spl/tests/iterator_030.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -SPL: EmptyIterator access ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$it = new EmptyIterator; - -var_dump($it->valid()); -$it->rewind(); -var_dump($it->valid()); -$it->next(); -var_dump($it->valid()); - -try -{ - var_dump($it->key()); -} -catch(BadMethodCallException $e) -{ - echo $e->getMessage() . "\n"; -} - -try -{ - var_dump($it->current()); -} -catch(BadMethodCallException $e) -{ - echo $e->getMessage() . "\n"; -} - -var_dump($it->valid()); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -bool(false) -bool(false) -bool(false) -Accessing the key of an EmptyIterator -Accessing the value of an EmptyIterator -bool(false) -===DONE=== diff --git a/ext/spl/tests/iterator_031.phpt b/ext/spl/tests/iterator_031.phpt deleted file mode 100755 index 00afa61850..0000000000 --- a/ext/spl/tests/iterator_031.phpt +++ /dev/null @@ -1,118 +0,0 @@ ---TEST-- -SPL: AppendIterator::append() rewinds when neccessary ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyArrayIterator extends ArrayIterator -{ - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } -} - -$it = new MyArrayIterator(array(1,2)); - -foreach($it as $k=>$v) -{ - echo "$k=>$v\n"; -} - -class MyAppendIterator extends AppendIterator -{ - function __construct() - { - echo __METHOD__ . "\n"; - } - - function rewind() - { - echo __METHOD__ . "\n"; - parent::rewind(); - } - - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - - function append(Iterator $what) - { - echo __METHOD__ . "\n"; - parent::append($what); - } - - function parent__construct() - { - parent::__construct(); - } -} - -$ap = new MyAppendIterator; - -try -{ - $ap->append($it); -} -catch(BadMethodCallException $e) -{ - echo $e->getMessage() . "\n"; -} - -$ap->parent__construct(); - -try -{ - $ap->parent__construct($it); -} -catch(BadMethodCallException $e) -{ - echo $e->getMessage() . "\n"; -} - -$ap->append($it); -$ap->append($it); -$ap->append($it); - -foreach($ap as $k=>$v) -{ - echo "$k=>$v\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -MyArrayIterator::rewind -0=>1 -1=>2 -MyAppendIterator::__construct -MyAppendIterator::append -Classes derived from AppendIterator must call AppendIterator::__construct() -AppendIterator::getIterator() must be called exactly once per instance -MyAppendIterator::append -MyArrayIterator::rewind -MyAppendIterator::append -MyAppendIterator::append -MyAppendIterator::rewind -MyArrayIterator::rewind -MyAppendIterator::valid -0=>1 -MyAppendIterator::valid -1=>2 -MyArrayIterator::rewind -MyAppendIterator::valid -0=>1 -MyAppendIterator::valid -1=>2 -MyArrayIterator::rewind -MyAppendIterator::valid -0=>1 -MyAppendIterator::valid -1=>2 -MyAppendIterator::valid -===DONE=== diff --git a/ext/spl/tests/iterator_032.phpt b/ext/spl/tests/iterator_032.phpt deleted file mode 100755 index 86695d4af8..0000000000 --- a/ext/spl/tests/iterator_032.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -SPL: LimitIterator::getPosition() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$it = new LimitIterator(new ArrayIterator(array(1,2,3,4)), 1, 2); - -foreach($it as $k=>$v) -{ - echo "$k=>$v\n"; - var_dump($it->getPosition()); -} - -try -{ - $it->seek(0); -} -catch(OutOfBoundsException $e) -{ - echo $e->getMessage() . "\n"; -} - -$it->seek(2); -var_dump($it->current()); - -try -{ - $it->seek(3); -} -catch(OutOfBoundsException $e) -{ - echo $e->getMessage() . "\n"; -} - -$it->next(); -var_dump($it->valid()); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -1=>2 -int(1) -2=>3 -int(2) -Cannot seek to 0 which is below the offset 1 -int(3) -Cannot seek to 3 which is behind offest 1 plus count 2 -bool(false) -===DONE=== diff --git a/ext/spl/tests/iterator_033.phpt b/ext/spl/tests/iterator_033.phpt deleted file mode 100755 index c1880cb2fb..0000000000 --- a/ext/spl/tests/iterator_033.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -SPL: ParentIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$it = new ParentIterator(new RecursiveArrayIterator(array(1,array(21,22, array(231)),3))); - -foreach(new RecursiveIteratorIterator($it) as $k=>$v) -{ - var_dump($k); - var_dump($v); -} - -echo "==SECOND==\n"; - -foreach(new RecursiveIteratorIterator($it, 1) as $k=>$v) -{ - var_dump($k); - var_dump($v); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -==SECOND== -int(1) -array(3) { - [0]=> - int(21) - [1]=> - int(22) - [2]=> - array(1) { - [0]=> - int(231) - } -} -int(2) -array(1) { - [0]=> - int(231) -} -===DONE=== diff --git a/ext/spl/tests/iterator_034.phpt b/ext/spl/tests/iterator_034.phpt deleted file mode 100755 index b81c6d970e..0000000000 --- a/ext/spl/tests/iterator_034.phpt +++ /dev/null @@ -1,190 +0,0 @@ ---TEST-- -SPL: RecursiveIteratorIterator and break deep ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveArrayIterator extends RecursiveArrayIterator -{ - function valid() - { - if (!parent::valid()) - { - echo __METHOD__ . "() = false\n"; - return false; - } - else - { - return true; - } - } - - function getChildren() - { - echo __METHOD__ . "()\n"; - return parent::getChildren(); - } - - function rewind() - { - echo __METHOD__ . "()\n"; - parent::rewind(); - } -} - -class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator -{ - private $max_depth; - private $over = 0; - - function __construct($it, $max_depth) - { - $this->max_depth = $max_depth; - parent::__construct($it); - } - - function rewind() - { - echo __METHOD__ . "() - BEGIN\n"; - parent::rewind(); - echo __METHOD__ . "() - DONE\n"; - } - - function valid() - { - echo __METHOD__ . "()\n"; - return parent::valid(); - } - - function current() - { - echo __METHOD__ . "()\n"; - return parent::current(); - } - - function key() - { - echo __METHOD__ . "()\n"; - return parent::key(); - } - - function next() - { - echo __METHOD__ . "()\n"; - parent::next(); - } - - function callHasChildren() - { - $has = parent::callHasChildren(); - $res = $this->getDepth() < $this->max_depth && $has; - echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n"; - return $res; - } - - function beginChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - parent::beginChildren(); - } - - function endChildren() - { - echo __METHOD__ . "(".$this->getDepth().")\n"; - parent::endChildren(); - } -} - -$p = 0; -$it = new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2); -foreach($it as $k=>$v) -{ - if (is_array($v)) $v = join('',$v); - echo "$k=>$v\n"; - if ($p++ == 5) - { - echo "===BREAK===\n"; - break; - } -} - -echo "===FOREND===\n"; - -$it->rewind(); - -echo "===CHECK===\n"; - -var_dump($it->valid()); -var_dump($it->current() == "a"); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -RecursiveArrayIteratorIterator::rewind() - BEGIN -MyRecursiveArrayIterator::rewind() -RecursiveArrayIteratorIterator::callHasChildren(0) = no/no -RecursiveArrayIteratorIterator::rewind() - DONE -RecursiveArrayIteratorIterator::valid() -RecursiveArrayIteratorIterator::current() -RecursiveArrayIteratorIterator::key() -0=>a -RecursiveArrayIteratorIterator::next() -RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes -MyRecursiveArrayIterator::getChildren() -MyRecursiveArrayIterator::rewind() -RecursiveArrayIteratorIterator::beginChildren(1) -RecursiveArrayIteratorIterator::callHasChildren(1) = no/no -RecursiveArrayIteratorIterator::valid() -RecursiveArrayIteratorIterator::current() -RecursiveArrayIteratorIterator::key() -0=>ba -RecursiveArrayIteratorIterator::next() -RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes -MyRecursiveArrayIterator::getChildren() -MyRecursiveArrayIterator::rewind() -RecursiveArrayIteratorIterator::beginChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(2) = no/no -RecursiveArrayIteratorIterator::valid() -RecursiveArrayIteratorIterator::current() -RecursiveArrayIteratorIterator::key() -0=>bba -RecursiveArrayIteratorIterator::next() -RecursiveArrayIteratorIterator::callHasChildren(2) = no/no -RecursiveArrayIteratorIterator::valid() -RecursiveArrayIteratorIterator::current() -RecursiveArrayIteratorIterator::key() -1=>bbb -RecursiveArrayIteratorIterator::next() -MyRecursiveArrayIterator::valid() = false -RecursiveArrayIteratorIterator::endChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes -MyRecursiveArrayIterator::getChildren() -MyRecursiveArrayIterator::rewind() -RecursiveArrayIteratorIterator::beginChildren(2) -RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes -RecursiveArrayIteratorIterator::valid() -RecursiveArrayIteratorIterator::current() -RecursiveArrayIteratorIterator::key() -0=>bcaa -RecursiveArrayIteratorIterator::next() -RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes -RecursiveArrayIteratorIterator::valid() -RecursiveArrayIteratorIterator::current() -RecursiveArrayIteratorIterator::key() -1=>bcba -===BREAK=== -===FOREND=== -RecursiveArrayIteratorIterator::rewind() - BEGIN -RecursiveArrayIteratorIterator::endChildren(1) -RecursiveArrayIteratorIterator::endChildren(0) -MyRecursiveArrayIterator::rewind() -RecursiveArrayIteratorIterator::callHasChildren(0) = no/no -RecursiveArrayIteratorIterator::rewind() - DONE -===CHECK=== -RecursiveArrayIteratorIterator::valid() -bool(true) -RecursiveArrayIteratorIterator::current() -bool(true) -===DONE=== diff --git a/ext/spl/tests/iterator_035.phpt b/ext/spl/tests/iterator_035.phpt deleted file mode 100644 index eebc7f22a4..0000000000 --- a/ext/spl/tests/iterator_035.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -SPL: ArrayIterator and values assigned by reference ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$tmp = 1; - -$a = new ArrayIterator(); -$a[] = $tmp; -$a[] = &$tmp; - -echo "Done\n"; -?> ---EXPECTF-- -Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %s on line %d diff --git a/ext/spl/tests/iterator_036.phpt b/ext/spl/tests/iterator_036.phpt deleted file mode 100755 index 3eb0eefa6b..0000000000 --- a/ext/spl/tests/iterator_036.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -SPL: CachingIterator and __toString and flags = 0 ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -function test($it) -{ - foreach($it as $v) - { - var_dump((string)$it); - } -} - -$ar = new ArrayIterator(array(1, 2, 3)); - -test(new CachingIterator($ar, 0)); - -?> -===DONE=== ---EXPECTF-- - -Fatal error: Method CachingIterator::__toString() must not throw an exception in %siterator_036.php on line %d diff --git a/ext/spl/tests/iterator_037.phpt b/ext/spl/tests/iterator_037.phpt deleted file mode 100755 index be79468f3a..0000000000 --- a/ext/spl/tests/iterator_037.phpt +++ /dev/null @@ -1,133 +0,0 @@ ---TEST-- -SPL: CachingIterator and __toString ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -function test($ar, $flags) -{ - echo "===$flags===\n"; - $it = new CachingIterator($ar, 0); - try - { - $it->setFlags($flags); - } - catch (Exception $e) - { - echo 'Exception: ' . $e->getMessage() . "\n"; - var_dump($it->getFlags()); - return; - } - var_dump($it->getFlags()); - try - { - foreach($it as $v) - { - var_dump((string)$it); - } - } - catch (Exception $e) - { - echo 'Exception: ' . $e->getMessage() . "\n"; - } -} - -class MyItem -{ - function __construct($value) - { - $this->value = $value; - } - - function __toString() - { - return (string)$this->value; - } -} - -class MyArrayIterator extends ArrayIterator -{ - function __toString() - { - return $this->key() . ':' . $this->current(); - } -} - -$ar = new MyArrayIterator(array(1, 2, 3)); - -test($ar, CachingIterator::CALL_TOSTRING); -test($ar, CachingIterator::TOSTRING_USE_KEY); -test($ar, CachingIterator::TOSTRING_USE_CURRENT); - -$ar = new MyArrayIterator(array(new MyItem(1), new MyItem(2), new MyItem(3))); - -test($ar, CachingIterator::TOSTRING_USE_INNER); -test($ar, CachingIterator::CALL_TOSTRING | CachingIterator::TOSTRING_USE_KEY); -test($ar, CachingIterator::CALL_TOSTRING | CachingIterator::TOSTRING_USE_CURRENT); -test($ar, CachingIterator::CALL_TOSTRING | CachingIterator::TOSTRING_USE_INNER); -test($ar, CachingIterator::TOSTRING_USE_KEY | CachingIterator::TOSTRING_USE_CURRENT); -test($ar, CachingIterator::TOSTRING_USE_KEY | CachingIterator::TOSTRING_USE_INNER); - -echo "===X===\n"; -try -{ - $it = new CachingIterator($ar, CachingIterator::CALL_TOSTRING); - $it->setFlags(0); -} -catch (Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} -try -{ - $it = new CachingIterator($ar, CachingIterator::TOSTRING_USE_INNER); - $it->setFlags(0); -} -catch (Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} - -?> -===DONE=== ---EXPECTF-- -===1=== -int(1) -string(1) "1" -string(1) "2" -string(1) "3" -===2=== -int(2) -string(1) "0" -string(1) "1" -string(1) "2" -===4=== -int(4) -string(1) "1" -string(1) "2" -string(1) "3" -===8=== -int(8) -string(3) "0:1" -string(3) "1:2" -string(3) "2:3" -===3=== -Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER -int(0) -===5=== -Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER -int(0) -===9=== -Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER -int(0) -===6=== -Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER -int(0) -===10=== -Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER -int(0) -===X=== -Exception: Unsetting flag CALL_TO_STRING is not possible -Exception: Unsetting flag TOSTRING_USE_INNER is not possible -===DONE=== diff --git a/ext/spl/tests/iterator_038.phpt b/ext/spl/tests/iterator_038.phpt deleted file mode 100755 index 71f911c57a..0000000000 --- a/ext/spl/tests/iterator_038.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -SPL: RoRewindIterator and string keys ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -foreach(new NoRewindIterator(new ArrayIterator(array('Hello'=>0, 'World'=>1))) as $k => $v) -{ - var_dump($v); - var_dump($k); -} - -?> -===DONE=== ---EXPECT-- -int(0) -string(5) "Hello" -int(1) -string(5) "World" -===DONE=== diff --git a/ext/spl/tests/iterator_039.phpt b/ext/spl/tests/iterator_039.phpt deleted file mode 100755 index 5dcaaa2265..0000000000 --- a/ext/spl/tests/iterator_039.phpt +++ /dev/null @@ -1,123 +0,0 @@ ---TEST-- -SPL: LimitIterator and backward seeking ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class NumericArrayIterator implements Iterator -{ - protected $a; - protected $i = 0; - - public function __construct($a) - { - echo __METHOD__ . "\n"; - $this->a = $a; - } - - public function valid() - { - echo __METHOD__ . "\n"; - return $this->i < count($this->a); - } - - public function rewind() - { - echo __METHOD__ . "\n"; - $this->i = 0; - } - - public function key() - { - echo __METHOD__ . "\n"; - return $this->i; - } - - public function current() - { - echo __METHOD__ . "\n"; - return $this->a[$this->i]; - } - - public function next() - { - echo __METHOD__ . "\n"; - $this->i++; - } -} - -$it = new LimitIterator(new NumericArrayIterator(array(12, 25, 42, 56))); - -foreach($it as $k => $v) -{ - var_dump($k); - var_dump($v); -} - -echo "===SEEK===\n"; - -$it->seek(2); - -echo "===LOOP===\n"; - -foreach(new NoRewindIterator($it) as $k => $v) -{ - var_dump($k); - var_dump($v); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -NumericArrayIterator::__construct -NumericArrayIterator::rewind -NumericArrayIterator::valid -NumericArrayIterator::valid -NumericArrayIterator::current -NumericArrayIterator::key -int(0) -int(12) -NumericArrayIterator::next -NumericArrayIterator::valid -NumericArrayIterator::current -NumericArrayIterator::key -int(1) -int(25) -NumericArrayIterator::next -NumericArrayIterator::valid -NumericArrayIterator::current -NumericArrayIterator::key -int(2) -int(42) -NumericArrayIterator::next -NumericArrayIterator::valid -NumericArrayIterator::current -NumericArrayIterator::key -int(3) -int(56) -NumericArrayIterator::next -NumericArrayIterator::valid -===SEEK=== -NumericArrayIterator::rewind -NumericArrayIterator::valid -NumericArrayIterator::next -NumericArrayIterator::valid -NumericArrayIterator::next -NumericArrayIterator::valid -NumericArrayIterator::valid -NumericArrayIterator::current -NumericArrayIterator::key -===LOOP=== -int(2) -int(42) -NumericArrayIterator::next -NumericArrayIterator::valid -NumericArrayIterator::current -NumericArrayIterator::key -int(3) -int(56) -NumericArrayIterator::next -NumericArrayIterator::valid -===DONE=== diff --git a/ext/spl/tests/iterator_040.phpt b/ext/spl/tests/iterator_040.phpt deleted file mode 100755 index a162cac68f..0000000000 --- a/ext/spl/tests/iterator_040.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -SPL: RecursiveFilterIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveFilterIterator extends RecursiveFilterIterator -{ - function accept() - { - return true; - } -} - -$ar = array(1, array(21, 22), 3); -$it = new RecursiveArrayIterator($ar); -$it = new MyRecursiveFilterIterator($it); -$it = new RecursiveIteratorIterator($it); - -foreach($it as $k => $v) -{ - echo "===\n"; - var_dump($it->getDepth()); - var_dump($k); - var_dump($v); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -=== -int(0) -int(0) -int(1) -=== -int(1) -int(0) -int(21) -=== -int(1) -int(1) -int(22) -=== -int(0) -int(2) -int(3) -===DONE=== diff --git a/ext/spl/tests/iterator_041.phpt b/ext/spl/tests/iterator_041.phpt deleted file mode 100755 index af42b1cdec..0000000000 --- a/ext/spl/tests/iterator_041.phpt +++ /dev/null @@ -1,119 +0,0 @@ ---TEST-- -SPL: iterator_to_array() and exceptions ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyArrayIterator extends ArrayIterator -{ - static protected $fail = 0; - public $state; - - static function fail($state, $method) - { - if (self::$fail == $state) - { - throw new Exception("State $state: $method()"); - } - } - - function __construct() - { - $this->state = MyArrayIterator::$fail; - self::fail(0, __FUNCTION__); - parent::__construct(array(1, 2)); - self::fail(1, __FUNCTION__); - } - - function rewind() - { - self::fail(2, __FUNCTION__); - return parent::rewind(); - } - - function valid() - { - self::fail(3, __FUNCTION__); - return parent::valid(); - } - - function current() - { - self::fail(4, __FUNCTION__); - return parent::current(); - } - - function key() - { - self::fail(5, __FUNCTION__); - return parent::key(); - } - - function next() - { - self::fail(6, __FUNCTION__); - return parent::next(); - } - - function __destruct() - { -// self::fail(7, __FUNCTION__); - } - - static function test($func, $skip = null) - { - echo "===$func===\n"; - self::$fail = 0; - while(self::$fail < 10) - { - try - { - var_dump($func(new MyArrayIterator())); - break; - } - catch (Exception $e) - { - echo $e->getMessage() . "\n"; - } - if (isset($skip[self::$fail])) - { - self::$fail = $skip[self::$fail]; - } - else - { - self::$fail++; - } - } - } -} - -MyArrayIterator::test('iterator_to_array'); -MyArrayIterator::test('iterator_count', array(3 => 6)); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -===iterator_to_array=== -State 0: __construct() -State 1: __construct() -State 2: rewind() -State 3: valid() -State 4: current() -State 5: key() -State 6: next() -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} -===iterator_count=== -State 0: __construct() -State 1: __construct() -State 2: rewind() -State 3: valid() -State 6: next() -int(2) -===DONE=== diff --git a/ext/spl/tests/iterator_041a.phpt b/ext/spl/tests/iterator_041a.phpt deleted file mode 100755 index d03cbba9dc..0000000000 --- a/ext/spl/tests/iterator_041a.phpt +++ /dev/null @@ -1,109 +0,0 @@ ---TEST-- -SPL: iterator_to_array() and exceptions from destruct ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyArrayIterator extends ArrayIterator -{ - static protected $fail = 0; - public $state; - - static function fail($state, $method) - { - if (self::$fail == $state) - { - throw new Exception("State $state: $method()"); - } - } - - function __construct() - { - $this->state = MyArrayIterator::$fail; - self::fail(0, __FUNCTION__); - parent::__construct(array(1, 2)); - self::fail(1, __FUNCTION__); - } - - function rewind() - { - self::fail(2, __FUNCTION__); - return parent::rewind(); - } - - function valid() - { - self::fail(3, __FUNCTION__); - return parent::valid(); - } - - function current() - { - self::fail(4, __FUNCTION__); - return parent::current(); - } - - function key() - { - self::fail(5, __FUNCTION__); - return parent::key(); - } - - function next() - { - self::fail(6, __FUNCTION__); - return parent::next(); - } - - function __destruct() - { - self::fail(7, __FUNCTION__); - } - - static function test($func, $skip = null) - { - echo "===$func===\n"; - self::$fail = 7; - while(self::$fail < 10) - { - try - { - var_dump($func(new MyArrayIterator())); - break; - } - catch (Exception $e) - { - echo $e->getMessage() . "\n"; - } - if (isset($skip[self::$fail])) - { - self::$fail = $skip[self::$fail]; - } - else - { - self::$fail++; - } - } - } -} - -MyArrayIterator::test('iterator_to_array'); -MyArrayIterator::test('iterator_count', array(3 => 6)); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -===iterator_to_array=== -State 7: __destruct() -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} -===iterator_count=== -State 7: __destruct() -int(2) -===DONE=== diff --git a/ext/spl/tests/iterator_041b.phpt b/ext/spl/tests/iterator_041b.phpt deleted file mode 100755 index 9afb935266..0000000000 --- a/ext/spl/tests/iterator_041b.phpt +++ /dev/null @@ -1,107 +0,0 @@ ---TEST-- -SPL: iterator_to_array() and exceptions from delayed destruct ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyArrayIterator extends ArrayIterator -{ - static protected $fail = 0; - public $state; - - static function fail($state, $method) - { - if (self::$fail == $state) - { - throw new Exception("State $state: $method()"); - } - } - - function __construct() - { - $this->state = MyArrayIterator::$fail; - self::fail(0, __FUNCTION__); - parent::__construct(array(1, 2)); - self::fail(1, __FUNCTION__); - } - - function rewind() - { - self::fail(2, __FUNCTION__); - return parent::rewind(); - } - - function valid() - { - self::fail(3, __FUNCTION__); - return parent::valid(); - } - - function current() - { - self::fail(4, __FUNCTION__); - return parent::current(); - } - - function key() - { - self::fail(5, __FUNCTION__); - return parent::key(); - } - - function next() - { - self::fail(6, __FUNCTION__); - return parent::next(); - } - - function __destruct() - { - self::fail(7, __FUNCTION__); - } - - static function test($func, $skip = null) - { - echo "===$func===\n"; - self::$fail = 0; - while(self::$fail < 10) - { - try - { - var_dump($func(new MyArrayIterator())); - break; - } - catch (Exception $e) - { - echo $e->getMessage() . "\n"; - } - if (isset($skip[self::$fail])) - { - self::$fail = $skip[self::$fail]; - } - else - { - self::$fail++; - } - } - } -} - -MyArrayIterator::test('iterator_to_array'); -MyArrayIterator::test('iterator_count', array(3 => 6)); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===iterator_to_array=== -State 0: __construct() -State 1: __construct() -State 2: rewind() -State 3: valid() -State 4: current() -State 5: key() -State 6: next() - -Fatal error: Ignoring exception from MyArrayIterator::__destruct() while an exception is already active (Uncaught Exception in %s on line %d) in %siterator_041b.php on line %d diff --git a/ext/spl/tests/iterator_042.phpt b/ext/spl/tests/iterator_042.phpt deleted file mode 100755 index 8615450654..0000000000 --- a/ext/spl/tests/iterator_042.phpt +++ /dev/null @@ -1,104 +0,0 @@ ---TEST-- -SPL: AppendIterator and its ArrayIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -function test_error_handler($errno, $msg, $filename, $linenum, $vars) -{ - echo "Error $msg in $filename on line $linenum\n"; - return true; -} - -set_error_handler('test_error_handler'); - -$it = new AppendIterator; - -$it->append(array()); -$it->append(new ArrayIterator(array(1))); -$it->append(new ArrayIterator(array(21, 22))); - -var_dump($it->getArrayIterator()); - -$it->append(new ArrayIterator(array(31, 32, 33))); - -var_dump($it->getArrayIterator()); - -$idx = 0; - -foreach($it as $k => $v) -{ - echo '===' . $idx++ . "===\n"; - var_dump($it->getIteratorIndex()); - var_dump($k); - var_dump($v); -} - -?> -===DONE=== -<?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) { - [0]=> - int(1) - } - [1]=> - object(ArrayIterator)#%d (2) { - [0]=> - int(21) - [1]=> - int(22) - } -} -object(ArrayIterator)#%d (3) { - [0]=> - object(ArrayIterator)#%d (1) { - [0]=> - int(1) - } - [1]=> - object(ArrayIterator)#%d (2) { - [0]=> - int(21) - [1]=> - int(22) - } - [2]=> - object(ArrayIterator)#5 (3) { - [0]=> - int(31) - [1]=> - int(32) - [2]=> - int(33) - } -} -===0=== -int(0) -int(0) -int(1) -===1=== -int(1) -int(0) -int(21) -===2=== -int(1) -int(1) -int(22) -===3=== -int(2) -int(0) -int(31) -===4=== -int(2) -int(1) -int(32) -===5=== -int(2) -int(2) -int(33) -===DONE=== diff --git a/ext/spl/tests/iterator_043.phpt b/ext/spl/tests/iterator_043.phpt deleted file mode 100755 index c49e334733..0000000000 --- a/ext/spl/tests/iterator_043.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -SPL: RecursiveCachingIterator and uninitialized getChildren() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$it = new RecursiveCachingIterator(new RecursiveArrayIterator(array(1,2))); - -var_dump($it->getChildren()); -$it->rewind(); -var_dump($it->getChildren()); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -NULL -NULL -===DONE=== diff --git a/ext/spl/tests/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt deleted file mode 100755 index e25e0d1dda..0000000000 --- a/ext/spl/tests/iterator_044.phpt +++ /dev/null @@ -1,169 +0,0 @@ ---TEST-- -SPL: CachingIterator and offsetGet/Exists using flag FULL_CACHE ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyFoo -{ - function __toString() - { - return 'foo'; - } -} - -class MyCachingIterator extends CachingIterator -{ - function __construct(Iterator $it, $flags = 0) - { - parent::__construct($it, $flags); - } - - function test($ar) - { - foreach($ar as $k => $v) - { - echo "===$k===\n"; - var_dump($v); - var_dump($this->offsetExists($v)); - var_dump($this->offsetGet($v)); - } - } -} - -$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4))); - -try -{ - var_dump($it->offsetExists(0)); -} -catch(Exception $e) -{ - echo "Exception: " . $e->getMessage() . "\n"; -} - -try -{ - var_dump($it->offsetGet(0)); -} -catch(Exception $e) -{ - echo "Exception: " . $e->getMessage() . "\n"; -} - -$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)), CachingIterator::FULL_CACHE); - -var_dump($it->offsetExists()); -var_dump($it->offsetGet()); - -$checks = array(0, new stdClass, new MyFoo, NULL, 2, 'foo', 3); - -$it->test($checks); - -echo "===FILL===\n"; - -foreach($it as $v); // read all into cache - -$it->test($checks); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) - -Notice: Undefined index: 0 in %siterator_044.php on line %d -Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) - -Warning: CachingIterator::offsetExists() expects exactly 1 parameter, 0 given in %s/iterator_044.php on line %d -NULL - -Warning: CachingIterator::offsetGet() expects exactly 1 parameter, 0 given in %s/iterator_044.php on line %d -NULL -===0=== -int(0) -bool(false) - -Notice: Undefined index: 0 in %siterator_044.php on line %d -NULL -===1=== -object(stdClass)#%d (0) { -} - -Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL - -Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL -===2=== -object(MyFoo)#%d (0) { -} -bool(false) - -Notice: Undefined index: foo in %siterator_044.php on line %d -NULL -===3=== -NULL -bool(false) - -Notice: Undefined index: in %siterator_044.php on line %d -NULL -===4=== -int(2) -bool(false) - -Notice: Undefined index: 2 in %siterator_044.php on line %d -NULL -===5=== -string(3) "foo" -bool(false) - -Notice: Undefined index: foo in %siterator_044.php on line %d -NULL -===6=== -int(3) -bool(false) - -Notice: Undefined index: 3 in %siterator_044.php on line %d -NULL -===FILL=== -===0=== -int(0) -bool(true) -int(0) -===1=== -object(stdClass)#1 (0) { -} - -Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL - -Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL -===2=== -object(MyFoo)#2 (0) { -} -bool(true) -int(1) -===3=== -NULL -bool(false) - -Notice: Undefined index: in %siterator_044.php on line %d -NULL -===4=== -int(2) -bool(true) -int(4) -===5=== -string(3) "foo" -bool(true) -int(1) -===6=== -int(3) -bool(false) - -Notice: Undefined index: 3 in %siterator_044.php on line %d -NULL -===DONE=== diff --git a/ext/spl/tests/iterator_045.phpt b/ext/spl/tests/iterator_045.phpt deleted file mode 100755 index ce29349cfb..0000000000 --- a/ext/spl/tests/iterator_045.phpt +++ /dev/null @@ -1,171 +0,0 @@ ---TEST-- -SPL: CachingIterator and offsetSet/Unset, getCache using flag FULL_CACHE ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyFoo -{ - function __toString() - { - return 'foo'; - } -} - -class MyCachingIterator extends CachingIterator -{ - function __construct(Iterator $it, $flags = 0) - { - parent::__construct($it, $flags); - } - - function testSet($ar) - { - echo __METHOD__ . "()\n"; - foreach($ar as $k => $v) - { - echo "set($k,$v)\n"; - $this->offsetSet($k, $v); - } - } - - function testUnset($ar) - { - echo __METHOD__ . "()\n"; - foreach($ar as $k => $v) - { - echo "unset($v)\n"; - $this->offsetUnset($v); - } - } - - function fill() - { - echo __METHOD__ . "()\n"; - foreach($this as $v) ; - } - - function show() - { - echo __METHOD__ . "()\n"; - var_dump($this->getCache()); - } -} - -$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4))); - -try -{ - var_dump($it->offsetSet(0, 0)); -} -catch(Exception $e) -{ - echo "Exception: " . $e->getMessage() . "\n"; -} - -try -{ - var_dump($it->offsetUnset(0)); -} -catch(Exception $e) -{ - echo "Exception: " . $e->getMessage() . "\n"; -} - -$it = new MyCachingIterator(new ArrayIterator(array(0, 1, 2, 3)), CachingIterator::FULL_CACHE); - -var_dump($it->offsetSet()); -var_dump($it->offsetSet(0)); -var_dump($it->offsetUnset()); - -$checks = array(0 => 25, 1 => 42, 3 => 'FooBar'); -$unsets = array(0, 2); - -$it->testSet($checks); -$it->show(); -$it->testUnset($unsets); -$it->show(); -$it->fill(); -$it->show(); -$it->testSet($checks); -$it->show(); -$it->testUnset($unsets); -$it->show(); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) -Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) - -Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 0 given in %siterator_045.php on line %d -NULL - -Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 1 given in %siterator_045.php on line %d -NULL - -Warning: CachingIterator::offsetUnset() expects exactly 1 parameter, 0 given in %siterator_045.php on line %d -NULL -MyCachingIterator::testSet() -set(0,25) -set(1,42) -set(3,FooBar) -MyCachingIterator::show() -array(3) { - [0]=> - int(25) - [1]=> - int(42) - [3]=> - string(6) "FooBar" -} -MyCachingIterator::testUnset() -unset(0) -unset(2) -MyCachingIterator::show() -array(2) { - [1]=> - int(42) - [3]=> - string(6) "FooBar" -} -MyCachingIterator::fill() -MyCachingIterator::show() -array(4) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - int(2) - [3]=> - int(3) -} -MyCachingIterator::testSet() -set(0,25) -set(1,42) -set(3,FooBar) -MyCachingIterator::show() -array(4) { - [0]=> - int(25) - [1]=> - int(42) - [2]=> - int(2) - [3]=> - string(6) "FooBar" -} -MyCachingIterator::testUnset() -unset(0) -unset(2) -MyCachingIterator::show() -array(2) { - [1]=> - int(42) - [3]=> - string(6) "FooBar" -} -===DONE=== diff --git a/ext/spl/tests/iterator_046.phpt b/ext/spl/tests/iterator_046.phpt deleted file mode 100755 index 34d9c027b6..0000000000 --- a/ext/spl/tests/iterator_046.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -SPL: CachingIterator and __toString using bypassed string keys ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyFoo -{ - function __toString() - { - return 'foo'; - } -} - -class MyCachingIterator extends CachingIterator -{ - function __construct(Iterator $it, $flags = 0) - { - parent::__construct($it, $flags); - } - - function fill() - { - echo __METHOD__ . "()\n"; - foreach($this as $v) ; - } - - function show() - { - echo __METHOD__ . "()\n"; - foreach($this as $v) - { - var_dump((string)$this); - } - } -} - -$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 'bar'=>2)), CachingIterator::TOSTRING_USE_KEY); - -$it->fill(); -$it->show(); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -MyCachingIterator::fill() -MyCachingIterator::show() -string(1) "0" -string(3) "foo" -string(3) "bar" -===DONE=== diff --git a/ext/spl/tests/iterator_047.phpt b/ext/spl/tests/iterator_047.phpt deleted file mode 100755 index b313df3012..0000000000 --- a/ext/spl/tests/iterator_047.phpt +++ /dev/null @@ -1,119 +0,0 @@ ---TEST-- -SPL: RecursiveCachingIterator and exception in has/getChildren ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveArrayIterator extends RecursiveArrayIterator -{ - static public $fail = 0; - - static function fail($state, $method) - { - if (self::$fail == $state) - { - throw new Exception("State $state: $method()"); - } - } - - function hasChildren() - { - echo __METHOD__ . "()\n"; - self::fail(1, __METHOD__); - return parent::hasChildren(); - } - - function getChildren() - { - echo __METHOD__ . "()\n"; - self::fail(2, __METHOD__); - return parent::getChildren(); - } -} - -class MyRecursiveCachingIterator extends RecursiveCachingIterator -{ - function show() - { - MyRecursiveArrayIterator::$fail = 0; - while(MyRecursiveArrayIterator::$fail < 4) - { - echo "===" . MyRecursiveArrayIterator::$fail . "===\n"; - try - { - foreach(new RecursiveIteratorIterator($this) as $k => $v) - { - var_dump($k); - var_dump($v); - } - } - catch (Exception $e) - { - echo "Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; - } - MyRecursiveArrayIterator::$fail++; - } - } -} - -$it = new MyRecursiveArrayIterator(array(0, array(10), 2, array(30), 4)); -$it = new MyRecursiveCachingIterator($it); - -$it->show(); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===0=== -MyRecursiveArrayIterator::hasChildren() -int(0) -int(0) -MyRecursiveArrayIterator::hasChildren() -MyRecursiveArrayIterator::getChildren() -MyRecursiveArrayIterator::hasChildren() -int(0) -int(10) -MyRecursiveArrayIterator::hasChildren() -int(2) -int(2) -MyRecursiveArrayIterator::hasChildren() -MyRecursiveArrayIterator::getChildren() -MyRecursiveArrayIterator::hasChildren() -int(0) -int(30) -MyRecursiveArrayIterator::hasChildren() -int(4) -int(4) -===1=== -MyRecursiveArrayIterator::hasChildren() -Exception: State 1: MyRecursiveArrayIterator::hasChildren() in %siterator_047.php 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 -===3=== -MyRecursiveArrayIterator::hasChildren() -int(0) -int(0) -MyRecursiveArrayIterator::hasChildren() -MyRecursiveArrayIterator::getChildren() -MyRecursiveArrayIterator::hasChildren() -int(0) -int(10) -MyRecursiveArrayIterator::hasChildren() -int(2) -int(2) -MyRecursiveArrayIterator::hasChildren() -MyRecursiveArrayIterator::getChildren() -MyRecursiveArrayIterator::hasChildren() -int(0) -int(30) -MyRecursiveArrayIterator::hasChildren() -int(4) -int(4) -===DONE=== diff --git a/ext/spl/tests/iterator_048.phpt b/ext/spl/tests/iterator_048.phpt deleted file mode 100755 index 5e141d9c7f..0000000000 --- a/ext/spl/tests/iterator_048.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -SPL: RecursiveRegexIterator and exception in has/getChildren ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRecursiveRegexIterator extends RecursiveRegexIterator -{ - function show() - { - foreach(new RecursiveIteratorIterator($this) as $k => $v) - { - var_dump($k); - var_dump($v); - } - } - - function accept() - { - return $this->hasChildren() || parent::accept(); - } -} - -$ar = new RecursiveArrayIterator(array('Foo', array('Bar'), 'FooBar', array('Baz'), 'Biz')); -$it = new MyRecursiveRegexIterator($ar, '/Bar/'); - -$it->show(); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -int(0) -string(3) "Bar" -int(2) -string(6) "FooBar" -===DONE=== diff --git a/ext/spl/tests/iterator_049.phpt b/ext/spl/tests/iterator_049.phpt deleted file mode 100755 index 8e25643809..0000000000 --- a/ext/spl/tests/iterator_049.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -SPL: ArrayIterator with NULL key ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = new ArrayIterator(array(NULL=>NULL)); -@var_dump($ar); -var_dump($ar->getArrayCopy()); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -object(ArrayIterator)#%d (1) { - [""]=> - NULL -} -array(1) { - [""]=> - NULL -} -===DONE=== diff --git a/ext/spl/tests/iterator_049b.phpt b/ext/spl/tests/iterator_049b.phpt Binary files differdeleted file mode 100755 index 9b894cd1c1..0000000000 --- a/ext/spl/tests/iterator_049b.phpt +++ /dev/null diff --git a/ext/spl/tests/iterator_050.phpt b/ext/spl/tests/iterator_050.phpt deleted file mode 100755 index 6bd84a3a87..0000000000 --- a/ext/spl/tests/iterator_050.phpt +++ /dev/null @@ -1,93 +0,0 @@ ---TEST-- -SPL: RegexIterator::GET_MATCH ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRegexIterator extends RegexIterator -{ - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } -} - -$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,')); -$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::GET_MATCH); -$it->show(); - -$it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::GET_MATCH); -$it->show(); - -var_dump($ar); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -int(1) -array(3) { - [0]=> - string(3) "1,2" - [1]=> - string(1) "1" - [2]=> - string(1) "2" -} -int(2) -array(3) { - [0]=> - string(3) "1,2" - [1]=> - string(1) "1" - [2]=> - string(1) "2" -} -int(0) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -int(1) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(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) { - } - [6]=> - %s(6) "FooBar" - [7]=> - %s(1) "," - [8]=> - %s(2) ",," -} -===DONE=== diff --git a/ext/spl/tests/iterator_051.phpt b/ext/spl/tests/iterator_051.phpt deleted file mode 100755 index 626d27474a..0000000000 --- a/ext/spl/tests/iterator_051.phpt +++ /dev/null @@ -1,95 +0,0 @@ ---TEST-- -SPL: RegexIterator::GET_MATCH, USE_KEY ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRegexIterator extends RegexIterator -{ - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } -} - -$ar = new ArrayIterator(array('1'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6)); -$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::GET_MATCH, RegexIterator::USE_KEY); -$it->show(); - -$it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::GET_MATCH, RegexIterator::USE_KEY); -$it->show(); - -var_dump($ar); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -string(3) "1,2" -array(3) { - [0]=> - string(3) "1,2" - [1]=> - string(1) "1" - [2]=> - string(1) "2" -} -string(5) "1,2,3" -array(3) { - [0]=> - string(3) "1,2" - [1]=> - string(1) "1" - [2]=> - string(1) "2" -} -int(1) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -string(3) "1,2" -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -string(5) "1,2,3" -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -int(0) -array(2) { - [0]=> - string(1) "0" - [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) -} -===DONE=== diff --git a/ext/spl/tests/iterator_052.phpt b/ext/spl/tests/iterator_052.phpt deleted file mode 100755 index 9bd7d899ec..0000000000 --- a/ext/spl/tests/iterator_052.phpt +++ /dev/null @@ -1,314 +0,0 @@ ---TEST-- -SPL: RegexIterator::ALL_MATCHES ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRegexIterator extends RegexIterator -{ - public $uk, $re; - - function __construct($it, $re, $mode, $flags = 0) - { - $this->uk = $flags & self::USE_KEY; - $this->re = $re; - parent::__construct($it, $re, $mode, $flags); - } - - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } - - function accept() - { - @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub); - $ret = parent::accept(); - var_dump($sub == $this->current()); - return $ret; - } -} - -$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,')); -$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::ALL_MATCHES); -$it->show(); - -$it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::ALL_MATCHES); -$it->show(); - -var_dump($ar); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -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]=> - string(3) "1,2" - } - [1]=> - array(1) { - [0]=> - string(1) "1" - } - [2]=> - array(1) { - [0]=> - string(1) "2" - } -} -bool(true) -int(2) -array(3) { - [0]=> - array(1) { - [0]=> - string(3) "1,2" - } - [1]=> - array(1) { - [0]=> - string(1) "1" - } - [2]=> - array(1) { - [0]=> - string(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]=> - string(1) "1" - } - [1]=> - array(1) { - [0]=> - string(1) "1" - } -} -bool(true) -int(1) -array(2) { - [0]=> - array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - } - [1]=> - array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - } -} -bool(true) -int(2) -array(2) { - [0]=> - array(3) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - [2]=> - string(1) "3" - } - [1]=> - array(3) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - [2]=> - string(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]=> - %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) ",," -} -===DONE=== diff --git a/ext/spl/tests/iterator_053.phpt b/ext/spl/tests/iterator_053.phpt deleted file mode 100755 index 4d68b0113f..0000000000 --- a/ext/spl/tests/iterator_053.phpt +++ /dev/null @@ -1,314 +0,0 @@ ---TEST-- -SPL: RegexIterator::ALL_MATCHES ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRegexIterator extends RegexIterator -{ - public $uk, $re; - - function __construct($it, $re, $mode, $flags = 0) - { - $this->uk = $flags & self::USE_KEY; - $this->re = $re; - parent::__construct($it, $re, $mode, $flags); - } - - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } - - function accept() - { - @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub); - $ret = parent::accept(); - var_dump($sub == $this->current()); - return $ret; - } -} - -$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,')); -$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::ALL_MATCHES, RegexIterator::USE_KEY); -$it->show(); - -$it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::ALL_MATCHES, RegexIterator::USE_KEY); -$it->show(); - -var_dump($ar); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -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]=> - string(1) "0" - } - [1]=> - array(1) { - [0]=> - string(1) "0" - } -} -bool(true) -int(1) -array(2) { - [0]=> - array(1) { - [0]=> - string(1) "1" - } - [1]=> - array(1) { - [0]=> - string(1) "1" - } -} -bool(true) -int(2) -array(2) { - [0]=> - array(1) { - [0]=> - string(1) "2" - } - [1]=> - array(1) { - [0]=> - string(1) "2" - } -} -bool(true) -int(3) -array(2) { - [0]=> - array(1) { - [0]=> - string(1) "3" - } - [1]=> - array(1) { - [0]=> - string(1) "3" - } -} -bool(true) -int(4) -array(2) { - [0]=> - array(1) { - [0]=> - string(1) "4" - } - [1]=> - array(1) { - [0]=> - string(1) "4" - } -} -bool(true) -int(5) -array(2) { - [0]=> - array(1) { - [0]=> - string(1) "5" - } - [1]=> - array(1) { - [0]=> - string(1) "5" - } -} -bool(true) -int(6) -array(2) { - [0]=> - array(1) { - [0]=> - string(1) "6" - } - [1]=> - array(1) { - [0]=> - string(1) "6" - } -} -bool(true) -int(7) -array(2) { - [0]=> - array(1) { - [0]=> - string(1) "7" - } - [1]=> - array(1) { - [0]=> - string(1) "7" - } -} -bool(true) -int(8) -array(2) { - [0]=> - array(1) { - [0]=> - string(1) "8" - } - [1]=> - array(1) { - [0]=> - 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) { - } - [6]=> - %s(6) "FooBar" - [7]=> - %s(1) "," - [8]=> - %s(2) ",," -} -===DONE=== diff --git a/ext/spl/tests/iterator_054.phpt b/ext/spl/tests/iterator_054.phpt deleted file mode 100755 index 3f724697a9..0000000000 --- a/ext/spl/tests/iterator_054.phpt +++ /dev/null @@ -1,84 +0,0 @@ ---TEST-- -SPL: RegexIterator::SPLIT ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRegexIterator extends RegexIterator -{ - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } -} - -$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,')); -$it = new MyRegexIterator($ar, '/,/', RegexIterator::SPLIT); - -$it->show(); - -var_dump($ar); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -int(1) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" -} -int(2) -array(3) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - [2]=> - string(1) "3" -} -int(7) -array(2) { - [0]=> - string(0) "" - [1]=> - string(0) "" -} -int(8) -array(3) { - [0]=> - string(0) "" - [1]=> - string(0) "" - [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) { - } - [6]=> - %s(6) "FooBar" - [7]=> - %s(1) "," - [8]=> - %s(2) ",," -} -===DONE=== diff --git a/ext/spl/tests/iterator_055.phpt b/ext/spl/tests/iterator_055.phpt deleted file mode 100755 index 35a050c396..0000000000 --- a/ext/spl/tests/iterator_055.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -SPL: RegexIterator::SPLIT, USE_KEY ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyRegexIterator extends RegexIterator -{ - function show() - { - foreach($this as $k => $v) - { - var_dump($k); - var_dump($v); - } - } -} - -$ar = new ArrayIterator(array('1'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6)); -$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::SPLIT, RegexIterator::USE_KEY); - -$it->show(); - -var_dump($ar); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -string(3) "1,2" -array(2) { - [0]=> - string(0) "" - [1]=> - string(0) "" -} -string(5) "1,2,3" -array(2) { - [0]=> - string(0) "" - [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) -} -===DONE=== diff --git a/ext/spl/tests/observer_001.phpt b/ext/spl/tests/observer_001.phpt deleted file mode 100755 index d161a47767..0000000000 --- a/ext/spl/tests/observer_001.phpt +++ /dev/null @@ -1,118 +0,0 @@ ---TEST-- -SPL: SplObserver and SplSubject (empty notify) ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class ObserverImpl implements SplObserver -{ - protected $name = ''; - - function __construct($name = 'obj') - { - $this->name = '$' . $name; - } - - function update(SplSubject $subject) - { - echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n"; - } - - function getName() - { - return $this->name; - } -} - -class SubjectImpl implements SplSubject -{ - protected $name = ''; - protected $observers = array(); - - function __construct($name = 'sub') - { - $this->name = '$' . $name; - } - - function attach(SplObserver $observer) - { - echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n"; - if (!in_array($observer, $this->observers)) - { - $this->observers[] = $observer; - } - } - - function detach(SplObserver $observer) - { - echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n"; - $idx = array_search($observer, $this->observers); - if ($idx !== false) - { - unset($this->observers[$idx]); - } - } - - function notify() - { - echo '$sub->' . __METHOD__ . "();\n"; - foreach($this->observers as $observer) - { - $observer->update($this); - } - } - - function getName() - { - return $this->name; - } -} - -$sub = new SubjectImpl; - -$ob1 = new ObserverImpl("ob1"); -$ob2 = new ObserverImpl("ob2"); -$ob3 = new ObserverImpl("ob3"); - -$sub->attach($ob1); -$sub->attach($ob1); -$sub->attach($ob2); -$sub->attach($ob3); - -$sub->notify(); - -$sub->detach($ob3); - -$sub->notify(); - -$sub->detach($ob2); -$sub->detach($ob1); - -$sub->notify(); - -$sub->attach($ob3); - -$sub->notify(); -?> -===DONE=== ---EXPECT-- -$sub->SubjectImpl::attach($ob1); -$sub->SubjectImpl::attach($ob1); -$sub->SubjectImpl::attach($ob2); -$sub->SubjectImpl::attach($ob3); -$sub->SubjectImpl::notify(); -$ob1->ObserverImpl::update($sub); -$ob2->ObserverImpl::update($sub); -$ob3->ObserverImpl::update($sub); -$sub->SubjectImpl::detach($ob3); -$sub->SubjectImpl::notify(); -$ob1->ObserverImpl::update($sub); -$ob2->ObserverImpl::update($sub); -$sub->SubjectImpl::detach($ob2); -$sub->SubjectImpl::detach($ob1); -$sub->SubjectImpl::notify(); -$sub->SubjectImpl::attach($ob3); -$sub->SubjectImpl::notify(); -$ob3->ObserverImpl::update($sub); -===DONE=== diff --git a/ext/spl/tests/observer_002.phpt b/ext/spl/tests/observer_002.phpt deleted file mode 100755 index 7bcd9dc2eb..0000000000 --- a/ext/spl/tests/observer_002.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -SPL: SplObjectStorage ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class MyObjectStorage extends SplObjectStorage -{ - function rewind() - { - echo __METHOD__ . "()\n"; - parent::rewind(); - } - - function valid() - { - echo __METHOD__ . "(" . (parent::valid() ? 1 : 0) . ")\n"; - return parent::valid(); - } - - function key() - { - echo __METHOD__ . "(" . parent::key() . ")\n"; - return parent::key(); - } - - function current() - { - echo __METHOD__ . "(" . parent::current()->getName() . ")\n"; - return parent::current(); - } - - function next() - { - echo __METHOD__ . "()\n"; - parent::next(); - } -} - -class ObserverImpl implements SplObserver -{ - protected $name = ''; - - function __construct($name = 'obj') - { - $this->name = '$' . $name; - } - - function update(SplSubject $subject) - { - echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n"; - } - - function getName() - { - return $this->name; - } -} - -class SubjectImpl implements SplSubject -{ - protected $name = ''; - protected $observers; - - function __construct($name = 'sub') - { - $this->observers = new MyObjectStorage; - $this->name = '$' . $name; - } - - function attach(SplObserver $observer) - { - echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n"; - $this->observers->attach($observer); - } - - function detach(SplObserver $observer) - { - echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n"; - $this->observers->detach($observer); - } - - function count() - { - return $this->observers->count(); - } - - function notify() - { - echo $this->name . '->' . __METHOD__ . "();\n"; - foreach($this->observers as $key => $observer) - { - $observer->update($this); - } - } - - function getName() - { - return $this->name; - } - - function contains($obj) - { - return $this->observers->contains($obj); - } -} - -$sub = new SubjectImpl; - -$ob1 = new ObserverImpl("ob1"); -$ob2 = new ObserverImpl("ob2"); -$ob3 = new ObserverImpl("ob3"); - -var_dump($sub->contains($ob1)); -$sub->attach($ob1); -var_dump($sub->contains($ob1)); -$sub->attach($ob1); -$sub->attach($ob2); -$sub->attach($ob3); -var_dump($sub->count()); - -$sub->notify(); - -$sub->detach($ob3); -var_dump($sub->count()); - -$sub->notify(); - -$sub->detach($ob2); -$sub->detach($ob1); -var_dump($sub->count()); - -$sub->notify(); - -$sub->attach($ob3); -var_dump($sub->count()); - -$sub->notify(); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -bool(false) -$sub->SubjectImpl::attach($ob1); -bool(true) -$sub->SubjectImpl::attach($ob1); -$sub->SubjectImpl::attach($ob2); -$sub->SubjectImpl::attach($ob3); -int(3) -$sub->SubjectImpl::notify(); -MyObjectStorage::rewind() -MyObjectStorage::valid(1) -MyObjectStorage::current($ob1) -MyObjectStorage::key(0) -$ob1->ObserverImpl::update($sub); -MyObjectStorage::next() -MyObjectStorage::valid(1) -MyObjectStorage::current($ob2) -MyObjectStorage::key(1) -$ob2->ObserverImpl::update($sub); -MyObjectStorage::next() -MyObjectStorage::valid(1) -MyObjectStorage::current($ob3) -MyObjectStorage::key(2) -$ob3->ObserverImpl::update($sub); -MyObjectStorage::next() -MyObjectStorage::valid(0) -$sub->SubjectImpl::detach($ob3); -int(2) -$sub->SubjectImpl::notify(); -MyObjectStorage::rewind() -MyObjectStorage::valid(1) -MyObjectStorage::current($ob1) -MyObjectStorage::key(0) -$ob1->ObserverImpl::update($sub); -MyObjectStorage::next() -MyObjectStorage::valid(1) -MyObjectStorage::current($ob2) -MyObjectStorage::key(1) -$ob2->ObserverImpl::update($sub); -MyObjectStorage::next() -MyObjectStorage::valid(0) -$sub->SubjectImpl::detach($ob2); -$sub->SubjectImpl::detach($ob1); -int(0) -$sub->SubjectImpl::notify(); -MyObjectStorage::rewind() -MyObjectStorage::valid(0) -$sub->SubjectImpl::attach($ob3); -int(1) -$sub->SubjectImpl::notify(); -MyObjectStorage::rewind() -MyObjectStorage::valid(1) -MyObjectStorage::current($ob3) -MyObjectStorage::key(0) -$ob3->ObserverImpl::update($sub); -MyObjectStorage::next() -MyObjectStorage::valid(0) -===DONE=== diff --git a/ext/spl/tests/spl_001.phpt b/ext/spl/tests/spl_001.phpt deleted file mode 100755 index 8d637a1a66..0000000000 --- a/ext/spl/tests/spl_001.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -SPL: iterator_to_array() and iterator_count() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$it = new ArrayObject(array("x"=>1, 1=>2, 3=>3, 4, "1"=>5)); - -$ar = iterator_to_array($it); - -var_dump(iterator_count($it)); - -print_r($ar); - -foreach($ar as $v) -{ - var_dump($v); -} - -?> -===DONE=== ---EXPECT-- -int(4) -Array -( - [x] => 1 - [1] => 5 - [3] => 3 - [4] => 4 -) -int(1) -int(5) -int(3) -int(4) -===DONE=== diff --git a/ext/spl/tests/spl_002.phpt b/ext/spl/tests/spl_002.phpt deleted file mode 100755 index fbc33f0a9c..0000000000 --- a/ext/spl/tests/spl_002.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -SPL: Countable ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -class Test implements Countable -{ - function count() - { - return 4; - } -}; - -$a = new Test; - -var_dump(count($a)); - -?> -===DONE=== ---EXPECT-- -int(4) -===DONE=== diff --git a/ext/spl/tests/spl_003.phpt b/ext/spl/tests/spl_003.phpt deleted file mode 100755 index cadf3b5a6c..0000000000 --- a/ext/spl/tests/spl_003.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -SPL: class_parents() and class_implements() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php -class a{} -class b extends a{} -class c extends b{} -class d{} -var_dump(class_parents(new c), - class_parents("c"), - class_parents(new b), - class_parents("b"), - class_parents("d"), - class_parents("foo", 0), - class_parents("foo", 1) -); - -interface iface1{} -interface iface2{} -class f implements iface1, iface2{} -var_dump(class_implements(new a), - class_implements("a"), - class_implements("aaa"), - class_implements("bbb", 0) -); - -function __autoload($cname) { - var_dump($cname); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Warning: class_parents(): Class foo does not exist in %sspl_003.php on line %d -string(3) "foo" - -Warning: class_parents(): Class foo does not exist and could not be loaded in %sspl_003.php on line %d -array(2) { - ["b"]=> - string(1) "b" - ["a"]=> - string(1) "a" -} -array(2) { - ["b"]=> - string(1) "b" - ["a"]=> - string(1) "a" -} -array(1) { - ["a"]=> - string(1) "a" -} -array(1) { - ["a"]=> - string(1) "a" -} -array(0) { -} -bool(false) -bool(false) -string(3) "aaa" - -Warning: class_implements(): Class aaa does not exist and could not be loaded in %sspl_003.php on line %d - -Warning: class_implements(): Class bbb does not exist in %sspl_003.php on line %d -array(0) { -} -array(0) { -} -bool(false) -bool(false) -===DONE===
\ No newline at end of file diff --git a/ext/spl/tests/spl_004.phpt b/ext/spl/tests/spl_004.phpt deleted file mode 100755 index 60da28042a..0000000000 --- a/ext/spl/tests/spl_004.phpt +++ /dev/null @@ -1,86 +0,0 @@ ---TEST-- -SPL: iterator_apply() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -function my_error_handler($errno, $errstr, $errfile, $errline) { - echo "Error: $errstr\n"; -} - -set_error_handler('my_error_handler'); - -function test_arg($arg) -{ - if ($arg instanceof Iterator) - { - var_dump($arg->key()); - var_dump($arg->current()); - } - else - { - var_dump($arg); - } - return true; -} - -function test() -{ - static $arg = 0; - var_dump($arg++); - return true; -} - -$it = new RecursiveArrayIterator(array(1, array(21, 22), 3)); - -var_dump(iterator_apply($it, 'test', NULL)); - -echo "===ARGS===\n"; -var_dump(iterator_apply($it, 'test_arg', array($it))); - -echo "===RECURSIVE===\n"; -$it = new RecursiveIteratorIterator($it); -var_dump(iterator_apply($it, 'test')); - -echo "===ERRORS===\n"; -var_dump(iterator_apply($it, 'test', 1)); -var_dump(iterator_apply($it, 'non_existing_functon')); -var_dump(iterator_apply($it, 'non_existing_functon', NULL, 2)); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -int(0) -int(1) -int(2) -int(3) -===ARGS=== -int(0) -int(1) -int(1) -array(2) { - [0]=> - int(21) - [1]=> - int(22) -} -int(2) -int(3) -int(3) -===RECURSIVE=== -int(3) -int(4) -int(5) -int(6) -int(4) -===ERRORS=== -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 -NULL -Error: iterator_apply() expects at most 3 parameters, 4 given -NULL -===DONE=== diff --git a/ext/spl/tests/spl_005.phpt b/ext/spl/tests/spl_005.phpt deleted file mode 100755 index bb297bb6bc..0000000000 --- a/ext/spl/tests/spl_005.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -SPL: spl_object_hash() ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -var_dump(spl_object_hash(new stdClass)); -var_dump(spl_object_hash(42)); -var_dump(spl_object_hash()); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -string(32) "%s" - -Warning: spl_object_hash() expects parameter 1 to be object, integer given in %sspl_005.php on line %d -NULL - -Warning: spl_object_hash() expects exactly 1 parameter, 0 given in %sspl_005.php on line %d -NULL -===DONE=== diff --git a/ext/spl/tests/spl_autoload_001.phpt b/ext/spl/tests/spl_autoload_001.phpt deleted file mode 100755 index f78e31ab40..0000000000 --- a/ext/spl/tests/spl_autoload_001.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -SPL: spl_autoload() and friends ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -include_path=. ---FILE-- -<?php - -echo "===EMPTY===\n"; - -var_dump(spl_autoload_extensions()); - -try -{ - spl_autoload("TestClass"); -} -catch(Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} - -$test_exts = array(NULL, "1", ".inc,,.php.inc", ""); - -foreach($test_exts as $exts) -{ - echo "===($exts)===\n"; - try - { - spl_autoload("TestClass", $exts); - } - catch(Exception $e) - { - echo 'Exception: ' . $e->getMessage() . "\n"; - } -} - -try -{ - spl_autoload_extensions(".inc,.php.inc"); - spl_autoload("TestClass"); -} -catch(Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} - -function TestFunc1($classname) -{ - echo __METHOD__ . "($classname)\n"; -} - -function TestFunc2($classname) -{ - echo __METHOD__ . "($classname)\n"; -} - -echo "===SPL_AUTOLOAD()===\n"; - -spl_autoload_register(); - -try -{ - var_dump(spl_autoload_extensions(".inc")); - var_dump(class_exists("TestClass", true)); -} -catch(Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} - -echo "===REGISTER===\n"; - -spl_autoload_unregister("spl_autoload"); -spl_autoload_register("TestFunc1"); -spl_autoload_register("TestFunc2"); -spl_autoload_register("TestFunc2"); /* 2nd call ignored */ -spl_autoload_extensions(".inc,.class.inc"); /* we do not have spl_autoload_registered yet */ - -try -{ - var_dump(class_exists("TestClass", true)); -} -catch(Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} - -echo "===LOAD===\n"; - -spl_autoload_register("spl_autoload"); -var_dump(class_exists("TestClass", true)); - -echo "===NOFUNCTION===\n"; - -try -{ - spl_autoload_register("unavailable_autoload_function"); -} -catch(Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===EMPTY=== -string(9) ".inc,.php" -%stestclass.inc -Exception: Class TestClass could not be loaded -===()=== -Exception: Class TestClass could not be loaded -===(1)=== -Exception: Class TestClass could not be loaded -===(.inc,,.php.inc)=== -%stestclass -%stestclass.php.inc -Exception: Class TestClass could not be loaded -===()=== -Exception: Class TestClass could not be loaded -Exception: Class TestClass could not be loaded -===SPL_AUTOLOAD()=== -string(4) ".inc" -Exception: Class TestClass could not be loaded -===REGISTER=== -TestFunc1(TestClass) -TestFunc2(TestClass) -bool(false) -===LOAD=== -TestFunc1(TestClass) -TestFunc2(TestClass) -%stestclass.class.inc -bool(true) -===NOFUNCTION=== -Exception: Function 'unavailable_autoload_function' not found -===DONE=== diff --git a/ext/spl/tests/spl_autoload_002.phpt b/ext/spl/tests/spl_autoload_002.phpt deleted file mode 100755 index e7fda9c446..0000000000 --- a/ext/spl/tests/spl_autoload_002.phpt +++ /dev/null @@ -1,71 +0,0 @@ ---TEST-- -SPL: spl_autoloadfunctions() ---SKIPIF-- -<?php - if (!extension_loaded("spl")) die ("skip"); - if (spl_autoload_functions() !== false) die('skip __autoload() registered by php.ini'); -?> ---FILE-- -<?php - -function SplAutoloadTest1($name) {} -function SplAutoloadTest2($name) {} - -var_dump(spl_autoload_functions()); - -spl_autoload_register(); - -var_dump(spl_autoload_functions()); - -spl_autoload_register('SplAutoloadTest1'); -spl_autoload_register('SplAutoloadTest2'); -spl_autoload_register('SplAutoloadTest1'); - -var_dump(spl_autoload_functions()); - -spl_autoload_unregister('SplAutoloadTest1'); - -var_dump(spl_autoload_functions()); - -spl_autoload_unregister('spl_autoload_call'); - -var_dump(spl_autoload_functions()); - -spl_autoload_register(); - -var_dump(spl_autoload_functions()); - -spl_autoload_unregister('spl_autoload'); - -var_dump(spl_autoload_functions()); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -bool(false) -array(1) { - [0]=> - string(12) "spl_autoload" -} -array(3) { - [0]=> - string(12) "spl_autoload" - [1]=> - string(16) "SplAutoloadTest1" - [2]=> - string(16) "SplAutoloadTest2" -} -array(2) { - [0]=> - string(12) "spl_autoload" - [1]=> - string(16) "SplAutoloadTest2" -} -bool(false) -array(1) { - [0]=> - string(12) "spl_autoload" -} -bool(false) -===DONE=== diff --git a/ext/spl/tests/spl_autoload_003.phpt b/ext/spl/tests/spl_autoload_003.phpt deleted file mode 100755 index 1344b39204..0000000000 --- a/ext/spl/tests/spl_autoload_003.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -SPL: spl_autoload() and friends ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -include_path=. ---FILE-- -<?php - -function TestFunc1($classname) -{ - echo __METHOD__ . "($classname)\n"; -} - -function TestFunc2($classname) -{ - echo __METHOD__ . "($classname)\n"; - throw new Exception("Class $classname missing"); -} - -function TestFunc3($classname) -{ - echo __METHOD__ . "($classname)\n"; -} - -spl_autoload_register("TestFunc1"); -spl_autoload_register("TestFunc2"); -spl_autoload_register("TestFunc3"); - -try -{ - var_dump(class_exists("TestClass", true)); -} -catch(Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -TestFunc1(TestClass) -TestFunc2(TestClass) -Exception: Class TestClass missing -===DONE=== diff --git a/ext/spl/tests/spl_autoload_004.phpt b/ext/spl/tests/spl_autoload_004.phpt deleted file mode 100755 index ec80d38337..0000000000 --- a/ext/spl/tests/spl_autoload_004.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -SPL: spl_autoload() with static methods ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -include_path=. ---FILE-- -<?php - -class MyAutoLoader { - - static function autoLoad($className) { - echo __METHOD__ . "($className)\n"; - } -} - -spl_autoload_register(array('MyAutoLoader', 'autoLoad')); - -// and - -$myAutoLoader = new MyAutoLoader(); - -spl_autoload_register(array($myAutoLoader, 'autoLoad')); - -var_dump(spl_autoload_functions()); - -// check -var_dump(class_exists("TestClass", true)); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(1) { - [0]=> - array(2) { - [0]=> - string(12) "MyAutoLoader" - [1]=> - string(8) "autoLoad" - } -} -MyAutoLoader::autoLoad(TestClass) -bool(false) -===DONE=== diff --git a/ext/spl/tests/spl_autoload_005.phpt b/ext/spl/tests/spl_autoload_005.phpt deleted file mode 100755 index 1f946d9794..0000000000 --- a/ext/spl/tests/spl_autoload_005.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -SPL: spl_autoload() with methods ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -include_path=. ---FILE-- -<?php - -class MyAutoLoader { - - function autoLoad($className) - { - echo __METHOD__ . "($className)\n"; - } - - function autoThrow($className) - { - echo __METHOD__ . "($className)\n"; - throw new Exception("Unavailable"); - } -} - -try -{ - spl_autoload_register(array('MyAutoLoader', 'autoLoad'), true); -} -catch(Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} - -// and - -$myAutoLoader = new MyAutoLoader(); - -spl_autoload_register(array($myAutoLoader, 'autoLoad')); -spl_autoload_register(array($myAutoLoader, 'autoThrow')); - -try -{ - var_dump(class_exists("TestClass", true)); -} -catch(Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Exception: Passed array specifies a non static method but no object -MyAutoLoader::autoLoad(TestClass) -MyAutoLoader::autoThrow(TestClass) -Exception: Unavailable -===DONE=== diff --git a/ext/spl/tests/spl_autoload_006.phpt b/ext/spl/tests/spl_autoload_006.phpt deleted file mode 100755 index 4931c9f27f..0000000000 --- a/ext/spl/tests/spl_autoload_006.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -SPL: spl_autoload() with static methods ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -include_path=. ---FILE-- -<?php - -class MyAutoLoader { - - static function autoLoad($className) { - echo __METHOD__ . "($className)\n"; - } -} - -spl_autoload_register('MyAutoLoader::autoLoad'); - -var_dump(spl_autoload_functions()); - -// check -var_dump(class_exists("TestClass", true)); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(1) { - [0]=> - array(2) { - [0]=> - string(12) "MyAutoLoader" - [1]=> - string(8) "autoLoad" - } -} -MyAutoLoader::autoLoad(TestClass) -bool(false) -===DONE=== diff --git a/ext/spl/tests/spl_autoload_007.phpt b/ext/spl/tests/spl_autoload_007.phpt deleted file mode 100755 index 66c9c5d83b..0000000000 --- a/ext/spl/tests/spl_autoload_007.phpt +++ /dev/null @@ -1,140 +0,0 @@ ---TEST-- -SPL: spl_autoload() with inaccessible methods ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -include_path=. ---FILE-- -<?php - -class MyAutoLoader { - - static protected function noAccess($className) { - echo __METHOD__ . "($className)\n"; - } - - static function autoLoad($className) { - echo __METHOD__ . "($className)\n"; - } - - function dynaLoad($className) { - echo __METHOD__ . "($className)\n"; - } -} - -$obj = new MyAutoLoader; - -$funcs = array( - 'MyAutoLoader::notExist', - 'MyAutoLoader::noAccess', - 'MyAutoLoader::autoLoad', - 'MyAutoLoader::dynaLoad', - array('MyAutoLoader', 'notExist'), - array('MyAutoLoader', 'noAccess'), - array('MyAutoLoader', 'autoLoad'), - array('MyAutoLoader', 'dynaLoad'), - array($obj, 'notExist'), - array($obj, 'noAccess'), - array($obj, 'autoLoad'), - array($obj, 'dynaLoad'), -); - -foreach($funcs as $idx => $func) -{ - if ($idx) echo "\n"; - try - { - var_dump($func); - spl_autoload_register($func); - echo "ok\n"; - } - catch (Exception $e) - { - echo $e->getMessage() . "\n"; - } -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -string(22) "MyAutoLoader::notExist" -Function 'MyAutoLoader::notExist' not found - -string(22) "MyAutoLoader::noAccess" -Function 'MyAutoLoader::noAccess' not callable - -string(22) "MyAutoLoader::autoLoad" -ok - -string(22) "MyAutoLoader::dynaLoad" -Function 'MyAutoLoader::dynaLoad' not callable - -array(2) { - [0]=> - string(12) "MyAutoLoader" - [1]=> - string(8) "notExist" -} -Passed array does not specify an existing static method - -array(2) { - [0]=> - string(12) "MyAutoLoader" - [1]=> - string(8) "noAccess" -} -Passed array does not specify a callable static method - -array(2) { - [0]=> - string(12) "MyAutoLoader" - [1]=> - string(8) "autoLoad" -} -ok - -array(2) { - [0]=> - string(12) "MyAutoLoader" - [1]=> - string(8) "dynaLoad" -} -Passed array specifies a non static method but no object - -array(2) { - [0]=> - object(MyAutoLoader)#%d (0) { - } - [1]=> - string(8) "notExist" -} -Passed array does not specify an existing method - -array(2) { - [0]=> - object(MyAutoLoader)#%d (0) { - } - [1]=> - string(8) "noAccess" -} -Passed array does not specify a callable method - -array(2) { - [0]=> - object(MyAutoLoader)#%d (0) { - } - [1]=> - string(8) "autoLoad" -} -ok - -array(2) { - [0]=> - object(MyAutoLoader)#%d (0) { - } - [1]=> - string(8) "dynaLoad" -} -ok -===DONE=== diff --git a/ext/spl/tests/spl_autoload_008.phpt b/ext/spl/tests/spl_autoload_008.phpt deleted file mode 100755 index bafd26d877..0000000000 --- a/ext/spl/tests/spl_autoload_008.phpt +++ /dev/null @@ -1,131 +0,0 @@ ---TEST-- -SPL: spl_autoload() with exceptions ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---INI-- -include_path=. ---FILE-- -<?php - -function MyAutoLoad($className) -{ - echo __METHOD__ . "($className)\n"; - throw new Exception('Bla'); -} - -class MyAutoLoader -{ - static function autoLoad($className) - { - echo __METHOD__ . "($className)\n"; - throw new Exception('Bla'); - } - - function dynaLoad($className) - { - echo __METHOD__ . "($className)\n"; - throw new Exception('Bla'); - } -} - -$obj = new MyAutoLoader; - -$funcs = array( - 'MyAutoLoad', - 'MyAutoLoader::autoLoad', - 'MyAutoLoader::dynaLoad', - array('MyAutoLoader', 'autoLoad'), - array('MyAutoLoader', 'dynaLoad'), - array($obj, 'autoLoad'), - array($obj, 'dynaLoad'), -); - -foreach($funcs as $idx => $func) -{ - echo "====$idx====\n"; - - try - { - var_dump($func); - spl_autoload_register($func); - if (count(spl_autoload_functions())) - { - echo "registered\n"; - - var_dump(class_exists("NoExistingTestClass", true)); - } - } - catch (Exception $e) - { - echo get_class($e) . ": " . $e->getMessage() . "\n"; - } - - spl_autoload_unregister($func); - var_dump(count(spl_autoload_functions())); -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -====0==== -string(10) "MyAutoLoad" -registered -MyAutoLoad(NoExistingTestClass) -Exception: Bla -int(0) -====1==== -string(22) "MyAutoLoader::autoLoad" -registered -MyAutoLoader::autoLoad(NoExistingTestClass) -Exception: Bla -int(0) -====2==== -string(22) "MyAutoLoader::dynaLoad" -LogicException: Function 'MyAutoLoader::dynaLoad' not callable -int(0) -====3==== -array(2) { - [0]=> - string(12) "MyAutoLoader" - [1]=> - string(8) "autoLoad" -} -registered -MyAutoLoader::autoLoad(NoExistingTestClass) -Exception: Bla -int(0) -====4==== -array(2) { - [0]=> - string(12) "MyAutoLoader" - [1]=> - string(8) "dynaLoad" -} -LogicException: Passed array specifies a non static method but no object -int(0) -====5==== -array(2) { - [0]=> - object(MyAutoLoader)#%d (0) { - } - [1]=> - string(8) "autoLoad" -} -registered -MyAutoLoader::autoLoad(NoExistingTestClass) -Exception: Bla -int(0) -====6==== -array(2) { - [0]=> - object(MyAutoLoader)#%d (0) { - } - [1]=> - string(8) "dynaLoad" -} -registered -MyAutoLoader::dynaLoad(NoExistingTestClass) -Exception: Bla -int(0) -===DONE=== diff --git a/ext/spl/tests/sxe_001.phpt b/ext/spl/tests/sxe_001.phpt deleted file mode 100755 index c6e6b41d0c..0000000000 --- a/ext/spl/tests/sxe_001.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -SPL: SimpleXMLIterator ---SKIPIF-- -<?php -if (!extension_loaded("spl")) print "skip"; -if (!extension_loaded("simplexml")) print "skip SimpleXML not present"; -if (!extension_loaded("libxml")) print "skip LibXML not present"; -?> ---FILE-- -<?php - -$xml =<<<EOF -<?xml version='1.0'?> -<!DOCTYPE sxe SYSTEM "notfound.dtd"> -<sxe id="elem1"> - <elem1 attr1='first'> - <!-- comment --> - <elem2> - <elem3> - <elem4> - <?test processing instruction ?> - </elem4> - </elem3> - </elem2> - </elem1> -</sxe> -EOF; - -var_dump(simplexml_load_string($xml, 'SimpleXMLIterator')); - -?> -===DONE=== ---EXPECTF-- -object(SimpleXMLIterator)#%d (2) { - ["@attributes"]=> - array(1) { - ["id"]=> - string(5) "elem1" - } - ["elem1"]=> - object(SimpleXMLIterator)#%d (3) { - ["@attributes"]=> - array(1) { - ["attr1"]=> - string(5) "first" - } - ["comment"]=> - object(SimpleXMLIterator)#%d (0) { - } - ["elem2"]=> - object(SimpleXMLIterator)#%d (1) { - ["elem3"]=> - object(SimpleXMLIterator)#%d (1) { - ["elem4"]=> - object(SimpleXMLIterator)#%d (1) { - ["test"]=> - object(SimpleXMLIterator)#%d (0) { - } - } - } - } - } -} -===DONE=== diff --git a/ext/spl/tests/sxe_002.phpt b/ext/spl/tests/sxe_002.phpt deleted file mode 100755 index ea9edd39f7..0000000000 --- a/ext/spl/tests/sxe_002.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -SPL: SimpleXMLIterator and recursion ---SKIPIF-- -<?php -if (!extension_loaded("spl")) print "skip"; -if (!extension_loaded('simplexml')) print 'skip'; -if (!extension_loaded("libxml")) print "skip LibXML not present"; -if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available'; -?> ---FILE-- -<?php - -$xml =<<<EOF -<?xml version='1.0'?> -<!DOCTYPE sxe SYSTEM "notfound.dtd"> -<sxe id="elem1"> - Plain text. - <elem1 attr1='first'> - Bla bla 1. - <!-- comment --> - <elem2> - Here we have some text data. - <elem3> - And here some more. - <elem4> - Wow once again. - </elem4> - </elem3> - </elem2> - </elem1> - <elem11 attr2='second'> - Bla bla 2. - <elem111> - Foo Bar - </elem111> - </elem11> -</sxe> -EOF; - -$sxe = simplexml_load_string($xml, 'SimpleXMLIterator'); - -foreach(new RecursiveIteratorIterator($sxe, 1) as $name => $data) { - var_dump($name); - var_dump(get_class($data)); - var_dump(trim($data)); -} - -echo "===DUMP===\n"; - -var_dump(get_class($sxe)); -var_dump(trim($sxe->elem1)); - -?> -===DONE=== ---EXPECT-- -string(5) "elem1" -string(17) "SimpleXMLIterator" -string(10) "Bla bla 1." -string(5) "elem2" -string(17) "SimpleXMLIterator" -string(28) "Here we have some text data." -string(5) "elem3" -string(17) "SimpleXMLIterator" -string(19) "And here some more." -string(5) "elem4" -string(17) "SimpleXMLIterator" -string(15) "Wow once again." -string(6) "elem11" -string(17) "SimpleXMLIterator" -string(10) "Bla bla 2." -string(7) "elem111" -string(17) "SimpleXMLIterator" -string(7) "Foo Bar" -===DUMP=== -string(17) "SimpleXMLIterator" -string(10) "Bla bla 1." -===DONE=== diff --git a/ext/spl/tests/sxe_003.phpt b/ext/spl/tests/sxe_003.phpt deleted file mode 100755 index e222af6eb9..0000000000 --- a/ext/spl/tests/sxe_003.phpt +++ /dev/null @@ -1,79 +0,0 @@ ---TEST-- -SPL: SimpleXMLIterator and getChildren() ---SKIPIF-- -<?php -if (!extension_loaded("spl")) print "skip"; -if (!extension_loaded('simplexml')) print 'skip'; -if (!extension_loaded("libxml")) print "skip LibXML not present"; -if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available'; -?> ---FILE-- -<?php - -$xml =<<<EOF -<?xml version='1.0'?> -<!DOCTYPE sxe SYSTEM "notfound.dtd"> -<sxe id="elem1"> - Plain text. - <elem1 attr1='first'> - Bla bla 1. - <!-- comment --> - <elem2> - Here we have some text data. - <elem3> - And here some more. - <elem4> - Wow once again. - </elem4> - </elem3> - </elem2> - </elem1> - <elem11 attr2='second'> - Bla bla 2. - <elem111> - Foo Bar - </elem111> - </elem11> -</sxe> -EOF; - -$sxe = simplexml_load_string($xml, 'SimpleXMLIterator'); - -foreach($sxe->getChildren() as $name => $data) { - var_dump($name); - var_dump(get_class($data)); - var_dump(trim($data)); -} - -echo "===RESET===\n"; - -for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { - var_dump($sxe->hasChildren()); - var_dump(trim($sxe->key())); - var_dump(trim($sxe->current())); - foreach($sxe->getChildren() as $name => $data) { - var_dump($name); - var_dump(get_class($data)); - var_dump(trim($data)); - } -} - -?> -===DONE=== ---EXPECTF-- - -Warning: Invalid argument supplied for foreach() in %ssxe_003.php on line %d -===RESET=== -bool(true) -string(5) "elem1" -string(10) "Bla bla 1." -string(5) "elem2" -string(17) "SimpleXMLIterator" -string(28) "Here we have some text data." -bool(true) -string(6) "elem11" -string(10) "Bla bla 2." -string(7) "elem111" -string(17) "SimpleXMLIterator" -string(7) "Foo Bar" -===DONE=== diff --git a/ext/spl/tests/sxe_004.phpt b/ext/spl/tests/sxe_004.phpt deleted file mode 100755 index 718a626b61..0000000000 --- a/ext/spl/tests/sxe_004.phpt +++ /dev/null @@ -1,147 +0,0 @@ ---TEST-- -SPL: SimpleXMLIterator and getChildren() ---SKIPIF-- -<?php -if (!extension_loaded("spl")) print "skip"; -if (!extension_loaded('simplexml')) print 'skip'; -if (!extension_loaded("libxml")) print "skip LibXML not present"; -if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available'; -?> ---FILE-- -<?php - -$xml =<<<EOF -<?xml version='1.0'?> -<!DOCTYPE sxe SYSTEM "notfound.dtd"> -<sxe id="elem1"> - Plain text. - <elem1 attr1='first'> - Bla bla 1. - <!-- comment --> - <elem2> - Here we have some text data. - <elem3> - And here some more. - <elem4> - Wow once again. - </elem4> - </elem3> - </elem2> - </elem1> - <elem11 attr2='second'> - Bla bla 2. - <elem111> - Foo Bar - </elem111> - </elem11> -</sxe> -EOF; - -class SXETest extends SimpleXMLIterator -{ - function rewind() - { - echo __METHOD__ . "\n"; - return parent::rewind(); - } - function valid() - { - echo __METHOD__ . "\n"; - return parent::valid(); - } - function current() - { - echo __METHOD__ . "\n"; - return parent::current(); - } - function key() - { - echo __METHOD__ . "\n"; - return parent::key(); - } - function next() - { - echo __METHOD__ . "\n"; - return parent::next(); - } - function hasChildren() - { - echo __METHOD__ . "\n"; - return parent::hasChildren(); - } - function getChildren() - { - echo __METHOD__ . "\n"; - return parent::getChildren(); - } -} - -$sxe = new SXETest($xml); -$rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::SELF_FIRST); - -foreach($rit as $data) { - var_dump(get_class($data)); - var_dump(trim($data)); -} - -?> -===DONE=== ---EXPECTF-- -SXETest::rewind -SXETest::valid -SXETest::hasChildren -SXETest::valid -SXETest::current -string(7) "SXETest" -string(10) "Bla bla 1." -SXETest::getChildren -SXETest::rewind -SXETest::valid -SXETest::hasChildren -SXETest::valid -SXETest::current -string(7) "SXETest" -string(28) "Here we have some text data." -SXETest::getChildren -SXETest::rewind -SXETest::valid -SXETest::hasChildren -SXETest::valid -SXETest::current -string(7) "SXETest" -string(19) "And here some more." -SXETest::getChildren -SXETest::rewind -SXETest::valid -SXETest::hasChildren -SXETest::valid -SXETest::current -string(7) "SXETest" -string(15) "Wow once again." -SXETest::next -SXETest::valid -SXETest::next -SXETest::valid -SXETest::next -SXETest::valid -SXETest::next -SXETest::valid -SXETest::hasChildren -SXETest::valid -SXETest::current -string(7) "SXETest" -string(10) "Bla bla 2." -SXETest::getChildren -SXETest::rewind -SXETest::valid -SXETest::hasChildren -SXETest::valid -SXETest::current -string(7) "SXETest" -string(7) "Foo Bar" -SXETest::next -SXETest::valid -SXETest::next -SXETest::valid -SXETest::valid -===DONE=== diff --git a/ext/spl/tests/sxe_005.phpt b/ext/spl/tests/sxe_005.phpt deleted file mode 100755 index 2efd0a6bee..0000000000 --- a/ext/spl/tests/sxe_005.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -SPL: SimpleXMLIterator and getChildren() ---SKIPIF-- -<?php -if (!extension_loaded("spl")) print "skip"; -if (!extension_loaded('simplexml')) print 'skip'; -if (!extension_loaded("libxml")) print "skip LibXML not present"; -if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available'; -?> ---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(); - } -} - -$sxe = new SXETest($xml); - -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=== diff --git a/ext/spl/tests/testclass b/ext/spl/tests/testclass deleted file mode 100755 index ceb24c877c..0000000000 --- a/ext/spl/tests/testclass +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -echo __FILE__ . "\n"; - -?>
\ No newline at end of file diff --git a/ext/spl/tests/testclass.class.inc b/ext/spl/tests/testclass.class.inc deleted file mode 100755 index f5fe7411fa..0000000000 --- a/ext/spl/tests/testclass.class.inc +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -echo __FILE__ . "\n"; - -class TestClass -{ -} - -?>
\ No newline at end of file diff --git a/ext/spl/tests/testclass.inc b/ext/spl/tests/testclass.inc deleted file mode 100755 index ceb24c877c..0000000000 --- a/ext/spl/tests/testclass.inc +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -echo __FILE__ . "\n"; - -?>
\ No newline at end of file diff --git a/ext/spl/tests/testclass.php.inc b/ext/spl/tests/testclass.php.inc deleted file mode 100755 index ceb24c877c..0000000000 --- a/ext/spl/tests/testclass.php.inc +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -echo __FILE__ . "\n"; - -?>
\ No newline at end of file |