xref: /PHP-8.4/sapi/cli/tests/013.phpt (revision dcc3255b)
1--TEST--
2running PHP code before and after processing input lines with -B and -E
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_ESCAPED');
14
15$filename_txt = __DIR__."/013.test.txt";
16$filename_txt_escaped = escapeshellarg($filename_txt);
17file_put_contents($filename_txt, "test\nfile\ncontents\n");
18
19var_dump(`cat $filename_txt_escaped | $php -n -B 'var_dump("start");'`);
20var_dump(`cat $filename_txt_escaped | $php -n -E 'var_dump("end");'`);
21var_dump(`cat $filename_txt_escaped | $php -n -B 'var_dump("start");' -E 'var_dump("end");'`);
22
23@unlink($filename_txt);
24
25echo "Done\n";
26?>
27--EXPECT--
28string(18) "string(5) "start"
29"
30string(16) "string(3) "end"
31"
32string(34) "string(5) "start"
33string(3) "end"
34"
35Done
36