From 73246ffd35aad510f4664f14e0c8abe7633f9d60 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 14 Mar 2004 05:28:46 +0000 Subject: [PATCH] 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 :) --- includes/Title.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 ); -- 2.20.1