xref: /PHP-8.0/sapi/cgi/tests/006.phpt (revision f8d79582)
1--TEST--
2syntax check
3--SKIPIF--
4<?php include "skipif.inc"; ?>
5--INI--
6display_errors=stdout
7--FILE--
8<?php
9include "include.inc";
10
11$php = get_cgi_path();
12reset_env_vars();
13
14$filename = __DIR__."/006.test.php";
15
16$code = '
17<?php
18
19$test = "var";
20
21class test {
22    private $var;
23}
24
25echo test::$var;
26
27?>
28';
29
30file_put_contents($filename, $code);
31
32var_dump(`"$php" -n -l "$filename"`);
33var_dump(`"$php" -n -l some.unknown`);
34
35$code = '
36<?php
37
38class test
39    private $var;
40}
41
42?>
43';
44
45file_put_contents($filename, $code);
46
47if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
48    var_dump(`"$php" -n -l "$filename"`);
49} else {
50    var_dump(`"$php" -n -l "$filename" 2>/dev/null`);
51}
52
53@unlink($filename);
54
55echo "Done\n";
56?>
57--EXPECTF--
58string(%d) "No syntax errors detected in %s006.test.php
59"
60string(%d) "No input file specified.
61"
62string(%d) "<br />
63<b>Parse error</b>: %s expecting %s{%s in <b>%s006.test.php</b> on line <b>5</b><br />
64Errors parsing %s006.test.php
65"
66Done
67