Current version of Yii 2 not ready for PHP 8.2?

Interesting. Would you please create an issue for it? Was it alright with previous release?

Yes, I will create an issue for sure. It was working for the last Yii version and started when I switched to dev-master to test for PHP8.2

After debugging it, I found that in file vendor/yiisoft/yii2/db/QueryBuilder.php line 580

$primaryKey = $schema->getTablePrimaryKey($name);

returns null. However, If I append schema name like

$primaryKey = $schema->getTablePrimaryKey('public.'.$name);

it works. So it seems like something changed in the DB and now it is no longer recognizing default postgres schema which is public

Having realized that, I went back to my session component configs and added schema name like below and it worked fine

'components' => [
        'session' => [
            'class' => 'yii\web\DbSession',
            'sessionTable' => 'public.yii2_sessions',

After spending some times checking, I found that I had changed default schema in db while testing something and obviously forgot to revert that hence the issue.

TL:DR; It is not Yii bug but rather home grown bug :wink:

1 Like