When a commit or rollback was executed (either explicitly or implicitly by the auto-commit logic), all open cursors were closed, which caused any further fetch to fail. The PHP interface fetches in groups of 20 (or the value set by ctsql.rowsperfetch) which are cached by the client. When the 21st record is needed, the driver sends a request to the server, which returns error -20040 (cursor not opened). The driver has been modified so that any fetch for opened queries at the time of the transaction close now returns error -20040 immediately without considering the row already cached.