Revision: 43472
Author: brion
Date: 2008-11-14 00:46:53 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
Use strict parameter on in_array() checks in wfMsgExt(). In PHP 5.1.6 this was
whinging when a Language object was passed as 'language' parameter, trying to
convert it to an int (!?).
Since we're only checking for exact strings, an exact match is just fine and it
stops the whinging. (Saw no such problem on 5.2.6.)
Example whinge:
Notice: Object of class Language could not be converted to int in
/Library/WebServer/Documents/trunk/includes/GlobalFunctions.php on line 742
Modified Paths:
--------------
trunk/phase3/includes/GlobalFunctions.php
Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php 2008-11-14 00:44:08 UTC (rev
43471)
+++ trunk/phase3/includes/GlobalFunctions.php 2008-11-14 00:46:53 UTC (rev
43472)
@@ -703,7 +703,7 @@
}
}
- if( in_array('content', $options) ) {
+ if( in_array('content', $options, true ) ) {
$forContent = true;
$langCode = true;
} elseif( array_key_exists('language', $options) ) {
@@ -716,19 +716,19 @@
$string = wfMsgGetKey( $key, /*DB*/true, $langCode, /*Transform*/false
);
- if( !in_array('replaceafter', $options) ) {
+ if( !in_array('replaceafter', $options, true ) ) {
$string = wfMsgReplaceArgs( $string, $args );
}
- if( in_array('parse', $options) ) {
+ if( in_array('parse', $options, true ) ) {
$string = $wgOut->parse( $string, true, !$forContent );
- } elseif ( in_array('parseinline', $options) ) {
+ } elseif ( in_array('parseinline', $options, true ) ) {
$string = $wgOut->parse( $string, true, !$forContent );
$m = array();
if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
$string = $m[1];
}
- } elseif ( in_array('parsemag', $options) ) {
+ } elseif ( in_array('parsemag', $options, true ) ) {
global $wgMessageCache;
if ( isset( $wgMessageCache ) ) {
$string = $wgMessageCache->transform( $string,
@@ -737,13 +737,13 @@
}
}
- if ( in_array('escape', $options) ) {
+ if ( in_array('escape', $options, true ) ) {
$string = htmlspecialchars ( $string );
- } elseif ( in_array( 'escapenoentities', $options ) ) {
+ } elseif ( in_array( 'escapenoentities', $options, true ) ) {
$string = Sanitizer::escapeHtmlAllowEntities( $string );
}
- if( in_array('replaceafter', $options) ) {
+ if( in_array('replaceafter', $options, true ) ) {
$string = wfMsgReplaceArgs( $string, $args );
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs