Bug #79704 [Opn->Nab]: proc_open failure with Windows

From: Date: Tue, 16 Jun 2020 02:46:28 +0000
Subject: Bug #79704 [Opn->Nab]: proc_open failure with Windows
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227501@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79704&edit=1 ID: 79704 Updated by: requinix@php.net Reported by: svnpenn at gmail dot com Summary: proc_open failure with Windows -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Windows 10 PHP Version: 7.4.7 Block user comment: N Private report: N New Comment: proc_open() with the $cmd as an array will quote all the arguments. Try running the resultant command yourself: C:\>"C:\Windows\System32\msiexec.exe" "TargetDir=C:\TargetDir" "/qb" "/a" "a.msi" What you need to do is $a = "C:\\Windows\\System32\\msiexec.exe TargetDir=C:\\TargetDir /qb /a a.msi"; The important thing is that you do not quote the TargetDir option or the flags. If the filename is variable then you may quote it (using escapeshellarg) - this works because msiexec specifically supports it. Previous Comments: ------------------------------------------------------------------------ [2020-06-16 02:30:42] svnpenn at gmail dot com Description: ------------ proc_open failure with Windows If I run this Python script: import subprocess a = [ r'C:\Windows\System32\msiexec.exe', r'TargetDir=C:\TargetDir', '/qb', '/a', 'a.msi' ] subprocess.run(a) Everything is fine, but if I run this PHP script: <?php declare(strict_types = 1); $a1 = [ 'C:\\Windows\\System32\\msiexec.exe', 'TargetDir=C:\\TargetDir', '/qb', '/a', 'a.msi' ]; $a2 = []; $a3 = []; proc_open($a1, $a2, $a3); I just get the usage page for Windows Installer. The documentation and tests show that you can use an array: - https://github.com/php/php-src/blob/master/ext/standard/tests/general_functions/proc_open_array.phpt - https://www.php.net/manual/en/function.proc-open.php but it seems PHP is doing something funny with the parsing. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79704&edit=1

« previous php.bugs (#227501) next »