EllisLab/CodeIgniter — Issue #638: function-args of db_set_charset() are useless
Author: igittigitt
Created: 2011-10-31 16:13:54+00:00
State: open

The function "db_set_charset()" in system/database/DB_driver.php at line 176 can be called with two arguments, which where never bin used inside the function:

function db_set_charset($charset, $collation)
{
if ( ! $this->_db_set_charset($this->char_set, $this->dbcollat))

Because those arguments are forced and not optional, they should be used instead of the default or configured ones. My proposal to this is to use them, if they are specified:

function db_set_charset($charset='', $collation='')
{
if ( ! $charset)
$charset = $this->char_set;
if ( ! $collation)
$collation = $this->dbcollat;

if ( ! $this->_db_set_charset($charset, $collation))