* @param string $text HTML to check
* @param bool $stderr Whether to read result from STDERR rather than STDOUT
* @param int &$retval Exit code (-1 on internal error)
- * @return string|null
+ * @return null|string
+ * @throws MWException
*/
private static function clean( $text, $stderr = false, &$retval = null ) {
global $wgTidyInternal;
if ( $wgTidyInternal ) {
if ( wfIsHHVM() ) {
if ( $stderr ) {
- throw new MWException( __METHOD__.": error text return from HHVM tidy is not supported" );
+ throw new MWException( __METHOD__ . ": error text return from HHVM tidy is not supported" );
}
return self::hhvmClean( $text, $retval );
} else {
global $wgTidyConf, $wgDebugTidy;
wfProfileIn( __METHOD__ );
- if ( !class_exists( 'tidy' ) ) {
+ if ( ( !wfIsHHVM() && !class_exists( 'tidy' ) ) ||
+ ( wfIsHHVM() && !function_exists( 'tidy_repair_string' ) )
+ ) {
wfWarn( "Unable to load internal tidy class." );
$retval = -1;