Edit report at https://bugs.php.net/bug.php?id=63567&edit=1
ID: 63567 Comment by: circus2 at web dot de 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: 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) Previous Comments: ------------------------------------------------------------------------ [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? ------------------------------------------------------------------------ [2012-11-21 08:05:30] circus2 at web dot de It's happening on a Win 7 Home Premium 64Bits running with PHP 5.4.8 VC9 x86 Thread Safe edition but I can reproduce it with every PHP (5.2, 5.3, 5.5alpha) edition. Unfortunately I have also this weird syntax error. I have no clue what's going on. I also played with the php-cli.ini, with my system path and so on. ------------------------------------------------------------------------ [2012-11-20 17:57:16] paj...@php.net Can't reproduce it here. On which system or PHP version(s) does it happen exactly? ------------------------------------------------------------------------ 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