Fix PHP notice
authorAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 30 Dec 2008 20:34:19 +0000 (20:34 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 30 Dec 2008 20:34:19 +0000 (20:34 +0000)
It would seem like something is passing empty strings to
Sanitizer::escapeId().  A more explicit check for this might be useful,
but this should avoid the notice.

includes/Sanitizer.php

index e207f83..a315ed4 100644 (file)
@@ -802,7 +802,7 @@ class Sanitizer {
                        $id = urlencode( Sanitizer::decodeCharReferences( strtr( $id, ' ', '_' ) ) );
                        $id = str_replace( array_keys( $replace ), array_values( $replace ), $id );
 
-                       if ( preg_match( '/[^a-zA-Z]/', $id[0] )
+                       if ( !preg_match( '/^[a-zA-Z]/', $id )
                        && !in_array( 'noninitial', $options ) )  {
                                // Initial character must be a letter!
                                $id = "x$id";