Current version of Yii 2 not ready for PHP 8.2?

Codeception is too old?

Trying to execute (as told in the guide):

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

Ends with:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires codeception/module-filesystem ^2.0 || ^1.1 -> satisfiable by codeception/module-filesystem[2.0.0, 2.0.1, 2.0.2].
    - Conclusion: don't install codeception/codeception 5.0.5 (conflict analysis result)
    - Conclusion: don't install codeception/codeception 5.0.6 (conflict analysis result)
    - Conclusion: don't install codeception/codeception 5.0.7 (conflict analysis result)
    - codeception/module-yii2 1.1.8 requires codeception/codeception ^5.0.8 -> satisfiable by codeception/codeception[5.0.8, 5.0.9, 5.0.10].
    - Conclusion: don't install codeception/codeception 5.0.8 (conflict analysis result)
    - Conclusion: don't install codeception/codeception 5.0.10 (conflict analysis result)
    - codeception/module-yii2[1.1.0, ..., 1.1.1] require php >=5.6.0 <8.0 -> your php version (8.2.0) does not satisfy that requirement.
    - codeception/module-yii2[1.1.2, ..., 1.1.3] require php >=5.6.0 <8.1 -> your php version (8.2.0) does not satisfy that requirement.
    - codeception/module-yii2 1.1.4 requires php >=5.6.0 <=8.1 -> your php version (8.2.0) does not satisfy that requirement.
    - codeception/module-yii2 1.1.5 requires php >=5.6.0 <=8.1 | ~8.1.0 -> your php version (8.2.0) does not satisfy that requirement.
    - codeception/module-yii2 1.1.6 requires codeception/codeception ^5.0.0 -> satisfiable by codeception/codeception[5.0.0, ..., 5.0.10].
    - codeception/module-yii2 1.1.7 requires codeception/codeception ^5.0.0-RC6 -> satisfiable by codeception/codeception[5.0.0, ..., 5.0.10].
    - Conclusion: don't install codeception/codeception 5.0.0 (conflict analysis result)
    - Root composer.json requires codeception/module-yii2 ^1.1 -> satisfiable by codeception/module-yii2[1.1.0, ..., 1.1.8].

The same goes when trying to create a new project based on yii-advanced.

What should I do in this case?

Correct. PHP 8.2 support by samdark · Pull Request #19749 · yiisoft/yii2 · GitHub

Thank you!

January 24. Until this is pulled in we must use 8.1.x right?

Yes. You can test the branch and help fixing/validating issues. That is now kinda stuck because I’m busy.

1 Like

You can use if you don’t mind composer ignoring the php version:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic --ignore-platform-req=php update

Sorry, there’s an error in the above composer command. It should be two separate commands:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

When you get the error run this command (works with both the Basic and Advanced templates):

composer --ignore-platform-req=php update

Thank you for your idea!

A small suggestion. You are running first command context-less (i.e. in root / htdocs etc. directory) while you must run second command context-full (in project’s folder). So actually you must run three commands in a sequence:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic
cd basic
composer update --ignore-platform-req=php

Now, works like a charm! :slight_smile:

Then when you do things like date validations it will start running wild!

Any particular area you want the most help? This will be a blocker for us in the near future when 8.1 moves to support-only mode at the end of this year, so we can certainly spend some development time on contributing fixes for those issues if we have a clear picture of the process. Where’s your biggest pain point that you want to have taken care of?

1 Like

Hi Dana. Glad to see you are still part of Yii community. I still remember your useful blogs posts.
Hope to see them again on Yii3.

1 Like

Thanks Stefano =) There will definitely be more posts when I start moving things to Yii 3. The release of the database package this past weekend was a huge step forward and I can’t wait to be able to start truly using it. It was too soon the last time I dug into it and a lot has changed since then.

1 Like

It is just time. With Yii3 going, I’m not able to focus on Yii2 every day personally. As for 8.2 support, try running tests. There are issues visible. When tests pass, we’ll see if there are any additional things to fix.

2 Likes

Trying to help run the tests and such, but I run into issues trying to run the mssql tests due to licensing and pull restrictions on those images.
For example:

Error response from daemon: pull access denied for microsoft/mssql-server-linux, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied.

All the other tests in the test-local.sh are passing or skipped, and I’m unsure whether the skipped ones are deliberate (Zend Data Cache not installed, XCache not installed, Wincache not installed, etc.) or if there’s a different base php image I should use for testing instead of the configured one for 8.2?

I’d really like to help but I feel like I’m spending ridiculous amounts of time just trying to figure out where the concerns are. Am I just missing something completely obvious?

1 Like

Like I said above, many of us would like to test things but the expense of setting up things and do actual test is quiet high. If one of core dev would step in make it easy for testing and giving feedback, I for one would have done that long ago

I’ve prepared a release.

2 Likes

Am downloading it right now to test with our fairly big app.

1 Like

So far It is working fine and error including date validation crashes are gone.
I will keep testing for any regression

1 Like

Good to hear that. Thanks.

Just found that there is a problem with db sessions. I cannot login with db sessions enabled.
Disable Db Sessions all works fine.

tried to clean the table and even cookies but didn’t help!

I will try to check what is wrong tomorrow. Here is the trace

Integrity constraint violation – yii\db\IntegrityException
SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "yii2_sessions_pkey"
DETAIL: Key (id)=(u3fheu04tbsrrrpu022md59tpt ) already exists.
The SQL being executed was: INSERT INTO "yii2_sessions" ("data", "id", "expire") VALUES ('__flash|a:0:{}', 'u3fheu04tbsrrrpu022md59tpt', 1685053029)
Error Info: Array
(
    [0] => 23505
    [1] => 7
    [2] => ERROR:  duplicate key value violates unique constraint "yii2_sessions_pkey"
DETAIL:  Key (id)=(u3fheu04tbsrrrpu022md59tpt              ) already exists.
)
↵
Caused by: PDOException
SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "yii2_sessions_pkey"
DETAIL: Key (id)=(u3fheu04tbsrrrpu022md59tpt ) already exists.

Checked and it seems that in DBSession class there is call to $this->db->createCommand()->upsert($this->sessionTable, $this->fields)->execute(); which in Postgres calls INSERT instead of of updating it. and since there is already in the db the error arises!