#50503 [Com]: proc_open loses constants with $env
| From: | tidustracker at freenet dot de | Date: | Thu, 17 Dec 2009 01:22:23 +0000 |
| Subject: | #50503 [Com]: proc_open loses constants with $env | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-145832@lists.php.net to get a copy of this message | ||
ID: 50503
Comment by: tidustracker at freenet dot de
Reported By: tidustracker at freenet dot de
Status: Feedback
Bug Type: Program Execution
Operating System: Windows Vista
PHP Version: 5.3.1
New Comment:
The script is working very well? Adjust the two paths and run it in
CLI. The ENVs are not the problem, the ENVs cause the problem.
The php example code starts via proc_open a new php process.
With an passed $env array to proc_open, the two constants SOL_TCP and
SOL_UDP described at http://php.net/manual/en/sockets.constants.php
are
missing in the new php process.
Previous Comments:
------------------------------------------------------------------------
[2009-12-17 01:01:51] pajoye@php.net
Please provide a valid/working script.
The easiest way to verify that all ENVs are correctly defined is to
simply echo them out (echo %ENVNAME%).
------------------------------------------------------------------------
[2009-12-17 00:40:37] tidustracker at freenet dot de
Description:
------------
It seems that passing an array(filled or empty) to proc_open drops the
two constants SOL_TCP and SOL_UDP in created process
Reproduce code:
---------------
$arrConstants = get_defined_constants(true);
print('Constants: '. count($arrConstants['sockets']) . PHP_EOL);
print_r($arrConstants['sockets']);
ob_start(); ?>
$arrConstants = get_defined_constants(true);
file_put_contents('D:/proc_open_bug.txt', 'Constants: '.
count($arrConstants['sockets']) . PHP_EOL .
print_r($arrConstants['sockets'], true));
<?php
$strCode = ob_get_contents();
ob_end_clean();
$arrDescriptor = array(0 => array('pipe', 'r'), 1 =>
array('pipe',
'w'), 2 => array('pipe', 'w'));
$arrOptions = array('suppress_errors' => false, 'bypass_shell' =>
true);
$arrPipes = array();
$strCWD = null;
$arrEnv = array('process' => true); // Constants SOL_TCP and SOL_UDP
are NOT available in opened process
#$arrEnv = null; // All fine with constants SOL_TCP and SOL_UDP
proc_open('php_53 -r "'. $strCode. '"', $arrDescriptor, $arrPipes,
$strCWD, $arrEnv, $arrOptions);
Expected result:
----------------
passing an array to proc_open expects 86 constants including SOL_TCP
and SOL_UDP in the new process
Actual result:
--------------
only 84 constants
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50503&edit=1