95 $temp_file = tempnam ( sys_get_temp_dir (),
'Tux' );
96 $fp = \fopen ( $temp_file,
'w' );
97 \fwrite ( $fp, $code );
99 if (\file_exists ( $temp_file )) {
101 if (isset ( $phpExe )) {
102 exec ( $phpExe .
' -l ' . $temp_file, $output, $result );
104 $output = \implode (
'', $output );
105 \unlink ( $temp_file );
106 if (strpos ( $output,
'No syntax errors detected' ) ===
false && $result !== 1) {
119 if (defined (
'PHP_BINARY' ) && PHP_BINARY && in_array ( PHP_SAPI, array (
'cli',
'cli-server' ) ) && is_file ( PHP_BINARY )) {
121 }
else if (\strtoupper ( substr ( PHP_OS, 0, 3 ) ) ===
'WIN') {
122 $paths = \explode ( PATH_SEPARATOR, getenv (
'PATH' ) );
123 foreach ( $paths as $path ) {
124 if (substr ( $path, strlen ( $path ) - 1 ) == \DS) {
125 $path = \substr ( $path, 0, strlen ( $path ) - 1 );
127 if (\substr ( $path, strlen ( $path ) - strlen (
'php' ) ) ==
'php') {
128 $response = $path . \DS .
'php.exe';
129 if (is_file ( $response )) {
132 }
else if (\substr ( $path, \strlen ( $path ) - \strlen (
'php.exe' ) ) ==
'php.exe') {
133 if (\is_file ( $path )) {
139 $paths = \explode ( PATH_SEPARATOR, getenv (
'PATH' ) );
140 foreach ( $paths as $path ) {
141 if (\substr ( $path, \strlen ( $path ) - 1 ) == \DS) {
142 $path = substr ( $path, strlen ( $path ) - 1 );
144 if (\substr ( $path, \strlen ( $path ) - \strlen (
'php' ) ) ==
'php') {
145 if (\is_file ( $path )) {
148 $response = $path . \DS .
'php';
149 if (\is_file ( $response )) {