readlink_variation1.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. Test readlink() function: usage variations - invalid filenames
  3. --CREDITS--
  4. Dave Kelsey <d_kelsey@uk.ibm.com>
  5. --CONFLICTS--
  6. obscure_filename
  7. --FILE--
  8. <?php
  9. /* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */
  10. $file_path = __DIR__;
  11. echo "*** Testing Invalid file types ***\n";
  12. $filenames = array(
  13. /* Invalid filenames */
  14. -2.34555,
  15. "",
  16. TRUE,
  17. FALSE,
  18. /* scalars */
  19. 1234,
  20. 0
  21. );
  22. /* loop through to test each element the above array */
  23. foreach( $filenames as $filename ) {
  24. var_dump( readlink($filename) );
  25. clearstatcache();
  26. }
  27. ?>
  28. --CLEAN--
  29. <?php
  30. $file_path = __DIR__;
  31. unlink($file_path."/readlink_variation2.tmp");
  32. ?>
  33. --EXPECTF--
  34. *** Testing Invalid file types ***
  35. Warning: readlink(): %s in %s on line %d
  36. bool(false)
  37. Warning: readlink(): %s in %s on line %d
  38. bool(false)
  39. Warning: readlink(): %s in %s on line %d
  40. bool(false)
  41. Warning: readlink(): %s in %s on line %d
  42. bool(false)
  43. Warning: readlink(): %s in %s on line %d
  44. bool(false)
  45. Warning: readlink(): %s in %s on line %d
  46. bool(false)