On Thu, Jul 17, 2008 at 8:19 AM, werdna@svn.wikimedia.org wrote:
$h = popen( $cmd, 'r' );
$diff = '';
do {
$data = fread( $h, 8192 );
if ( strlen( $data ) == 0 ) {
break;
}
$diff .= $data;
} while ( true );
// Clean up
pclose( $h );
. . .
$diff_lines = explode( "\n", $diff );
Couldn't all this be replaced with the following?
$diff_lines = array(); exec( $cmd, $diff_lines );
Simetrical wrote:
On Thu, Jul 17, 2008 at 8:19 AM, werdna@svn.wikimedia.org wrote:
$h = popen( $cmd, 'r' );
$diff = '';
do {
$data = fread( $h, 8192 );
if ( strlen( $data ) == 0 ) {
break;
}
$diff .= $data;
} while ( true );
// Clean up
pclose( $h );
. . .
$diff_lines = explode( "\n", $diff );
Couldn't all this be replaced with the following?
$diff_lines = array(); exec( $cmd, $diff_lines );
No, use wfShellExec(). All of PHP's exec functions are broken on Windows and need some hacky workarounds. Also note that exec() will strip trailing whitespace from each line and thus corrupt the diff.
-- Tim Starling
wikitech-l@lists.wikimedia.org