-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Remove typecasting to prevent fatal when $screen_id is null. #34734
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
Conversation
dbd07f5 to
51668db
Compare
Test Results SummaryCommit SHA: 81c91fb
To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
|
Hi @Konamiman, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:
|
|
I don't think this is related to just PHP 8.1. This issue occurred for me when running PHP 7.4 too but looking at the error more closely it was caused because I didn't specify a screen ID when using It could be the same for many other plugins that extend the admin like this. |
|
You should remove parameter type hinting/declaration/definition altogether anyway, it makes function calls 6~14% slower; IIRC even per parameter typed. See https://3v4l.org/j7FPnW. Rely on the PHPdocs you set, and adhere to strict type testing throughout your code altogether (excluding hinting), such as setting the third parameter of |
All Submissions:
Changes proposed in this Pull Request:
Closes #34725
We added a function
is_order_meta_box_screenwhich asstringtype definition as one of its param. From PHP 8.1, if null is passed as the screen_id, it's not typecasted, but instead a fatal is thrown. This PR removes the type definition to accomodatenullscreen ID.How to test the changes in this Pull Request:
Uncaught TypeError: WC_Admin_Assets::is_order_meta_box_screen(): Argum. With this PR, it should be resolved and setup screen with load as usual.Other information:
pnpm changelog add --filter=<project>?FOR PR REVIEWER ONLY: