bug65701.phpt 703 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Test for bug #65701: copy() doesn't work when destination filename is created by tempnam()
  3. --CREDITS--
  4. Boro Sitnikovski <buritomath@yahoo.com>
  5. --FILE--
  6. <?php
  7. $file_path = __DIR__ . "/bug65701/";
  8. if (!is_dir($file_path)) {
  9. mkdir($file_path);
  10. }
  11. $src = $file_path . '/srcbug65701_file.txt';
  12. $dst = tempnam($file_path, 'dstbug65701_file.txt');
  13. file_put_contents($src, "Hello World");
  14. copy($src, $dst);
  15. var_dump(filesize($dst));
  16. ?>
  17. --CLEAN--
  18. <?php
  19. $file_path = __DIR__ . "/bug65701/";
  20. foreach (scandir($file_path) as $file) {
  21. if (strpos($file, "bug65701") !== false || 'WIN' == substr(PHP_OS, 0, 3)) {
  22. unlink($file_path . $file);
  23. }
  24. }
  25. rmdir($file_path);
  26. ?>
  27. --EXPECT--
  28. int(11)