php/php-src — pull request #950 by tony2001 (2014-12-10 14:24:58+00:00)
Title: add freopen() with tests

it works with plain_wrapper only, though
patch by Evgeniy Makhrov

particularly useful to redirect all the output to a file:

$str = "data\n";
$file = "stdout.log";
freopen($file, "a", STDOUT);
echo $str; //you won't see this line