xref: /PHP-7.4/sapi/cli/tests/008.phpt (revision 26dfce7f)
1--TEST--
2execute a file with -f
3--SKIPIF--
4<?php
5include "skipif.inc";
6if (substr(PHP_OS, 0, 3) == 'WIN') {
7	die ("skip not for Windows");
8}
9?>
10--FILE--
11<?php
12
13$php = getenv('TEST_PHP_EXECUTABLE');
14
15$filename = __DIR__.'/008.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
29var_dump(`$php -n -f "$filename"`);
30var_dump(`$php -n -f "wrong"`);
31
32@unlink($filename);
33
34echo "Done\n";
35?>
36--EXPECTF--
37string(%d) "
38
39Fatal error: Uncaught Error: Cannot access private property test::$pri in %s:%d
40Stack trace:
41#0 {main}
42  thrown in %s on line %d
43"
44string(33) "Could not open input file: wrong
45"
46Done
47