From: Platonides Date: Wed, 28 Jul 2010 13:51:42 +0000 (+0000) Subject: It's very nice having a fallback iconv() function, but we should take into account... X-Git-Tag: 1.31.0-rc.0~35863 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=8bb2b3e3bf67bd789ebf8f667fb779949c0139df;p=lhc%2Fweb%2Fwiklou.git It's very nice having a fallback iconv() function, but we should take into account that Language.php calls it with the //IGNORE making the fallback a nop. This fixes the two phpunit tests of Revision of Legacy encoding when native iconv is not available in php. Allow js_unescape to take advantage of our wrapper, too. (although that function seems completely unused...) --- diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php index 04572b4f01..c8018149a9 100644 --- a/includes/AjaxFunctions.php +++ b/includes/AjaxFunctions.php @@ -49,7 +49,7 @@ function js_unescape( $source, $iconv_to = 'UTF-8' ) { } if ( $iconv_to != "UTF-8" ) { - $decodedStr = iconv( "UTF-8", $iconv_to, $decodedStr ); + $decodedStr = iconv( "utf-8", $iconv_to, $decodedStr ); } return $decodedStr; diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index d0c3a42d17..b61a151d80 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -25,6 +25,7 @@ if( !function_exists('iconv') ) { # Assume will only ever use utf-8 and iso-8859-1. # This will *not* work in all circumstances. function iconv( $from, $to, $string ) { + if ( substr( $to, -8 ) == '//IGNORE' ) $to = substr( $to, 0, strlen( $to ) - 8 ); if(strcasecmp( $from, $to ) == 0) return $string; if(strcasecmp( $from, 'utf-8' ) == 0) return utf8_decode( $string ); if(strcasecmp( $to, 'utf-8' ) == 0) return utf8_encode( $string ); @@ -407,6 +408,7 @@ function wfLogDBError( $text ) { */ function wfErrorLog( $text, $file ) { if ( substr( $file, 0, 4 ) == 'udp:' ) { + # Needs the sockets extension if ( preg_match( '!^(tcp|udp):(?://)?\[([0-9a-fA-F:]+)\]:(\d+)(?:/(.*))?$!', $file, $m ) ) { // IPv6 bracketed host $protocol = $m[1];