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

Attempt to read property "is_block_editor" on null in loader.php #2573

Open
gmariani opened this issue Oct 17, 2023 · 0 comments
Open

Attempt to read property "is_block_editor" on null in loader.php #2573

gmariani opened this issue Oct 17, 2023 · 0 comments
Labels
[Priority] Low This issue/pull request is not immediate [Type] Bug Something that is not working as expected

Comments

@gmariani
Copy link

gmariani commented Oct 17, 2023

Describe the bug:

PHP Warning: Attempt to read property "is_block_editor" on null in /coblocks/includes/block-migrate/loader.php on line 35

To reproduce:

Try to edit an Elementor Landing page with CoBlocks enabled. Probably not limited to just Elementor Landing Pages. The warning shows up in the error logs afterwards.

Expected behavior:

Not to have errors

Screenshots:

It's in the error logs, no screenshot available

Isolating the problem:

It's due to poor error handling. The 'the_post' action does check if the get_current_screen function exists, but it doesn't check if it's null or not an object before using.

if (!is_admin() || !get_current_screen()->is_block_editor) {
        return;
}

It should be something like this:

$current_screen = get_current_screen();
if (!is_admin() || ($current_screen && method_exists( $current_screen, 'is_block_editor' ) && !$current_screen->is_block_editor)) {
        return;
}

WordPress version:

6.3.2

Gutenberg version:

N/A

Elementor version: 3.16.6
Elementor Pro version: 3.16.2
Coblocks version: 3.1.4

@gmariani gmariani added [Priority] Low This issue/pull request is not immediate [Type] Bug Something that is not working as expected labels Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Priority] Low This issue/pull request is not immediate [Type] Bug Something that is not working as expected
Projects
None yet
Development

No branches or pull requests

1 participant