From 2f7bec8f74c922e825f6e4f893607db4106d5f4a Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 30 Dec 2008 20:34:19 +0000 Subject: [PATCH] Fix PHP notice 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index e207f83da7..a315ed4cd3 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -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"; -- 2.20.1