From: Gabriel Wicke Date: Fri, 24 Mar 2006 16:49:19 +0000 (+0000) Subject: Validate html ids properly, prefix if necessary X-Git-Tag: 1.6.0~150 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=a19a4cc5133eac2b2f12aec5642d8c3f84948d54;p=lhc%2Fweb%2Fwiklou.git Validate html ids properly, prefix if necessary --- diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 45f7a49d5d..aa478eb6cb 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -622,6 +622,9 @@ class Sanitizer { ); $id = urlencode( Sanitizer::decodeCharReferences( strtr( $id, ' ', '_' ) ) ); + # *must* start with letters (a-zA-Z), so prefix with something + # informative + $id = preg_replace('/^([0-9])/','iHaveToStartWithALetter-\\1', $id); return str_replace( array_keys( $replace ), array_values( $replace ), $id ); }