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: check if get_current_screen() is set before accessing properties #262

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

justlevine
Copy link
Contributor

What

This PR fixes the usage of get_current_screen() to check if it's set, before attempting to access properties.

Why

It can cause a fatal php error. Personally, it's getting in the way of my unit tests.

image

To test

<?php
// functions.php
  do_action( 'admin_notices' );

If it doesnt error, it worked. Or just run composer phpstan and confirm it's passing even though the ignore rule has been removed from the baseline.

@justlevine justlevine requested a review from a team as a code owner August 14, 2024 11:54
Copy link

changeset-bot bot commented Aug 14, 2024

🦋 Changeset detected

Latest commit: 6ced628

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@wpengine/wp-graphql-content-blocks Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@justlevine
Copy link
Contributor Author

Those failed tests predate, and are unrelated to, the changes in this PR.

@jasonbahl jasonbahl added the type: bug Issue that causes incorrect or unexpected behavior label Aug 27, 2024
@justlevine
Copy link
Contributor Author

Anything I can do to help get this merged? Hoping to do a sprint of contributions this/next week and it would be nice not to workaround this 🤞

@jasonbahl
Copy link
Contributor

@justlevine it looks like tests are fine on other PRs but not this one? 🤔

@josephfusco josephfusco self-assigned this Sep 10, 2024
@justlevine justlevine requested a review from a team as a code owner September 10, 2024 22:27
@justlevine
Copy link
Contributor Author

@jasonbahl i've rebased the branch on main, so hopefully caught the upstream issue:

image

@jasonbahl jasonbahl merged commit d2f2af5 into wpengine:main Sep 11, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Issue that causes incorrect or unexpected behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants