|
| 1 | +--TEST-- |
| 2 | +Interactive shell: multiline input states |
| 3 | +--EXTENSIONS-- |
| 4 | +readline |
| 5 | +--SKIPIF-- |
| 6 | +<?php |
| 7 | +if (!function_exists('proc_open')) die('skip proc_open() not available'); |
| 8 | +?> |
| 9 | +--FILE-- |
| 10 | +<?php |
| 11 | +$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); |
| 12 | +$ini = getenv('TEST_PHP_EXTRA_ARGS'); |
| 13 | +$descriptorspec = [['pipe', 'r'], STDOUT, STDERR]; |
| 14 | +$proc = proc_open("$php $ini -a", $descriptorspec, $pipes); |
| 15 | + |
| 16 | +fwrite($pipes[0], "\n"); |
| 17 | +fwrite($pipes[0], "echo strtoupper('single \\' semi ; brace }\nend');\n"); |
| 18 | +fwrite($pipes[0], "echo strtoupper(\"double \\\" semi ; brace }\nend\");\n"); |
| 19 | +fwrite($pipes[0], "echo strtoupper(\n\"paren\"\n);\n"); |
| 20 | +fwrite($pipes[0], "echo \"arithmetic=\", 6 /\n2 + 100;\n"); |
| 21 | +fwrite($pipes[0], "if (true) {\necho strtoupper(\"block_body\n\");\n}\n"); |
| 22 | +fwrite($pipes[0], "echo strtoupper(\n\"hash_comment\\n\"\n# ) ;\n);\n"); |
| 23 | +fwrite($pipes[0], "echo strtoupper(\n\"slash_comment\\n\"\n// ) ;\n);\n"); |
| 24 | +fwrite($pipes[0], "echo strtoupper(\n\"block_comment\\n\" /*\n) ;\n*/\n);\n"); |
| 25 | +fwrite($pipes[0], "#[AllowDynamicProperties]\nclass ReadlineCliCoverageClass {}\n"); |
| 26 | +fwrite($pipes[0], "echo strtoupper((new ReflectionClass(ReadlineCliCoverageClass::class))->getAttributes()[0]->getName()), \"\\n\";\n"); |
| 27 | +fwrite($pipes[0], "if (true) ?>outside } );\n<?php\necho strtoupper(\"outside_ok\\n\");\n"); |
| 28 | +fwrite($pipes[0], "quit\n"); |
| 29 | +fclose($pipes[0]); |
| 30 | +proc_close($proc); |
| 31 | +?> |
| 32 | +--EXPECTF-- |
| 33 | +%AInteractive shell%ASINGLE%ADOUBLE%APAREN%Aarithmetic=103%ABLOCK_BODY%AHASH_COMMENT%ASLASH_COMMENT%ABLOCK_COMMENT%AALLOWDYNAMICPROPERTIES%AOUTSIDE_OK%A |
0 commit comments