Bug #63567 [Com]: exec() always yields a 1 return code

2012-11-28 Thread circus2 at web dot de
Edit report at https://bugs.php.net/bug.php?id=63567edit=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:

Problem solved! I'm so sorry about all these inconveniences and on the other 
side thank you for your support.

The problem was a small tool called Ansicon it hooks on the autoload of cmd.exe 
in the windows registry. I used it a couple of months ago but uninstalled it 
immediately. It seem to have no effect by this time but it looks now like the 
uninstall procedure doesn't care about the windows registry keys it has made 
when installed.

So I deleted these keys and now everything is fine. No syntax error and status 
code is 0. \o/

Thank you


Previous Comments:

[2012-11-28 07:55:23] circus2 at web dot de

1. I use PHP 5.4.9, VC9, x86, TS from http://windows.php.net

2. Win7 SP1 Home Premium 64 Bit


[2012-11-27 16:55:45] paj...@php.net

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)


[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:\Testphp -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:\Testphp -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:\Testdir
 Datenträger in Laufwerk C: ist ACER
 Volumeseriennummer: x

 Verzeichnis von C:\Test

27.11.2012  15:54DIR  .
27.11.2012  15:54DIR  ..
27.11.2012  15:5647 test.php
   1 Datei(en), 47 Bytes
   2 Verzeichnis(se), 171.682.844.672 Bytes frei

C:\Testecho %errorlevel%
0


The commands are executed in every case. So I can add var_dump($out); to 
test.php and get:

 C:\Testphp -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: x
  [2]=
  string(0) 
  [3]=
  string(24)  Verzeichnis von C:\Test
  [4]=
  string(0) 
  [5]=
  string(37) 27.11.2012  16:01DIR  .
  [6]=
  string(38) 27.11.2012  16:01DIR  ..
  [7]=
  string(44) 27.11.2012  16:0163 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




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=63567edit=1


Bug #63567 [Com]: exec() always yields a 1 return code

2012-11-27 Thread circus2 at web dot de
Edit report at https://bugs.php.net/bug.php?id=63567edit=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:

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.


Previous Comments:

[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?


[2012-11-20 16:19:56] s...@php.net

Description:

Running exec() seems to detect a non-zero (and specifically 1) return code/exit 
code for the process. No matter what process. It also affects the proc_open 
class of functions so there is not even a decent workaround as far as we know.

Works on my machine but @johmue on github has the issue consistently. He tried 
with all latest 5.2, 5.3 and 5.4, even 5.5-alpha1. They all do the same. Yet on 
my machine 5.4.8 works fine. At first sight I have exactly the same OS and PHP 
build that he does, so this makes no sense to me. There must be something wrong 
in his environment but we are not able to figure out what causes it.

Note that trying the same thing in the shell directly yields a correct result, 
so the issue seems to be in php, for example this works:

C:\dir
[snip]
C:\echo %errorlevel%
0

You can find the full thread below, but I tried to sum it up above:

https://github.com/composer/composer/issues/613

Test script:
---
C:\php -r exec('dir', $out, $ret);var_dump($ret);


Expected result:

int(0)


Actual result:
--
Die Syntax für den Dateinamen, Verzeichnisnamen oder die 
Datenträgerbezeichnung
ist falsch.
int(1)




Interstingly, it does output the wrong return code, and also prints this 
warning saying that the syntax of the filename/command is wrong.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63567edit=1


Bug #63567 [Com]: exec() always yields a 1 return code

2012-11-27 Thread circus2 at web dot de
Edit report at https://bugs.php.net/bug.php?id=63567edit=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:\Testphp -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:\Testphp -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:\Testdir
 Datenträger in Laufwerk C: ist ACER
 Volumeseriennummer: x

 Verzeichnis von C:\Test

27.11.2012  15:54DIR  .
27.11.2012  15:54DIR  ..
27.11.2012  15:5647 test.php
   1 Datei(en), 47 Bytes
   2 Verzeichnis(se), 171.682.844.672 Bytes frei

C:\Testecho %errorlevel%
0


The commands are executed in every case. So I can add var_dump($out); to 
test.php and get:

 C:\Testphp -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: x
  [2]=
  string(0) 
  [3]=
  string(24)  Verzeichnis von C:\Test
  [4]=
  string(0) 
  [5]=
  string(37) 27.11.2012  16:01DIR  .
  [6]=
  string(38) 27.11.2012  16:01DIR  ..
  [7]=
  string(44) 27.11.2012  16:0163 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=63567edit=1


Bug #63567 [Com]: exec() always yields a 1 return code

2012-11-27 Thread circus2 at web dot de
Edit report at https://bugs.php.net/bug.php?id=63567edit=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:

1. I use PHP 5.4.9, VC9, x86, TS from http://windows.php.net

2. Win7 SP1 Home Premium 64 Bit


Previous Comments:

[2012-11-27 16:55:45] paj...@php.net

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)


[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:\Testphp -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:\Testphp -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:\Testdir
 Datenträger in Laufwerk C: ist ACER
 Volumeseriennummer: x

 Verzeichnis von C:\Test

27.11.2012  15:54DIR  .
27.11.2012  15:54DIR  ..
27.11.2012  15:5647 test.php
   1 Datei(en), 47 Bytes
   2 Verzeichnis(se), 171.682.844.672 Bytes frei

C:\Testecho %errorlevel%
0


The commands are executed in every case. So I can add var_dump($out); to 
test.php and get:

 C:\Testphp -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: x
  [2]=
  string(0) 
  [3]=
  string(24)  Verzeichnis von C:\Test
  [4]=
  string(0) 
  [5]=
  string(37) 27.11.2012  16:01DIR  .
  [6]=
  string(38) 27.11.2012  16:01DIR  ..
  [7]=
  string(44) 27.11.2012  16:0163 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.




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=63567edit=1


Bug #63567 [Com]: exec() always yields a 1 return code

2012-11-21 Thread circus2 at web dot de
Edit report at https://bugs.php.net/bug.php?id=63567edit=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:

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.


Previous Comments:

[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?


[2012-11-20 16:19:56] s...@php.net

Description:

Running exec() seems to detect a non-zero (and specifically 1) return code/exit 
code for the process. No matter what process. It also affects the proc_open 
class of functions so there is not even a decent workaround as far as we know.

Works on my machine but @johmue on github has the issue consistently. He tried 
with all latest 5.2, 5.3 and 5.4, even 5.5-alpha1. They all do the same. Yet on 
my machine 5.4.8 works fine. At first sight I have exactly the same OS and PHP 
build that he does, so this makes no sense to me. There must be something wrong 
in his environment but we are not able to figure out what causes it.

Note that trying the same thing in the shell directly yields a correct result, 
so the issue seems to be in php, for example this works:

C:\dir
[snip]
C:\echo %errorlevel%
0

You can find the full thread below, but I tried to sum it up above:

https://github.com/composer/composer/issues/613

Test script:
---
C:\php -r exec('dir', $out, $ret);var_dump($ret);


Expected result:

int(0)


Actual result:
--
Die Syntax für den Dateinamen, Verzeichnisnamen oder die 
Datenträgerbezeichnung
ist falsch.
int(1)




Interstingly, it does output the wrong return code, and also prints this 
warning saying that the syntax of the filename/command is wrong.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63567edit=1