I just migrated my dev site to the development branch and I am getting the following error:
Fatal error: Call to a member function num_rows() on a non-object in system/libraries/Session/drivers/Session_cookie.php on line 460
It was working fine with the stable branch. Here is my current DB and Session configs:
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'mysql:host=hostname.com',
'username' => 'MY_USERNAME',
'password' => 'MY_PASSWORD',
'database' => 'MY_DATABASE',
'dbdriver' => 'pdo',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => FALSE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_unicode_ci',
'swap_pre' => '',
'autoinit' => TRUE,
'encrypt' => TRUE,
'compress' => TRUE,
'stricton' => TRUE,
'failover' => array()
$autoload['libraries'] = array('database', 'form_validation');
$autoload['drivers'] = array('session');
$config['encryption_key'] = 'MY_KEY';
$config['sess_driver'] = 'cookie';
$config['sess_valid_drivers'] = array();
$config['sess_cookie_name'] = 'ci_sid';
$config['sess_expiration'] = 21600;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'MY_TABLE';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '.sub.domain.com';
$config['cookie_path'] = '/';
$config['cookie_secure'] = TRUE;
$config['cookie_httponly'] = TRUE;
If you need anymore info just ask. Also on a side note, how do I access the nightly user manual? When I try to go to it from a Google search I get redirected away from it. Thank you in advance.
This can only happen if the query has failed (and therefore $query is set to FALSE instead of a result object on line 450), the above commit should fix the unexpected error. However, you'll need to figure out yourself why the query is failing (possible reasons: session table not structured properly, connection not initialized, Query Builder not enabled, etc.)
On the nightly builds - we're waiting on EllisLab to get them up and running again.
@narfbg the session table has not been altered since moving from 2.1.x, Query builder is enabled as indicated in the above post. I updated CI and ran again the above error no longer appears, but now it's showing this error. Before your fix and even now if I remove the 'mysql:host=' part AND switch to 'mysqli' it does not error, but trying to use PDO it does. I was able to use PDO in 2.1.x without any problems.
Fatal error: Call to a member function query() on a non-object in system/database/drivers/pdo/pdo_driver.php on line 194
Are you able to execute any SQL queries? I suspect that your database connection doesn't work at all ... try both of these:
Moving to DSN worked. Thanks! I would have expected it to tell me connection had failed with CI error instead of an obscure PHP error, but solved now.
Append this to the dsn:
PDO needs a valid DSN. If you have set one - it will use it and will ignore any other setting except the charset (for MySQL that is, other drivers may look for other settings as well). In your case it now ignores the database.
If you don't - it will create one from what you've set (this is for backwards-compatibility). However, what you had put in the 'hostname' field wasn't a valid hostname, so it failed.
So basically - either put everything in the 'dsn' or leave it empty and configure the rest as if you're configuring for e.g. mysqli.