2003-02-25 16:21:00 +00:00
|
|
|
--TEST--
|
2003-10-24 03:31:57 +00:00
|
|
|
Bug #22414 (passthru() does not read data correctly)
|
2003-05-15 19:20:31 +00:00
|
|
|
--INI--
|
2003-07-15 07:06:42 +00:00
|
|
|
safe_mode=
|
2003-05-15 19:20:31 +00:00
|
|
|
output_handler=
|
2003-02-25 16:21:00 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2003-05-18 14:55:18 +00:00
|
|
|
|
|
|
|
$php = getenv('TEST_PHP_EXECUTABLE');
|
|
|
|
$tmpfile = tempnam('/tmp', 'phpt');
|
2008-04-28 12:30:24 +00:00
|
|
|
$args = ' -n -dsafe_mode=off ';
|
2003-02-25 16:21:00 +00:00
|
|
|
|
|
|
|
/* Regular Data Test */
|
2008-04-28 12:30:24 +00:00
|
|
|
passthru($php . $args . ' -r " echo \"HELLO\"; "');
|
2003-02-25 16:21:00 +00:00
|
|
|
|
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
/* Binary Data Test */
|
|
|
|
|
2007-04-18 14:51:29 +00:00
|
|
|
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
2008-04-28 12:30:24 +00:00
|
|
|
$cmd = $php . $args . ' -r \"readfile(@getenv(\'TEST_PHP_EXECUTABLE\')); \"';
|
|
|
|
$cmd = $php . $args . ' -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ;
|
2007-04-18 14:51:29 +00:00
|
|
|
} else {
|
2008-04-28 12:30:24 +00:00
|
|
|
$cmd = $php . $args . ' -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"';
|
|
|
|
$cmd = $php . $args . ' -r " passthru(\''.$cmd.'\');" > '.$tmpfile ;
|
2007-04-18 14:51:29 +00:00
|
|
|
}
|
2003-02-25 16:21:00 +00:00
|
|
|
exec($cmd);
|
2003-07-15 07:06:42 +00:00
|
|
|
|
2003-05-17 20:06:00 +00:00
|
|
|
if (md5_file($php) == md5_file($tmpfile)) {
|
2003-02-25 16:21:00 +00:00
|
|
|
echo "Works\n";
|
|
|
|
} else {
|
|
|
|
echo "Does not work\n";
|
|
|
|
}
|
|
|
|
|
2003-05-17 20:06:00 +00:00
|
|
|
@unlink($tmpfile);
|
2003-02-25 16:21:00 +00:00
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
HELLO
|
|
|
|
Works
|