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

addition of "declare(strict_types=1);" to version 2.7.1 breaks Magento 2 #21

Closed
hostep opened this issue Jun 25, 2021 · 12 comments
Closed
Assignees
Labels
BC Break Bug Something isn't working Duplicate This issue or pull request already exists Invalid This doesn't seem right

Comments

@hostep
Copy link

hostep commented Jun 25, 2021

BC Break Report

Q A
Version 2.7.1

Summary

See magento/magento2#33346 & magento/magento2#33353

Magento sometimes send a bool instead of a string to Escaper::escapeUrl
This worked fine in version 2.7.0, but now no longer in 2.7.1 due to the addition of declare(strict_types=1);

Request is to revert your changes and release 2.7.2 and re-introduce those changes in a new major version: 3.0.0

Does this makes sense?

Thanks! 🙂

Previous behavior

See above

Current behavior

See above

How to reproduce

See above

@damienwebdev
Copy link

While I think we all love strict types (it's definitely nice to see this bubble non-compliant warnings up across the ecosystem), issuing semver non-compliant changes makes dependents' lives harder and should be avoided if possible.

3fbe665#diff-45a996ba81e262b6b47a807220ac2d11c1824463bcfb30d1d25a43af0642a113R3

If a change results in user programs breaking, it's a bug in the kernel. We never EVER blame the user programs.

@Ocramius
Copy link
Member

Ocramius commented Jun 25, 2021 via email

@hostep
Copy link
Author

hostep commented Jun 25, 2021

It's definitely a bug in Magento, I totally agree, but Magento has a super slow release schedule and all Magento version that were released after 28 April 2020 (Magento 2.3.5 and higher) will crash when upgrading laminas/laminas-escaper to 2.7.1

Hence the request to revert the changes and only introduce them in a new major version.

It's the quickest way of fixing Magento shops, besides telling all Magento developers not to upgrade laminas/laminas-escaper to 2.7.1

@Ocramius
Copy link
Member

Ocramius commented Jun 25, 2021 via email

@hostep
Copy link
Author

hostep commented Jun 25, 2021

@weierophinney, @ghostwriter, can we get a second opinion here please? Thanks! 🙂

@Ocramius
Copy link
Member

Ocramius commented Jun 25, 2021 via email

@Ocramius
Copy link
Member

Closing as duplicate of #20 meanwhile.

@Ocramius Ocramius self-assigned this Jun 25, 2021
@Ocramius Ocramius added Bug Something isn't working Invalid This doesn't seem right Duplicate This issue or pull request already exists labels Jun 25, 2021
@weierophinney
Copy link
Member

@hostep I'm with @Ocramius on this one. Pin to an earlier version in your application, or wait for the fix to bubble into the Magento source code. While code calling these methods might have worked previously, that code was still calling it incorrectly. Had we done any actual checking for types manually in the code to ensure the values we received were actually strings, we would have been throwing our exceptions; now we rely on the engine to do this. At some point, this was going to break for callers using invalid values.

@Ocramius
Copy link
Member

Note: adding string type declarations would also be somewhat mitigate this, if the caller-side does not use strict types.

@barryvdh
Copy link

Note: adding string type declarations would also be somewhat mitigate this, if the caller-side does not use strict types.

So would that mitigate the issue? That would cast any int to string in your function, so the integer values from Magento would be converted to a string automatically?

@Ocramius
Copy link
Member

See #23 (comment)

@barryvdh
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC Break Bug Something isn't working Duplicate This issue or pull request already exists Invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

5 participants