bug72625.phpt 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --TEST--
  2. Bug #72625 realpath() fails on very long argument.
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) != 'WIN') {
  6. die("skip Valid only on Windows");
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. $base = sys_get_temp_dir() . "/" . md5(uniqid());
  12. while (strlen($base) < 260) {
  13. $base = "$base/" . md5(uniqid());
  14. }
  15. $f0 = "$base/_test/documents/projects/myproject/vendor/name/library/classpath";
  16. $f1 = "$f0/../../../../../../../../_test/documents/projects/myproject/vendor/name/library/../../../../../../../_test/documents/projects/myproject/vendor/name/library/classpath";
  17. mkdir($f0, 0777, true);
  18. var_dump(
  19. $f0,
  20. file_exists($f0),
  21. realpath($f0),
  22. dirname($f0),
  23. $f1,
  24. file_exists($f1),
  25. realpath($f1),
  26. dirname($f1)
  27. );
  28. $tmp = $f0;
  29. while ($tmp > $base) {
  30. rmdir($tmp);
  31. $tmp = dirname($tmp);
  32. }
  33. ?>
  34. --EXPECTF--
  35. string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath"
  36. bool(true)
  37. string(%d) "%s\_test\documents\projects\myproject\vendor\name\library\classpath"
  38. string(%d) "%s/_test/documents/projects/myproject/vendor/name/library"
  39. string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath/../../../../../../../../_test/documents/projects/myproject/vendor/name/library/../../../../../../../_test/documents/projects/myproject/vendor/name/library/classpath"
  40. bool(true)
  41. string(%d) "%s\_test\documents\projects\myproject\vendor\name\library\classpath"
  42. string(%d) "%s/_test/documents/projects/myproject/vendor/name/library"