xref: /PHP-7.4/sapi/cgi/tests/004.phpt (revision 26dfce7f)
1--TEST--
2execute a file with -f
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9
10include "include.inc";
11
12$php = get_cgi_path();
13reset_env_vars();
14
15$filename = __DIR__.'/004.test.php';
16$code ='
17<?php
18
19class test {
20	private $pri;
21}
22
23var_dump(test::$pri);
24?>
25';
26
27file_put_contents($filename, $code);
28
29if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
30	var_dump(`$php -n -f "$filename"`);
31} else {
32	var_dump(`$php -n -f "$filename" 2>/dev/null`);
33}
34var_dump(`$php -n -f "wrong"`);
35
36@unlink($filename);
37
38echo "Done\n";
39?>
40--EXPECTF--
41string(%d) "
42<br />
43<b>Fatal error</b>:  Uncaught Error: Cannot access private property test::$pri in %s004.test.php:8
44Stack trace:
45#0 {main}
46  thrown in <b>%s004.test.php</b> on line <b>8</b><br />
47"
48string(25) "No input file specified.
49"
50Done
51