php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61741 exec command running a powershell script cause pwershell's crash
Submitted: 2012-04-16 05:55 UTC Modified: -
Votes:6
Avg. Score:4.7 ± 0.7
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: pierre-eric dot mathez at ceff dot ch Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 5.3.10 OS: Windows 2008 R2, IIS7
Private report: No CVE-ID: None
 [2012-04-16 05:55 UTC] pierre-eric dot mathez at ceff dot ch
Description:
------------
I've got a PHP script which execute a powershell script. I used PHP version 5.2.x and it is running on IIS 7, Windows server 2008R2. The php package is installed by the web platform installer.

Everything worked fine until I migrate my server to PHP 5.3.10. With this new version, the same command cause a powershell crash. Other person on a french forum has confirm my issue. I think it's a php bug because the operation run well on php 5.2 and not in 5.3.10.
The php script is quite simple, see test script

Test script:
---------------
$command = 'powershell -ExecutionPolicy Unrestricted -command "$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @(\'administrator\',(ConvertTo-SecureString -String \'MyPassword\' -AsPlainText -Force));Invoke-Command -credential $cred -computername 127.0.0.1 -scriptblock {& c:\temp\launch.ps1}" <NUL';

print($command);

print("<br/><hr><br/>");

exec($command, $out);

print_r($out);


Expected result:
----------------
the script execute successful (which is the case on php 5.2.17)

Actual result:
--------------
powershell return an error on Invoke-Command. I should clarify on thing: other scripts with other commands are running well, it's the invoke-command that is not possible to run with this version of php.

Patches

Pull Requests

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 10:01:28 2024 UTC