Edit report at https://bugs.php.net/bug.php?id=63567&edit=1
ID: 63567 Updated by: paj...@php.net Reported by: s...@php.net Summary: exec() always yields a 1 return code Status: Feedback Type: Bug Package: Program Execution Operating System: Windows 7 x64 PHP Version: 5.5.0alpha1 Block user comment: N Private report: N New Comment: Arg, misread. So dir has the same issue. Please tell me again: - which PHP version you use (5.4.9 f.e.) - exact windows version (check "My computer" > system) Previous Comments: ------------------------------------------------------------------------ [2012-11-27 15:53:20] paj...@php.net To me it looks like a git issue. Which git version and build do you use? ------------------------------------------------------------------------ [2012-11-27 15:03:27] circus2 at web dot de Ok. I have a file called test.php: <?php exec('dir', $out, $ret); var_dump($ret); when I execute with PHP I get the following output: C:\Test>php -n test.php Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch. int(1) when I execute it directly in the shell I get: C:\Test>php -r "exec('dir', $out, $ret);var_dump($ret);" Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch. int(1) when I use the commands without PHP I get: C:\Test>dir Datenträger in Laufwerk C: ist ACER Volumeseriennummer: xxxxx Verzeichnis von C:\Test 27.11.2012 15:54 <DIR> . 27.11.2012 15:54 <DIR> .. 27.11.2012 15:56 47 test.php 1 Datei(en), 47 Bytes 2 Verzeichnis(se), 171.682.844.672 Bytes frei C:\Test>echo %errorlevel% 0 The commands are executed in every case. So I can add var_dump($out); to test.php and get: C:\Test>php -n test.php Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch. array(10) { [0]=> string(36) " Datenträger in Laufwerk C: ist ACER" [1]=> string(30) " Volumeseriennummer: xxxxx" [2]=> string(0) "" [3]=> string(24) " Verzeichnis von C:\Test" [4]=> string(0) "" [5]=> string(37) "27.11.2012 16:01 <DIR> ." [6]=> string(38) "27.11.2012 16:01 <DIR> .." [7]=> string(44) "27.11.2012 16:01 63 test.php" [8]=> string(48) " 1 Datei(en), 63 Bytes" [9]=> string(60) " 2 Verzeichnis(se), 171.683.024.896 Bytes frei" } int(1) ------------------------------------------------------------------------ [2012-11-27 12:43:33] paj...@php.net @circus please do not try with git but only what is used in this report. This is the most simple command and no git specific (or whatever is used behind it) are involved. And again, under CLI the ini settings do not matter, simply run the script with php.exe -n test.php ------------------------------------------------------------------------ [2012-11-27 12:32:49] circus2 at web dot de I already tried it in CLI mode and I tried TS as well as NTS. I also played with the php-cli.ini and also tried it without renaming the ini-files (fresh php copies). Also played with the system path to add git / php and everything involved. Nothing changed. I believe it's a setting of my environment or some programm hooked on the cmd.exe I still get return code 1 and the syntax error - but the command is executed. Is there any command i can use to cross check something. ------------------------------------------------------------------------ [2012-11-27 09:51:37] paj...@php.net @circus ini settings won't affect anything in this area using cli. Do you always use the TS version? Can you test only in CLI please and post the result here? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=63567 -- Edit this bug report at https://bugs.php.net/bug.php?id=63567&edit=1