-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI 2.2.0 - pdo: rowCount non-object error because $this->result_id is not an object #3095
Comments
I have traced and found out what caused the problem. I have compared 2.2.0 pdo_driver.php vs 2.1.4 pdo_driver.php the _execute() function of 2.2.0 is:
while the 2.1.4 _execute function is like this:
I'm not sure why 2.2.0 this function returns $result instead of $result_id, http://www.php.net//manual/en/pdostatement.execute.php this is why $this->result_id is set to 1 (true) and not the object. |
Please don't use PDO ... its driver is badly written and every time somebody wants to fix a bug, another one pops up. You don't get any benefit from using PDO anyway. |
narfbg, do you mean that your bug fix above introduces more bugs? And how should we should stop using PDO when there is no non-PDO driver to sqlite3 yet. Although, I've found one of shady origins which does work: Beware, there is some javascript at the end of the page. Should these be added to CodeIgniter? |
No, but it is possible. This bug is the result of a "bug fix".
Upgrade to 3.0-dev, it has a "native" sqlite3 driver and a sane PDO driver.
No, and I'm removing the links from your post, exactly because of the "shady origin" and because the docblocks inside claim that it's written by the ExpressionEngine Dev team, which is not true. |
in function _execute() of 2.2.0 lost reexecution if (is_numeric(stripos($sql, 'SELECT')))
{
$this->affect_rows = count($result_id->fetchAll());
$result_id->execute();
} |
After upgrading from 2.1.4 to 2.2.0 I have got an error:
Fatal error: Call to a member function rowCount() on a non-object in /var/www/system/database/drivers/pdo/pdo_result.php on line 47
Call Stack:
0.0001 130536 1. {main}() /var/www/index.php:0
0.0005 131856 2. require_once('/var/www/system/core/CodeIgniter.php') /var/www/index.php:217
0.0206 330348 3. CI_Controller->__construct() /var/www/application/controllers/login.php:9
0.0212 341972 4. CI_Loader->initialize() /var/www/system/core/Controller.php:51
0.0212 342252 5. CI_Loader->_ci_autoloader() /var/www/system/core/Loader.php:152
0.0279 645464 6. CI_Loader->library() /var/www/system/core/Loader.php:1178
0.0279 645564 7. CI_Loader->_ci_load_class() /var/www/system/core/Loader.php:216
0.0282 653940 8. CI_Loader->_ci_init_class() /var/www/system/core/Loader.php:975
0.0284 654496 9. CI_Session->__construct() /var/www/system/core/Loader.php:1099
0.0299 661100 10. CI_Session->sess_read() /var/www/system/libraries/Session.php:106
0.0326 664700 11. CI_DB_active_record->get() /var/www/system/libraries/Session.php:229
0.0327 665972 12. CI_DB_driver->query() /var/www/system/database/DB_active_rec.php:963
0.0338 681564 13. CI_DB_pdo_result->num_rows() /var/www/system/database/DB_driver.php:386
When I tried to trace $this->result_id in function num_rows (in pdo_result.php), $this->result_id is set to 1 and it's not an object (is_object($this->result_id) returns false)
The text was updated successfully, but these errors were encountered: