From: Antoine Musso Date: Sun, 14 Mar 2004 05:28:46 +0000 (+0000) Subject: Fix sourceforge bug 855544 X-Git-Tag: 1.3.0beta1~798 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=73246ffd35aad510f4664f14e0c8abe7633f9d60;p=lhc%2Fweb%2Fwiklou.git Fix sourceforge bug 855544 Disallow the creation of articles with titles wich are bigger than the size of cur_title in the database. Please review this code, it is working but I am not sure if it is safe :) --- diff --git a/includes/Title.php b/includes/Title.php index a3a20da33a..0048fe40c6 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -111,6 +111,17 @@ class Title { $t->mDbkeyform = str_replace( " ", "_", $s ); if( $t->secureAndSplit() ) { + + # check that lenght of title is < cur_title size + $sql = "SHOW COLUMNS FROM cur LIKE \"cur_title\";"; + $cur_title_object = wfFetchObject(wfQuery( $sql, DB_READ )); + + preg_match( "/\((.*)\)/", $cur_title_object->Type, $cur_title_size); + + if (strlen($t->mDbkeyform) > $cur_title_size[1] ) { + return NULL; + } + return $t; } else { return NULL; @@ -630,7 +641,7 @@ class Title { # Initial capital letter if( $this->mInterwiki == "") $t = $wgLang->ucfirst( $r ); - + # Fill fields $this->mDbkeyform = $t; $this->mUrlform = wfUrlencode( $t );