From: Fomafix Date: Thu, 9 Nov 2017 11:02:18 +0000 (+0100) Subject: thumb.php: Set ENT_NOQUOTES for htmlspecialchars X-Git-Tag: 1.31.0-rc.0~798^2 X-Git-Url: http://git.cyclocoop.org/%27-%20%20.%20url_absolue%28find_in_path%28%27spip_style.css%27%29%29%20%20%20.%20url_absolue%28find_in_path%28%27prive/spip_style.css%27%29%29%20.%20%27?a=commitdiff_plain;h=84bb8c424078af81e5209f0f78d2de84b179b24b;p=lhc%2Fweb%2Fwiklou.git thumb.php: Set ENT_NOQUOTES for htmlspecialchars There is no need to escape double quotes in content of HTML and in HTML comments. ENT_NOQUOTES escapes '<', '>', '&' but not "'" and '"'. https://secure.php.net/manual/en/function.htmlspecialchars.php Change-Id: I7146df9582fc1d9742b9e1b0e4f03d7c7d2ed91f --- diff --git a/thumb.php b/thumb.php index 7c3e757241..02ac0b024d 100644 --- a/thumb.php +++ b/thumb.php @@ -572,7 +572,7 @@ function wfExtractThumbParams( $file, $params ) { * @return void */ function wfThumbErrorText( $status, $msgText ) { - wfThumbError( $status, htmlspecialchars( $msgText ) ); + wfThumbError( $status, htmlspecialchars( $msgText, ENT_NOQUOTES ) ); } /** @@ -602,9 +602,10 @@ function wfThumbError( $status, $msgHtml, $msgText = null, $context = [] ) { if ( $wgShowHostnames ) { header( 'X-MW-Thumbnail-Renderer: ' . wfHostname() ); $url = htmlspecialchars( - isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '' + isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '', + ENT_NOQUOTES ); - $hostname = htmlspecialchars( wfHostname() ); + $hostname = htmlspecialchars( wfHostname(), ENT_NOQUOTES ); $debug = "\n\n"; } else { $debug = '';