escapeshellarg_basic.phpt 729 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Test escapeshellarg() function: basic test
  3. --SKIPIF--
  4. <?php
  5. if( substr(PHP_OS, 0, 3) == "WIN" )
  6. die("skip.. Do not run on Windows");
  7. ?>
  8. --FILE--
  9. <?php
  10. /* Prototype : string escapeshellarg ( string $arg )
  11. * Description: Escape a string to be used as a shell argument.
  12. * Source code: ext/standard/exec.c
  13. * Alias to functions:
  14. */
  15. echo "Simple testcase for escapeshellarg() function\n";
  16. var_dump(escapeshellarg("Mr O'Neil"));
  17. var_dump(escapeshellarg("Mr O\'Neil"));
  18. var_dump(escapeshellarg("%FILENAME"));
  19. var_dump(escapeshellarg(""));
  20. echo "Done\n";
  21. ?>
  22. --EXPECT--
  23. Simple testcase for escapeshellarg() function
  24. string(14) "'Mr O'\''Neil'"
  25. string(15) "'Mr O\'\''Neil'"
  26. string(11) "'%FILENAME'"
  27. string(2) "''"
  28. Done