Running PHP 8. I have just upgraded CodeIgniter from 3.0.4 to 3.1.13.
Before the upgrade, the affected_rows() worked fine and gave me the correct quantity.
Now it just gives me a TypeError.
This is a little above my head but I've tried to understand the ODBC driver. I think it's because _execute() returns a boolean, but odbc_num_rows() crashes because it expects a resource.
Any suggestions to fix this?
I compared the old execute() function (system/database/drivers/odbc/odbc_driver.php) with the updated version and found the culprit. $this->is_write_type($sql) OR $success = $this->odbc_result; returns a boolean for all writes to the db.
In the old version they just returned whatever odbc_exec() gave.
To fix this, I just removed the first part of $this->is_write_type($sql) OR $success = $this->odbc_result; and only kept $success = $this->odbc_result;. This may cause problems if some other code expects a boolean and make a strict check for === true.
I hope this made any sense. If someone has a better solution, please tell me.