yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

queryOne keep loading and no result #20066

Open lucaguelfi opened 1 year ago

lucaguelfi commented 1 year ago

What steps will reproduce the problem?

I installed pdo_informix and edgardmessias/yii2-informix library (ver. 1.1.1) in php 8.2. I execute a queryOne() on a simple query: select * from tablename

What is the expected result?

I expect to have a single row from table

What do you get instead?

I got an infite loop without any result. The browser keep loading forever

Additional info

If I comment the row $this->pdoStatement->closeCursor(); at tline 1195 in vendor/yiisoft/yii2/db/Command.php then everyting works fine.

Q A
Yii version 2.0.49.2
PHP version 8.2
Operating system Debian GNU/Linux 10 (buster) on Docker
xicond commented 1 year ago

if you use edgardmessias/yii2-informix how come it come into yii2 \yii\db\Command::queryInternal It suppose overrided by edgardmessias/yii2-informix I think, Or maybe extension pdo_informix has bug

try check this reference https://www.php.net/manual/en/ref.pdo-informix.php#ref.pdo-informix.features.cursors

PDO_INFORMIX supports scrollable cursors; however, they are not enabled by default. To enable scrollable cursor support, you must either set ENABLESCROLLABLECURSORS=1 in the corresponding ODBC connection settings in odbc.ini or pass the EnableScrollableCursors=1 clause in the DSN connection string.
lucaguelfi commented 1 year ago

The queryInternal of edgardmessias\yii2-informix\src\Command.php starts with this code:

if ($method !== '') {
    return parent::queryInternal($method, $fetchMode);
}

With queryOne() the $fetchMode is "fetch" so it does not override.