bug78323.phpt 769 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Bug #78323 Test exit code and error message for invalid parameters
  3. --SKIPIF--
  4. <?php include "skipif.inc"; ?>
  5. --FILE--
  6. <?php
  7. include "include.inc";
  8. $php = get_cgi_path();
  9. reset_env_vars();
  10. // no argument for option
  11. ob_start();
  12. passthru("$php --memory-limit=1G 2>&1", $exitCode);
  13. $output = ob_get_contents();
  14. ob_end_clean();
  15. $lines = preg_split('/\R/', $output);
  16. echo $lines[0], "\n",
  17. $lines[1], "\n",
  18. "Done: $exitCode\n\n";
  19. // Successful execution
  20. ob_start();
  21. passthru("$php -dmemory-limit=1G -v", $exitCode);
  22. $output = ob_get_contents();
  23. ob_end_clean();
  24. $lines = preg_split('/\R/', $output);
  25. echo $lines[0], "\n",
  26. "Done: $exitCode\n";
  27. ?>
  28. --EXPECTF--
  29. Error in argument 1, char 1: no argument for option -
  30. Usage: %s
  31. Done: 1
  32. PHP %s
  33. Done: 0