[5135] trunk/htdocs/system/classes/multibyte.php: Do not call the mbstring mb_check_encoding() method to validate data if we 're not using the mbstring library.

5 views
Skip to first unread message

s...@habariproject.org

unread,
Jun 8, 2011, 3:47:53 PM6/8/11
to habar...@googlegroups.com
Revision
5135
Author
chrismeller
Date
2011-06-08 19:47:39 +0000 (Wed, 08 Jun 2011)

Log Message

Do not call the mbstring mb_check_encoding() method to validate data if we're not using the mbstring library.

Modified Paths

Diff

Modified: trunk/htdocs/system/classes/multibyte.php (5134 => 5135)


--- trunk/htdocs/system/classes/multibyte.php	2011-06-05 00:00:32 UTC (rev 5134)
+++ trunk/htdocs/system/classes/multibyte.php	2011-06-08 19:47:39 UTC (rev 5135)
@@ -407,9 +407,18 @@
 	 * @param string $str the string to check
 	 * @return bool
 	 */
-	public static function valid_data( $str )
+	public static function valid_data( $str, $use_enc = null )
 	{
-		return mb_check_encoding( $str, self::$hab_enc );
+		$enc = self::$hab_enc;
+		if ( $use_enc !== null ) {
+			$enc = $use_enc;
+		}
+		
+		if ( self::$use_library == self::USE_MBSTRING ) {
+			return mb_check_encoding( $str, $enc );
+		}
+		
+		return true;
 	}
 	
 	/**
Reply all
Reply to author
Forward
0 new messages