php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69847 exec() : output parameter empty since 5.6.3
Submitted: 2015-06-16 07:53 UTC Modified: 2021-10-15 08:45 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: marcaurel at gmx dot de Assigned: cmb (profile)
Status: Wont fix Package: Program Execution
PHP Version: 5.6.10 OS: Windows Server 2008 R2 SP1
Private report: No CVE-ID: None
 [2015-06-16 07:53 UTC] marcaurel at gmx dot de
Description:
------------
I'm using PHP on Windows Server 2008 R2 SP1 / IIS7.5

I execute a PowerShell script via exec().
This PowerShell script produces output which
is normally found in the output parameter
of the exec() command.

Since PHP 5.6.3 the output parameter of the exec()
commmand is empty after the script has run.

I've tested all versions from 5.6.1 to 5.6.10
The script is executed flawlessly with all versions
but only 5.6.1 and 5.6.2 have the script's output in
the exec() output parameter.  All later versions fail
to pass on the script output.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-19 11:13 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2015-06-19 11:13 UTC] ab@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2015-06-24 13:57 UTC] marcaurel at gmx dot de
unfortunately this bug is very hard to reproduce.
As yet I couldn't write a simplified version of 
the scripts, which didn't show the same problem.
I'll continue trying... and else I will add the
normal scripts (which are a bit lengthy) here.
 [2015-06-28 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2015-09-04 12:19 UTC] prenaudet at asso-synergie dot fr
I have the same but

I have reproduce this bug

<?php
$output = '';
exec('echo a && echo. && echo b && (timeout 1 >nul) && echo c', $output);
echo count($output);
?>

With this code we have in output "3"
The $output is
array (size=3)
  0 => string 'a' (length=1)
  1 => string '' (length=0)
  2 => string 'b' (length=1)

but the $output must be
array (size=4)
  0 => string 'a' (length=1)
  1 => string '' (length=0)
  2 => string 'b' (length=1)
  4 => string 'c' (length=1)

Bug is present on 
PHP 5.6.11
On Windows 2008R2, 2012, 2012R2 With respectively IIS 7.5, 8 and 8.5

Foreach launch the command in Shell produce :
a

b
c 


When we laucnh command by PHP directly (no IIS) this bug is not present
This bug is not present on PHP5.5.4 (when launched by IIS) (previously version on servers)

The programme is not interupted, just output was truncated
 [2015-09-04 12:32 UTC] requinix@php.net
-Status: No Feedback +Status: Re-Opened
 [2021-09-30 13:36 UTC] cmb@php.net
-Status: Re-Opened +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-10-12 15:26 UTC] cmb@php.net
-Status: Verified +Status: Analyzed
 [2021-10-12 15:26 UTC] cmb@php.net
This not not specific to IIS (FCGI); I can reproduce with
apache2handler as well.

This issue has likely been introduced by fixing bug #51800.
However, when I revert the respective commit, I still don't get
the expected results; other relevant changes may have happened in
the meantime.

Anyhow, when PHP peeks the pipe, Windows reports
ERROR_BROKEN_PIPE; presumably, the timeout command requires a
console, but for these SAPIs, there is no console, so the
execution of the command is stopped.
 [2021-10-15 08:45 UTC] cmb@php.net
-Status: Analyzed +Status: Wont fix
 [2021-10-15 08:45 UTC] cmb@php.net
I don't see a valid use case for calling a batch script which
calls timeout, so I'm closing as WONTFIX.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC