1--TEST-- 2SPL: RecursiveTreeIterator::setPrefixPart() 3--INI-- 4error_reporting=E_ALL&~E_NOTICE 5--FILE-- 6<?php 7 8$ary = array( 9 "a" => array("b"), 10 "c" => array("d"), 11); 12 13$it = new RecursiveArrayIterator($ary); 14$it = new RecursiveTreeIterator($it); 15for($i = 0; $i < 6; ++$i) { 16 $it->setPrefixPart($i, $i); 17} 18foreach($it as $k => $v) { 19 echo "[$k] => $v\n"; 20} 21try { 22 $it->setPrefixPart(-1, ""); 23} catch (\ValueError $e) { 24 echo $e->getMessage() . \PHP_EOL; 25} 26try { 27 $it->setPrefixPart(6, ""); 28} catch (\ValueError $e) { 29 echo $e->getMessage() . \PHP_EOL; 30} 31?> 32--EXPECT-- 33[a] => 035Array 34[0] => 0145b 35[c] => 045Array 36[0] => 0245d 37RecursiveTreeIterator::setPrefixPart(): Argument #1 ($part) must be a RecursiveTreeIterator::PREFIX_* constant 38RecursiveTreeIterator::setPrefixPart(): Argument #1 ($part) must be a RecursiveTreeIterator::PREFIX_* constant 39