Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Magento 2.4.4 Compilation issues on PHP 8.1 #40

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

SamJUK
Copy link
Contributor

@SamJUK SamJUK commented Nov 7, 2024

This PR resolves the compilation issues when running 2.4.4 on PHP 8.1.

PHP 8.1 is the only supported version for Magento 2.4.4.

magento/magento2#35292 (comment)

image

$is244 = substr($version, 0, 5) == '2.4.4';
$patchLevel = (int)substr($version, 7);

if (!$is244 || $patchLevel > 100) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really following this $patchLevel comparison. You are trying to cast a string like "2.4.4-p11" to an int. In my tests the $patchLevel is always 1. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, meant to take out the patch level. Since it applies to all versions of the 2.4.4 package.
I'll remove it after the current pipeline finishes running.

But as for the check, we are stripping out everything up to and including the p character.
So we either end with the numerical value or a empty string (which casts to 0) in the case of no patch.

Sandbox demonstrating it:
https://onlinephp.io?s=bYxBC4IwGIbPDfYfPoYHByZoQaBFhwg6BAlBlwhZutSD29iml-i_lwYm1e2B93mf5VqVCiOMnJoVXFh54tpUUhhYwZmE_tyfEw_eMFXBiMMRz8ZOQC4xRjepOctK96fLDDgt1xTuGE14VkogiZYZN6YSRdRvr1qyS9LtYR8PzrG5GqsjIOCD6dntVA8W9I-9YcbyvLNjaJlO86ZWrlsJS7--dPh8Go8n&v=8.2.20

@michielgerritsen
Copy link
Owner

Hey, thanks for this PR. It's really appreciated! However, the build seems to fail on this error:

Interface "Magento\Framework\ObjectManager\ResetAfterRequestInterface" not found

Does that ring a bell?

@SamJUK
Copy link
Contributor Author

SamJUK commented Nov 8, 2024

From what I can tell It seems like 2.4.4 is uninstallable currently 👀. Due to loose constraints within the security & inventory meta packages pulling 2.4.6 code...

Couldn't find much on it, although this issue seems like they had a similar thing magento/magento2#38594

I've pushed a potential fix for it by pinning those meta packages to the versions distributed in 2.4.4-p1. Not sure if this or just not building the 2.4.4 package is the better approach.

Waiting for the CI tests to run on the fork, and will check back in afterwards.
https://github.com/SamJUK/magento2-extension-integration-test/actions/runs/11741298390

@SamJUK
Copy link
Contributor Author

SamJUK commented Nov 8, 2024

All the 2.4 builds within the Fork CI are passing now.
https://github.com/SamJUK/magento2-extension-integration-test/actions/runs/11741298390

@michielgerritsen michielgerritsen merged commit eb6b44a into michielgerritsen:master Nov 13, 2024
@michielgerritsen
Copy link
Owner

Thanks @SamJUK

@SamJUK
Copy link
Contributor Author

SamJUK commented Nov 13, 2024

No Problem, thanks for the repo! Reduces the barrier to entry for automating testing a bunch

@SamJUK SamJUK deleted the fix/php81-m244 branch November 13, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants