1--TEST-- 2Bug #60602 proc_open() modifies environment if it contains arrays 3--FILE-- 4<?php 5 6$descs = array( 7 0 => array('pipe', 'r'), // stdin 8 1 => array('pipe', 'w'), // stdout 9 2 => array('pipe', 'w'), // strerr 10); 11 12$environment = array('test' => array(1, 2, 3)); 13 14$cmd = (substr(PHP_OS, 0, 3) == 'WIN') ? 'dir' : 'ls'; 15$p = proc_open($cmd, $descs, $pipes, '.', $environment); 16 17if (is_resource($p)) { 18 $data = ''; 19 20 while (1) { 21 $w = $e = NULL; 22 $n = stream_select($pipes, $w, $e, 300); 23 24 if ($n === false) { 25 echo "no streams \n"; 26 break; 27 } else if ($n === 0) { 28 echo "process timed out\n"; 29 proc_terminate($p, 9); 30 break; 31 } else if ($n > 0) { 32 $line = fread($pipes[1], 8192); 33 if (strlen($line) == 0) { 34 /* EOF */ 35 break; 36 } 37 $data .= $line; 38 } 39 } 40 var_dump(strlen($data)); 41 42 $ret = proc_close($p); 43 var_dump($ret); 44 var_dump(is_array($environment['test'])); 45} else { 46 echo "no process\n"; 47} 48?> 49==DONE== 50--EXPECTF-- 51Notice: Array to string conversion in %s on line %d 52int(%d) 53int(0) 54bool(true) 55==DONE== 56