From 285ffad3c131f658d82308c7116df6dc0ea4e5bf Mon Sep 17 00:00:00 2001 From: David M Date: Mon, 7 Aug 2006 18:43:30 +0000 Subject: [PATCH] This is kinda nice.. Before MySQL 5.0.3, traling spaces were removed when values were stored. This means that some BBCodes might not have worked. A bad thing. So, I cleverly stick a \0 at the end if this is the case. The \0 does not really modify the bitfield at all, it simply represents that there are no BBCodes in that range of eight. Idealy, we should do a version check to see if this is needed but this is just a nice fix for now... git-svn-id: file:///svn/phpbb/trunk@6252 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/mysql.php | 10 ++++++++++ phpBB/includes/db/mysql4.php | 10 ++++++++++ phpBB/includes/db/mysqli.php | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 7e363721a9..ee7918473d 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -328,6 +328,16 @@ class dbal_mysql extends dbal return @mysql_real_escape_string($msg, $this->db_connect_id); } + function sql_escape_binary($msg) + { + // If the last char is + if (substr($msg, -1) == ' ') + { + $msg .= "\0"; + } + return "'" . $this->sql_escape($msg) . "'"; + } + /** * Build db-specific query data * @access: private diff --git a/phpBB/includes/db/mysql4.php b/phpBB/includes/db/mysql4.php index 071f4c4b55..c63d5fb064 100644 --- a/phpBB/includes/db/mysql4.php +++ b/phpBB/includes/db/mysql4.php @@ -331,6 +331,16 @@ class dbal_mysql4 extends dbal return @mysql_real_escape_string($msg, $this->db_connect_id); } + function sql_escape_binary($msg) + { + // If the last char is + if (substr($msg, -1) == ' ') + { + $msg .= "\0"; + } + return "'" . $this->sql_escape($msg) . "'"; + } + /** * Build db-specific query data * @access: private diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index fa4d3ffdc7..46ddd55569 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -311,6 +311,16 @@ class dbal_mysqli extends dbal return @mysqli_real_escape_string($this->db_connect_id, $msg); } + function sql_escape_binary($msg) + { + // If the last char is + if (substr($msg, -1) == ' ') + { + $msg .= "\0"; + } + return "'" . $this->sql_escape($msg) . "'"; + } + /** * Build db-specific query data * @access: private