fopen_unlink.phpt 555 B

12345678910111213141516171819202122232425262728293031323334
  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 = dirname(__FILE__) . 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. ===DONE===
  20. --EXPECTF--
  21. string(%d) "%stututu"
  22. resource(%s) of type (Unknown)
  23. bool(true)
  24. bool(false)
  25. int(5)
  26. int(0)
  27. string(5) "hello"
  28. int(5)
  29. int(0)
  30. string(10) "helloworld"
  31. bool(true)
  32. ===DONE===