magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

PHP 8.2/8.3, only one dependency fails the php linter at the moment: league/flysystem

Open hostep opened this issue 1 year ago • 13 comments

Preconditions and environment

  • Magento version 2.4-develop
  • PHP 8.3

Steps to reproduce

  1. Clone magento repo with 2.4-develop branch.
  2. Also setup the dev versions of the inventory, security-package & pagebuilder repo's in the ext/ subdir according to their installation guides.
  3. Run composer update with PHP 8.3 so all packages are at the latest version
  4. Now, with all files in place, let's run all php files through the php linter:
$ find . -type f -iname '*.phtml' -exec php83 -l {} + | grep -v 'No syntax errors detected'
$ find . -type f -iname '*.php' -exec php83 -l {} + | grep -v 'No syntax errors detected'

(note that my PHP 8.3 binary is called php83, replace it in the commands above with the one from your own setup. Also note that I'm making use of {} + syntax which is a new feature of PHP 8.3: It is now possible to lint multiple files, so don't attempt this with lower PHP versions (with lower PHP versions you'd need the {} \; syntax which will run many times slower))

Expected result

No linting errors found

Actual result

2 linting errors found in league/flysystem package:

PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in ./vendor/league/flysystem/src/UnableToCreateDirectory.php on line 19

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in ./vendor/league/flysystem/src/UnableToCreateDirectory.php on line 19
PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in ./vendor/league/flysystem/src/UnableToCheckFileExistence.php on line 14

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in ./vendor/league/flysystem/src/UnableToCheckFileExistence.php on line 14

Additional information

This has been fixed in league/flysystem version 3.0.20 with this commit: https://github.com/thephpleague/flysystem/commit/c327a6ead673031186f38411ce9b72b8672a1596

But Magento still requires version 2 of the 2 league/flysystem packages: https://github.com/magento/magento2/blob/984630670aa9ffb711b3169f1c1a15ea5cc4f052/composer.json#L69-L70 Updating them to version 3 should make the entire codebase of Magento Open Source compatible with PHP 8.2/8.3 (at least for the basic php linting check, there might still be other runtime bugs around, but those are harder to detect)

Maybe some important info can be found in this blog post around flysystem v3...

Release note

No response

Triage and priority

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

hostep avatar Feb 04 '24 14:02 hostep

Hi @hostep. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

m2-assistant[bot] avatar Feb 04 '24 14:02 m2-assistant[bot]

Extra note, to setup those 3 extra packages using composer, you'll need these changes in the composer.json:

diff --git a/composer.json b/composer.json
index 6260fa5192c..47da42c7c98 100644
--- a/composer.json
+++ b/composer.json
@@ -45,13 +45,12 @@
         "guzzlehttp/guzzle": "^7.5",
         "laminas/laminas-captcha": "^2.17",
         "laminas/laminas-code": "^4.13",
-        "laminas/laminas-di": "^3.13",
-        "laminas/laminas-file": "^2.13",
         "laminas/laminas-db": "^2.15",
-        "laminas/laminas-oauth": "^2.6",
+        "laminas/laminas-di": "^3.13",
         "laminas/laminas-escaper": "^2.13",
         "laminas/laminas-eventmanager": "^3.11",
         "laminas/laminas-feed": "^2.22",
+        "laminas/laminas-file": "^2.13",
         "laminas/laminas-filter": "^2.33",
         "laminas/laminas-http": "^2.15",
         "laminas/laminas-i18n": "^2.17",
@@ -59,6 +58,7 @@
         "laminas/laminas-mime": "^2.9",
         "laminas/laminas-modulemanager": "^2.11",
         "laminas/laminas-mvc": "^3.6",
+        "laminas/laminas-oauth": "^2.6",
         "laminas/laminas-permissions-acl": "^2.10",
         "laminas/laminas-server": "^2.16",
         "laminas/laminas-servicemanager": "^3.16",
@@ -70,7 +70,10 @@
         "league/flysystem-aws-s3-v3": "^2.4",
         "magento/composer": "dev-develop",
         "magento/composer-dependency-version-audit-plugin": "^0.1",
+        "magento/inventory-metapackage": "1.2.0-dev",
         "magento/magento-composer-installer": ">=0.4.0",
+        "magento/page-builder": "dev-develop",
+        "magento/security-package": "dev-develop",
         "magento/zend-cache": "^1.16",
         "magento/zend-db": "^1.16",
         "magento/zend-pdf": "^1.16",
@@ -400,5 +403,25 @@
             "Magento\\PhpStan\\": "dev/tests/static/framework/Magento/PhpStan/"
         }
     },
-    "prefer-stable": true
+    "prefer-stable": true,
+    "minimum-stability": "dev",
+    "repositories": {
+        "ext_pb": {
+            "type": "path",
+            "url": "./ext/*/*/*/*/*/*"
+        },
+        "ext_sec": {
+            "type": "path",
+            "url": "./ext/*/*/*"
+        },
+        "ext_inv": {
+            "type": "path",
+            "url": "./ext/*/*/*"
+        },
+        "magento": {
+            "type": "vcs",
+            "url": "https://github.com/magento/inventory-composer-installer.git",
+            "only": ["magento/inventory-composer-installer"]
+        }
+    }
 }

hostep avatar Feb 04 '24 14:02 hostep

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Feb 05 '24 04:02 m2-assistant[bot]

Hello @hostep,

Thank you for the report!

Verified this issue on 2.4-develop. With php version 8.3, while running the linter as mentioned we were able to get the actual result.

image

Hence confirming the issue.

Thank you.

engcom-November avatar Feb 05 '24 11:02 engcom-November

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-10971 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Feb 05 '24 11:02 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Feb 05 '24 11:02 m2-assistant[bot]

Hi @hostep,

Internal team has started working on the issue. We are working on related issue AC-10721 “league/flysystem” Composer dependencies upgrading to latest version as well as a separate request and we are planning to deliver the current AC-10971 issue with this one.

We will update about the progress. Thank you.

engcom-Charlie avatar Feb 12 '24 05:02 engcom-Charlie

Hello,

As I can see this issue got fixed in the scope of the internal Jira ticket AC-10971 by the internal team Related commits: https://github.com/magento/magento2/commit/91cb4d46834b88bb8dc9f5b06279a63d9ad0963c

Based on the Jira ticket, the target version is 2.4.8-beta1.

Thanks

engcom-Bravo avatar Jun 18 '24 12:06 engcom-Bravo

Thanks guys!

hostep avatar Jun 18 '24 17:06 hostep

As we observed performance issue with functional build after merging the changes mentioned in above comment, we have reverted the changes. Will get back with latest update sooner. Till then reopening the issue.

engcom-Charlie avatar Jun 21 '24 05:06 engcom-Charlie

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Jun 24 '24 05:06 m2-assistant[bot]

Since the issue is not yet resolved and has already been confirmed, I am re-adding the confirmed label.

engcom-Hotel avatar Jun 28 '24 05:06 engcom-Hotel

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-10971

github-jira-sync-bot avatar Jun 28 '24 05:06 github-jira-sync-bot