21## This is just a helper for intercepting stdin/stdout and the file and create a half-finished test.
22## The output still may need adapting to match file names etc.
28$pass_options =
' -qbI -n -d "error_reporting=32767" -d "display_errors=1" -d "display_startup_errors=1" -d "log_errors=0"';
32if (isset($argc) && $argc > 1) {
34 for ($i = 1; $i < $argc; $i++) {
35 if ($argv[$i][0] ==
"-" && !$post_ddash) {
36 switch (
substr($argv[$i], 1)) {
52 $real_argv[] = $argv[$i];
55 if (isset($real_argv[0])) {
61$proc =
proc_open(
"$phpdbg $pass_options $file -- $cmdargv", [[
"pipe",
"r"], [
"pipe",
"w"], [
"pipe",
"w"]], $pipes);
63 die(
"Couldn't start phpdbg\n");
71 $r = [$pipes[1], STDIN];
76 if (
"" != $in =
fread(STDIN, 1024)) {
83 die(
"stdin closed?!\n");
86 if (
feof($pipes[1])) {
93}
while (
$n !==
false);
99 print "Specify the test description: ";
103 print "Specify the test file name (leave empty to write to stderr): ";
106 print "That file already exists. Type y or yes to overwrite: ";
108 if ($y !==
"y" && $y !==
"yes") {
128 $testdata .=
"\n--INI--\n".implode(
"\n", $ini);
140 print "Test saved to $testfile\n";
142 print "The test could not be saved to $testfile; outputting on stderr now\n";
proc_open(array|string $command, array $descriptor_spec, &$pipes, ?string $cwd=null, ?array $env_vars=null, ?array $options=null)
array_slice(array $array, int $offset, ?int $length=null, bool $preserve_keys=false)
implode(string|array $separator, ?array $array=null)
trim(string $string, string $characters=" \n\r\t\v\0")
getenv(?string $name=null, bool $local_only=false)
file_exists(string $filename)
stream_select(?array &$read, ?array &$write, ?array &$except, ?int $seconds, ?int $microseconds=null)
str_replace(array|string $search, array|string $replace, string|array $subject, &$count=null)
file_put_contents(string $filename, mixed $data, int $flags=0, $context=null)
fwrite($stream, string $data, ?int $length=null)
array_map(?callable $callback, array $array, array ... $arrays)
fread($stream, int $length)
fgets($stream, ?int $length=null)
stream_set_blocking($stream, bool $enable)
substr(string $string, int $offset, ?int $length=null)
if(isset($argc) && $argc > 1) $proc
if(! $pass2) elseif( $pass2==1) elseif( $pass2==2)
error_reporting(?int $error_level=null)
die(string|int $status=0)