summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2009-02-11 19:55:24 +0100
committerDerek Jones <derek.jones@ellislab.com>2009-02-11 19:55:24 +0100
commita377bdd47e57ddde51e90641d961f00af4a71fa1 (patch)
tree1fa2eb7fc01ff8513c0874c5fc84b0f9af322fe3
parent733310d86671ada1be601692bdd5bbd55dae5e7a (diff)
switched from gettype() to is_* for testing type in escape()
-rw-r--r--system/database/DB_driver.php21
-rw-r--r--user_guide/changelog.html5
2 files changed, 17 insertions, 9 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 42b6a7577..9385870e9 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -673,16 +673,19 @@ class CI_DB_driver {
* @return integer
*/
function escape($str)
- {
- switch (gettype($str))
+ {
+ if (is_string($str))
{
- case 'string' : $str = "'".$this->escape_str($str)."'";
- break;
- case 'boolean' : $str = ($str === FALSE) ? 0 : 1;
- break;
- default : $str = ($str === NULL) ? 'NULL' : $str;
- break;
- }
+ $str = "'".$this->escape_str($str)."'";
+ }
+ elseif (is_bool($str))
+ {
+ $str = ($str === FALSE) ? 0 : 1;
+ }
+ elseif (is_null($str))
+ {
+ $str = 'NULL';
+ }
return $str;
}
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 1f3b4c9f1..f5a6fbe70 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -62,6 +62,11 @@ Change Log
SVN Revision: </p>
<ul>
+ <li>Database
+ <ul>
+ <li>Switched from using gettype() in escape() to is_* methods, since future PHP versions might change its output.</li>
+ </ul>
+ </li>
</ul>
<h3>Bug fixes for 1.7.2</h3>