Index: t3lib/class.t3lib_db.php =================================================================== --- t3lib/class.t3lib_db.php (Revision 9766) +++ t3lib/class.t3lib_db.php (Arbeitskopie) @@ -1124,12 +1124,39 @@ ); } } + $this->setSqlMode(); } return $this->link; } /** + * Fixes the SQL mode by unsetting NO_BACKSLASH_ESCAPES if found. + * + * @return void + */ + protected function setSqlMode() { + $resource = $this->sql_query('SELECT @@SESSION.sql_mode;'); + if (is_resource($resource)) { + $result = $this->sql_fetch_row($resource); + if (isset($result[0]) && $result[0] && strpos($result[0], 'NO_BACKSLASH_ESCAPES') !== FALSE) { + $modes = array_diff( + t3lib_div::trimExplode(',', $result[0]), + array('NO_BACKSLASH_ESCAPES') + ); + $query = 'SET sql_mode=\'' . mysql_real_escape_string(implode(',', $modes)) . '\';'; + $success = $this->sql_query($query); + + t3lib_div::sysLog( + 'NO_BACKSLASH_ESCAPES could not be removed from SQL mode: ' . $this->sql_error(), + 'Core', + 3 + ); + } + } + } + + /** * Select a MySQL database * mysql_select_db() wrapper function * Usage count/core: 8