bug68128.phpt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. --TEST--
  2. Bug #68128 - RecursiveRegexIterator raises "Array to string conversion" notice
  3. --FILE--
  4. <?php
  5. $array = new ArrayIterator(array('a', array('b', 'c')));
  6. $regex = new RegexIterator($array, '/Array/');
  7. foreach ($regex as $match) {
  8. var_dump($match);
  9. }
  10. $rArrayIterator = new RecursiveArrayIterator(array('test1', array('tet3', 'test4', 'test5')));
  11. $rRegexIterator = new RecursiveRegexIterator($rArrayIterator, '/^(t)est(\d*)/',
  12. RecursiveRegexIterator::ALL_MATCHES, 0, PREG_PATTERN_ORDER);
  13. foreach ($rRegexIterator as $key1 => $value1) {
  14. if ($rRegexIterator->hasChildren()) {
  15. // print all children
  16. echo "Children: ";
  17. foreach ($rRegexIterator->getChildren() as $key => $value) {
  18. print_r($value);
  19. }
  20. echo "\n";
  21. } else {
  22. echo "No children ";
  23. print_r($value1);
  24. echo "\n";
  25. }
  26. }
  27. ?>
  28. --EXPECT--
  29. No children Array
  30. (
  31. [0] => Array
  32. (
  33. [0] => test1
  34. )
  35. [1] => Array
  36. (
  37. [0] => t
  38. )
  39. [2] => Array
  40. (
  41. [0] => 1
  42. )
  43. )
  44. Children: Array
  45. (
  46. [0] => Array
  47. (
  48. [0] => test4
  49. )
  50. [1] => Array
  51. (
  52. [0] => t
  53. )
  54. [2] => Array
  55. (
  56. [0] => 4
  57. )
  58. )
  59. Array
  60. (
  61. [0] => Array
  62. (
  63. [0] => test5
  64. )
  65. [1] => Array
  66. (
  67. [0] => t
  68. )
  69. [2] => Array
  70. (
  71. [0] => 5
  72. )
  73. )