fopen_unlink.phpt 556 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Test fopen() function : check fopen()ed descriptor is usable after the fs object is removed
  3. --FILE--
  4. <?php
  5. var_dump(
  6. $p = __DIR__ . DIRECTORY_SEPARATOR . 'tututu',
  7. $f = fopen($p, 'w+'),
  8. unlink($p),
  9. file_exists($p),
  10. fwrite($f, 'hello'),
  11. fseek($f, 0),
  12. fread($f, 16),
  13. fwrite($f, 'world'),
  14. fseek($f, 0),
  15. fread($f, 16),
  16. fclose($f)
  17. );
  18. ?>
  19. --EXPECTF--
  20. string(%d) "%stututu"
  21. resource(%s) of type (Unknown)
  22. bool(true)
  23. bool(false)
  24. int(5)
  25. int(0)
  26. string(5) "hello"
  27. int(5)
  28. int(0)
  29. string(10) "helloworld"
  30. bool(true)