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