summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2009-07-11 05:38:13 +0200
committerDerek Jones <derek.jones@ellislab.com>2009-07-11 05:38:13 +0200
commit55acc8b4d980c43e4bde04f0e0b99a594dea28ff (patch)
treed8e2ce7d77cfe1dfb803a33a87eb08d004f49e80
parent8c5299640fed112bb86e7a3930432bd084e86dad (diff)
fixed a bug with _protect_identifiers() and db/swap prefixes. It was appending the prefix, but not accounting for the need to swap
-rw-r--r--system/database/DB_driver.php14
-rw-r--r--user_guide/changelog.html1
2 files changed, 14 insertions, 1 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 54aa5ed7a..014dfd44e 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1309,7 +1309,13 @@ class CI_DB_driver {
{
$i++;
}
-
+
+ // Verify table prefix and replace if necessary
+ if ($this->swap_pre != '' && strncmp($parts[$i], $this->swap_pre, strlen($this->swap_pre)) === 0)
+ {
+ $parts[$i] = preg_replace("/^".$this->swap_pre."(\S+?)/", $this->dbprefix."\\1", $parts[$i]);
+ }
+
// We only add the table prefix if it does not already exist
if (substr($parts[$i], 0, strlen($this->dbprefix)) != $this->dbprefix)
{
@@ -1331,6 +1337,12 @@ class CI_DB_driver {
// Is there a table prefix? If not, no need to insert it
if ($this->dbprefix != '')
{
+ // Verify table prefix and replace if necessary
+ if ($this->swap_pre != '' && strncmp($item, $this->swap_pre, strlen($this->swap_pre)) === 0)
+ {
+ $item = preg_replace("/^".$this->swap_pre."(\S+?)/", $this->dbprefix."\\1", $item);
+ }
+
// Do we prefix an item with no segments?
if ($prefix_single == TRUE AND substr($item, 0, strlen($this->dbprefix)) != $this->dbprefix)
{
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index b3ac1671a..323467b6e 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -101,6 +101,7 @@ SVN Revision: </p>
<li>Fixed a bug in the XML-RPC class with parsing dateTime.iso8601 data types.</li>
<li>Fixed a case sensitive string replacement in xss_clean()</li>
<li>Fixed a bug in form_prep() causing it to not preserve entities in the user's original input when called back into a form element</li>
+ <li>Fixed a bug in _protect_identifiers() where the swap prefix ($swap_pre) was not being observed.</li>
</ul>
<h2>Version 1.7.1</h2>