summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/drivers/mysql/mysql_forge.php4
-rw-r--r--system/database/drivers/mysql/mysql_utility.php17
-rw-r--r--system/helpers/inflector_helper.php2
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php2
-rw-r--r--user_guide_src/source/changelog.rst1
5 files changed, 14 insertions, 12 deletions
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index d3107134e..0f251b086 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -147,7 +147,7 @@ class CI_DB_mysql_forge extends CI_DB_forge {
$sql .= 'IF NOT EXISTS ';
}
- $sql .= $this->db->_escape_identifiers($table).' ('.$this->_process_fields($fields);
+ $sql .= $this->db->protect_identifiers($table).' ('.$this->_process_fields($fields);
if (count($primary_keys) > 0)
{
@@ -187,7 +187,7 @@ class CI_DB_mysql_forge extends CI_DB_forge {
*/
public function _drop_table($table)
{
- return 'DROP TABLE IF EXISTS '.$this->db->_escape_identifiers($table);
+ return 'DROP TABLE IF EXISTS '.$this->db->protect_identifiers($table);
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 0e7c18e16..9d7cb679c 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -56,7 +56,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
*/
public function _optimize_table($table)
{
- return 'OPTIMIZE TABLE '.$this->db->_escape_identifiers($table);
+ return 'OPTIMIZE TABLE '.$this->db->protect_identifiers($table);
}
// --------------------------------------------------------------------
@@ -71,7 +71,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
*/
public function _repair_table($table)
{
- return 'REPAIR TABLE '.$this->db->_escape_identifiers($table);
+ return 'REPAIR TABLE '.$this->db->protect_identifiers($table);
}
// --------------------------------------------------------------------
@@ -102,7 +102,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
// Get the table schema
- $query = $this->db->query('SHOW CREATE TABLE `'.$this->db->database.'`.`'.$table.'`');
+ $query = $this->db->query('SHOW CREATE TABLE '.$this->db->protect_identifiers($this->db->database).'.'.$this->db->protect_identifiers($table));
// No result means the table name was invalid
if ($query === FALSE)
@@ -115,7 +115,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
if ($add_drop == TRUE)
{
- $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline;
+ $output .= 'DROP TABLE IF EXISTS '.($this->db->protect_identifiers($table).';'.$newline.$newline;
}
$i = 0;
@@ -135,7 +135,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
// Grab all the data from the current table
- $query = $this->db->query('SELECT * FROM '.$table);
+ $query = $this->db->query('SELECT * FROM '.$this->db->protect_identifiers($table));
if ($query->num_rows() == 0)
{
@@ -157,7 +157,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
TRUE);
// Create a string of field names
- $field_str .= '`'.$field->name.'`, ';
+ $field_str .= $this->db->protect_identifiers($field->name).', ';
$i++;
}
@@ -192,14 +192,15 @@ class CI_DB_mysql_utility extends CI_DB_utility {
$val_str = preg_replace('/, $/' , '', $val_str);
// Build the INSERT string
- $output .= 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline;
+ $output .= 'INSERT INTO '.$this->db->protect_identifiers($table).' ('.$field_str.') VALUES ('.$val_str.');'.$newline;
}
- return $output.$newline.$newline;
+ $output .= $newline.$newline;
}
return $output;
}
+
}
/* End of file mysql_utility.php */
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 0bd1e112f..2069a1927 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -85,7 +85,7 @@ if ( ! function_exists('singular'))
'/([^u])s$/' => '\1',
);
- return preg_replace(array_keys($singular_values), $singular_values, $result);
+ return preg_replace(array_keys($singular_rules), $singular_rules, $result);
}
}
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index 4a81b0422..a960730d7 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -99,7 +99,7 @@ class CI_Cache_file extends CI_Driver {
if (write_file($this->_cache_path.$id, serialize($contents)))
{
- @chmod($this->_cache_path.$id, 0777);
+ @chmod($this->_cache_path.$id, 0660);
return TRUE;
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 1e6248f63..f79f0093c 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -106,6 +106,7 @@ Bug fixes for 3.0
- Fixed a hosting edge case where an empty $_SERVER['HTTPS'] variable would evaluate to 'on'
- Fixed a bug (#154) - ``CI_Session::sess_update()`` caused the session to be destroyed on pages where multiple AJAX requests were executed at once.
- Fixed a possible bug in ``CI_Input::is_ajax_request()`` where some clients might not send the X-Requested-With HTTP header value exactly as 'XmlHttpRequest'.
+- Fixed a bug (#1039) - MySQL's _backup() method failed due to a table name not being escaped.
Version 2.1.0
=============