This function is backwards:
* The stated purpose is to generate a list of differences for callers to parse,
however we already have DiffEngine that returns a list of differences that you
don't need to parse manually shooting your feet off in process.
* With improvements in PHP performance in the last 10 years, shelling out instead of using
a pure-PHP diff has a doubtful performance benefit.
* Even in configurations where it's faster on predominant diffs (which have to be huge),
shelling out has its own security implications.
This function is not used in core. The only extensons using it are Echo (which just parses
its output so would be better off with DiffEngine) and AbuseFilter, let's not add more users
by tolerating this function.
Also, add error checking while I'm at it.
Change-Id: Ia67debce39de8252312fd887ebfbe6fb89f9edc9
instead just returns the Status object. Extension calling it should be aware of
this.
* Removed class DBObject. (unused since 1.10)
+* wfDiff() is deprecated.
== Compatibility ==
/**
* Returns unified plain-text diff of two texts.
- * Useful for machine processing of diffs.
+ * "Useful" for machine processing of diffs.
+ *
+ * @deprecated since 1.25, use DiffEngine/UnifiedDiffFormatter directly
*
* @param string $before The text before the changes.
* @param string $after The text after the changes.
$cmd = "$wgDiff " . $params . ' ' . wfEscapeShellArg( $oldtextName, $newtextName );
$h = popen( $cmd, 'r' );
+ if ( !$h ) {
+ unlink( $oldtextName );
+ unlink( $newtextName );
+ throw new Exception( __METHOD__ . '(): popen() failed' );
+ }
$diff = '';