CakeDC / cakephp-oracle-driver

CakePHP 3 Driver for Oracle Database
Other
40 stars 25 forks source link

OracleBufferedStatement failure after CakePHP 3.7 #34

Closed ctgraham closed 4 years ago

ctgraham commented 5 years ago

CakePHP 3.7 refactored BufferedStatement to use StatementInterface instead of StatementDecorator: https://github.com/cakephp/cakephp/commit/35dcf38514900b6e4163d5a5ee502ba9f87913e6

This removes the protected variable _statement in favor of statement: https://github.com/cakephp/cakephp/blob/1f6fd21ca27ffc88fa88506a400b94a809e29254/src/Database/Statement/BufferedStatement.php#L43

As a result, recent calls to fetch() will fail with:

Exception: Call to a member function fetch() on null in [vendor/cakedc/cakephp-oracle-driver/src/Database/Statement/OracleBufferedStatement.php, line 36]
2019-03-06 18:24:03 Error: [Error] Call to a member function fetch() on null in vendor/cakedc/cakephp-oracle-driver/src/Database/Statement/OracleBufferedStatement.php on line 36
Stack Trace:
#0 vendor/cakedc/cakephp-oracle-driver/src/Database/Statement/OracleStatement.php(98): CakeDC\OracleDriver\Database\Statement\OracleBufferedStatement->fetch('num')
#1 vendor/cakephp/cakephp/src/Database/Schema/Collection.php(65): CakeDC\OracleDriver\Database\Statement\OracleStatement->fetch()
#2 vendor/cakephp/bake/src/Shell/Task/ModelTask.php(1093): Cake\Database\Schema\Collection->listTables()
#3 vendor/cakephp/bake/src/Shell/Task/ModelTask.php(1046): Bake\Shell\Task\ModelTask->_getAllTables()
#4 vendor/cakephp/bake/src/Shell/Task/ModelTask.php(1061): Bake\Shell\Task\ModelTask->listAll()
#5 vendor/cakephp/bake/src/Shell/BakeShell.php(258): Bake\Shell\Task\ModelTask->listUnskipped()
#6 vendor/cakephp/cakephp/src/Console/Shell.php(518): Bake\Shell\BakeShell->all()
#7 vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(230): Cake\Console\Shell->runCommand(Array, true, Array)
#8 vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(182): Cake\Console\ShellDispatcher->_dispatch(Array)
#9 vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(128): Cake\Console\ShellDispatcher->dispatch(Array)
#10 bin/cake.php(33): Cake\Console\ShellDispatcher::run(Array)
#11 {main}

Code at fault is minimally: https://github.com/CakeDC/cakephp-oracle-driver/blob/eb45c2023f51662d902f6f03d38d8bf32c6fe4e7/src/Database/Statement/OracleBufferedStatement.php#L36 and https://github.com/CakeDC/cakephp-oracle-driver/blob/eb45c2023f51662d902f6f03d38d8bf32c6fe4e7/src/Database/Statement/OracleBufferedStatement.php#L41

jmbIFR commented 5 years ago

Issue #33 resolve cakePHP 3.7 compatibility

Can you test my fork at https://github.com/jmbIFR/cakephp-oracle-driver ?

skie commented 4 years ago

applied in 5.x branch