1--TEST--
2GHSA-54hq-v5wp-fqgv - proc_open does not correctly escape args for cmd executing batch files
3--SKIPIF--
4<?php
5if( substr(PHP_OS, 0, 3) != "WIN" )
6  die('skip Run only on Windows');
7?>
8--FILE--
9<?php
10
11$batch_file_content = <<<EOT
12@echo off
13powershell -Command "Write-Output '%1%'"
14EOT;
15$batch_file_path = __DIR__ . '/ghsa-54hq-v5wp-fqgv.bat';
16
17file_put_contents($batch_file_path, $batch_file_content);
18
19$descriptorspec = [STDIN, STDOUT, STDOUT];
20$proc = proc_open(["cmd.exe", "/c", $batch_file_path, "\"&notepad.exe"], $descriptorspec, $pipes);
21proc_close($proc);
22
23?>
24--EXPECT--
25"&notepad.exe
26--CLEAN--
27<?php
28@unlink(__DIR__ . '/ghsa-54hq-v5wp-fqgv.bat');
29?>
30