Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Function _protect_identifiers from CI_DB_driver class breaks when active_record is set to FALSE #2284
When active_record is set to false in config.php file and you try to use the update_string function specifying a complete route for the table name (database.table) the _protect_identifiers function causes the following errors:
The UPDATE string is produced without problem but the errors are reported, causing trouble for example in functions that produce XML output.
How to reproduce:
$active_record = FALSE;
$this->load->database(); $where = "id = 1"; $data = array("name" => 'Apple'); $sql = $this->db->update_string("test_ci.Test_Table", $data, $where); echo $sql;
This will cause two PHP errors (the ones mentioned above) however the last line will print the SQL UPDATE statement.
A suggested fix wold be to check if ar_aliased_tables attribute was initialized and if not then initialize it, or initialize it as an empty array when the function starts or the class is constructed.