bug81223.phpt 596 B

123456789101112131415161718192021222324
  1. --TEST--
  2. Bug #81223 (flock() only locks first byte of file)
  3. --SKIPIF--
  4. <?php
  5. if (PHP_OS_FAMILY !== "Windows") die("skip for Windows only");
  6. ?>
  7. --FILE--
  8. <?php
  9. $filename = __FILE__;
  10. $stream1 = fopen($filename, "r");
  11. var_dump(flock($stream1, LOCK_EX));
  12. $stream2 = fopen($filename, "r");
  13. var_dump(fread($stream2, 5));
  14. fseek($stream2, 1);
  15. var_dump(fread($stream2, 4));
  16. ?>
  17. --EXPECTF--
  18. bool(true)
  19. Notice: fread(): Read of %d bytes failed with errno=13 Permission denied in %s on line %d
  20. bool(false)
  21. Notice: fread(): Read of %d bytes failed with errno=13 Permission denied in %s on line %d
  22. bool(false)