phar_oo_002.phpt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. --TEST--
  2. Phar object: iterator & entries
  3. --EXTENSIONS--
  4. phar
  5. --INI--
  6. phar.readonly=1
  7. phar.require_hash=0
  8. --FILE--
  9. <?php
  10. require_once 'files/phar_oo_test.inc';
  11. $phar = new Phar($fname);
  12. $phar->setInfoClass('SplFileInfo');
  13. foreach($phar as $name => $ent)
  14. {
  15. var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name));
  16. var_dump($ent->getFilename());
  17. var_dump($ent->getSize());
  18. var_dump($ent->getType());
  19. var_dump($ent->isWritable());
  20. var_dump($ent->isReadable());
  21. var_dump($ent->isExecutable());
  22. var_dump($ent->isFile());
  23. var_dump($ent->isDir());
  24. var_dump($ent->isLink());
  25. var_dump($ent->getCTime());
  26. var_dump($ent->getMTime());
  27. var_dump($ent->getATime());
  28. }
  29. echo "==RECURSIVE==\n";
  30. $phar = new Phar($fname);
  31. foreach(new RecursiveIteratorIterator($phar) as $name => $ent)
  32. {
  33. var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name));
  34. var_dump(str_replace('\\', '/', $ent->getFilename()));
  35. var_dump($ent->getCompressedSize());
  36. var_dump($ent->isCRCChecked());
  37. var_dump($ent->isCRCChecked() ? $ent->getCRC32() : NULL);
  38. var_dump($ent->getPharFlags());
  39. }
  40. ?>
  41. --CLEAN--
  42. <?php
  43. unlink(__DIR__ . '/files/phar_oo_002.phar.php');
  44. __halt_compiler();
  45. ?>
  46. --EXPECTF--
  47. string(41) "phar://*/files/phar_oo_002.phar.php%ca.php"
  48. string(5) "a.php"
  49. int(32)
  50. string(4) "file"
  51. bool(false)
  52. bool(true)
  53. bool(false)
  54. bool(true)
  55. bool(false)
  56. bool(false)
  57. int(%d)
  58. int(%d)
  59. int(%d)
  60. string(37) "phar://*/files/phar_oo_002.phar.php%cb"
  61. string(1) "b"
  62. int(0)
  63. string(3) "dir"
  64. bool(false)
  65. bool(true)
  66. bool(true)
  67. bool(false)
  68. bool(true)
  69. bool(false)
  70. int(%d)
  71. int(%d)
  72. int(%d)
  73. string(41) "phar://*/files/phar_oo_002.phar.php%cb.php"
  74. string(5) "b.php"
  75. int(32)
  76. string(4) "file"
  77. bool(false)
  78. bool(true)
  79. bool(false)
  80. bool(true)
  81. bool(false)
  82. bool(false)
  83. int(%d)
  84. int(%d)
  85. int(%d)
  86. string(41) "phar://*/files/phar_oo_002.phar.php%ce.php"
  87. string(5) "e.php"
  88. int(32)
  89. string(4) "file"
  90. bool(false)
  91. bool(true)
  92. bool(false)
  93. bool(true)
  94. bool(false)
  95. bool(false)
  96. int(%d)
  97. int(%d)
  98. int(%d)
  99. ==RECURSIVE==
  100. string(41) "phar://*/files/phar_oo_002.phar.php%ca.php"
  101. string(5) "a.php"
  102. int(32)
  103. bool(false)
  104. NULL
  105. int(0)
  106. string(43) "phar://*/files/phar_oo_002.phar.php/b%cc.php"
  107. string(5) "c.php"
  108. int(34)
  109. bool(false)
  110. NULL
  111. int(0)
  112. string(43) "phar://*/files/phar_oo_002.phar.php/b%cd.php"
  113. string(5) "d.php"
  114. int(34)
  115. bool(false)
  116. NULL
  117. int(0)
  118. string(41) "phar://*/files/phar_oo_002.phar.php%cb.php"
  119. string(5) "b.php"
  120. int(32)
  121. bool(false)
  122. NULL
  123. int(0)
  124. string(41) "phar://*/files/phar_oo_002.phar.php%ce.php"
  125. string(5) "e.php"
  126. int(32)
  127. bool(false)
  128. NULL
  129. int(0)