Last modified: 2011-02-06 07:32:15 UTC
When I put a URL like [http://example.com link] in a template, I get PHP error messages: Warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/html/w/includes/GlobalFunctions.php on line 1964 Warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/html/w/includes/GlobalFunctions.php on line 1966 The lines are as follows: 1964 if ( in_array( $bits['scheme'] . '://' , $wgUrlProtocols ) ) { 1965 $delimiter = '://'; 1966 } elseif ( in_array( $bits['scheme'] .':' , $wgUrlProtocols ) ) { I believe the issue is that $wgUrlProtocols is a string, containing a regex, and not an array, which in_array() requires. I checked svn, though I had a hard time navagating trunk, and assumed phase3 is the correct folder to check? If so, this is still the case in svn.
The bug was introduced in r20561. Raymond has offerred to fix this, along with some other problems he introduced with that commit. $wgUrlProtocols can be processed with code such as: if ( is_array( $wgUrlProtocols ) ) { // 1.6+ format $protocols = $wgUrlProtocols; } else { // pre-1.6 format $protocols = explode( '|', $wgUrlProtocols ); foreach ( $protocols as $key => $protocol ) { $protocols[$key] = str_replace( '\/', '/', $key ); } } The result should be saved to a static variable or similar, for efficiency.
Note that you can work around the problem by changing $wgUrlProtocols in your LocalSettings.php to use the new format, e.g.: $wgUrlProtocols = array( 'http://', 'https://', 'ftp://', 'irc://', 'gopher://', 'telnet://', 'nntp://', 'worldwind://', 'mailto:', 'news:' );
It seems that this issue has been fixed.