betterangels / better-angels

The Better Angels are a group of anarchists committed to feminist, anti-racist, anti-capitalist struggle who use direct action software development as a technique of liberatory resistance.
https://betterangels.github.io/
55 stars 12 forks source link

"Fatal error: Call to undefined fuction get_current_screen()" when accessing WordPress "Customize" admin screen #119

Closed TechForJustice closed 8 years ago

TechForJustice commented 8 years ago

While trying to customize my website (after having already downloaded the Buoy Plugin) I ran into this error: "Fatal error: Call to undefined function get_current_screen() in […/path/to…]/wp-content/plugins/buoy/class-buoy-team.php on line 924"

fabacab commented 8 years ago

It's possible you're still running an old version; uninstall and re-install the Buoy plugin and try again.

If it still happens, you'll need to provide more information than "While trying to customize my website" because that could mean anything.

Read http://www.noverse.com/blog/2012/06/how-to-write-a-good-bug-report/ for guidance on what to write in a bug report.

vincentshadow commented 8 years ago

I got a 500 too (Internal Server Error) upon activation of the Bouy plugin using the WordPress template theme AccessLite. When attemptinh to use the themes template customization feature (Customize) which is the themes dashboard essentially it is unable to load resulting in a "Failed to load resource: the server responded with a status of 500 (Internal Server Error)."

When Bouy is deactivated then functionality returns. Have not attempted other template themes to recreate error. I am using the latest plugin. TechForJustice, what theme are you using?

fabacab commented 8 years ago

Hm, thanks for the additional info. I'll reopen this and have a look ASAP.

ghost commented 8 years ago

TechForJustice is using WordPress theme SKT White Pro, and the latest plugin was installed. I just went and selected 'customize' on the themes dashboard to double check, and the error is the same - Fatal error: Call to undefined function get_current_screen() in […/path/to…]/wp-content/plugins/buoy/class-buoy-team.php on line 924.

vincentshadow commented 8 years ago

Thanks meitar. When I am back to that site I will look around and see what I can find too. Thx Hannah for confirming multiple themes.

fabacab commented 8 years ago

Okay, two things. First, let's make sure we're on the same page about what's going on.

When you say:

When attemptinh to use the themes template customization feature (Customize) which is the themes dashboard

I am assuming that you mean that you have clicked on Appearance -> Customize in your WordPress dashboard, resulting in the wp-admin/customize.php script being run. Yes?

If so, can either of you provide a link to the theme you are using? I cannot find "AccessLite" on the WordPress plugin repository, and "SKT White Pro" seems to be a for-pay theme, so I do not have its source code. This means I cannot confirm the bug, because I cannot reproduce it.

fabacab commented 8 years ago

I found a theme "SKT White" (not the pro) and cannot reproduce the issue. I also found a theme named "AccessPress Lite" and thought maybe you had just mistyped the theme name, so I loaded it and tried to access the Customize screen there. It worked, there, too. :\

ghost commented 8 years ago

Yes, it's for-pay. If you're going to be up and want to investigate asap, I can give u admin access so you can check out the code. And, yes, we are on the same page - On the Dashboard, I click on Appearance> Customize. Also discovered that it happens with Appearance > Header too.

vincentshadow commented 8 years ago

Yes and yes. I did mistype the theme, but you got it right (Accesspress Lite at https://wordpress.org/themes/accesspress-lite/

And yes, running the /wp-admin/customize.php was the issue.

I am running WP version 4.4.1 with no updates showing for themes, plugins... Can you confirm the latest version of bouy? screenshot.pdf

fabacab commented 8 years ago

Also discovered that it happens with Appearance > Header too.

"Header" is part of "Customize," so it makes sense that it would happen there, too. WordPress calls this the "Theme Customizer."

If you're going to be up and want to investigate asap, I can give u admin access so you can check out the code.

That would be handy, thanks. Send me a private message somehow (encrypted email, LastPass, something) to give me access credentials.

fabacab commented 8 years ago

Can you confirm the latest version of bouy?

I haven't been strict about versions so, to date, the only way to "update to the latest version of Buoy" without touching a command line is to uninstall it from the WordPress interface (not just disable but totally uninstall it) and then re-install it anew. Currently, this will give you the tip of trunk/ stored in the WordPress plugin repository.

Now that I know someone's actually installing it on their own site, I'll be stricter about updating the version string so we can communicate more sanely about what version of Buoy is running on a given site.

FWIW, I tested Buoy at SVN revision 1328936 with the "AccessPress Lite" theme installed and active on my local site, and did not encounter the error. This either means you are not running the same Buoy code as I believe to be in that revision or that there is something else different about your install than mine. For instance, what PHP version are you running?

Any and all additional information would be helpful (and, really, necessary) at this point to figure out why you're seeing an error I can't reproduce.

fabacab commented 8 years ago

For instance, what PHP version are you running?

@vincentshadow, your server reports Apache 2.x running PHP version 5.3.29. You also have at least one plugin that I can detect passively: W3 Total Cache. What happens when you deactivate this plugin? Does the problem persist?

I'll try installing that plugin on my test site to more closely mirror your environment but, again, it would be helpful if you could provide as complete a report as possible about your setup. There is only so much recon I can legally do against your site from over here…. ;)

vincentshadow commented 8 years ago

Reviewing in the Chrome developer console I am seeing the attached. Everything keeps pointing to load-scripts.php. Correct, I have PHP 5.3 and MySQL Version 5.5.44 on Apache baby. Tell me what else you need recon man. And \ everything is fine upon deactivation**. screenshot2.pdf

fabacab commented 8 years ago

And everything is fine upon deactivation.

Deactivation of what? Buoy, or the other plugins?

vincentshadow commented 8 years ago

Activation of just Buoy = wp-admin/customize.php not loading and returning an error Deactivation of just Buoy = wp-admin/customize.php loading and fine with no error

vincentshadow commented 8 years ago

I will re-install again in a bit and let you know what happens. afk, back in 30.

fabacab commented 8 years ago

I've committed patch d30421a91539e4c5e2c5d4436c303d4f531aa876 that seems to resolve this issue for the TechForJustice.org site. Before I officially release it, though, @vincentshadow, can you please download and manually replace your installed Buoy with the version in this zip file and let me know how it goes for you?

Thanks.

fabacab commented 8 years ago

For what it's worth, this is probably not an issue related to the themes. When I installed the SKT White Pro theme on my local server, there was still no problem. So the problem is either some kind of weird plugin incompatibility or another combination of things that I haven't tracked down (and that may not be worth tracking down, given the simple workaround).

The code path for this is also strange to me. If you look at WordPress 4.4.1's customize.php on line 13 you'll see a call to require_once the admin bootstrap. Tracing the execution path in that file down to line 82 shows another load to the rest of the admin codebase, in wp-admin/includes/admin.php. And that file, in turn, unconditionally loads the Screen API code (in lines 53 and 54), which is where the get_current_screen() function is defined, also unconditionally.

In other words, as far as I can tell, there is no obvious reason why the Screen API code would not be loaded for your WordPress and yet loaded without an issue in mine, and either way, it doesn't seem to be something that the theme you're using is causing.

So. That's weird.

fabacab commented 8 years ago

Ping, @vincentshadow. Any news?

fabacab commented 8 years ago

Okay so, I'm gonna assume my above patch fixes this because I haven't heard back from anyone about this in a week, and would like to release the patch sooner rather than later.

ghost commented 8 years ago

wait a min - know @vincentshadow touched on it yesterday - got three jobs and babies going on. will get back. sorry for delay.

fabacab commented 8 years ago

I still haven't heard back from anyone about this and now it's approaching two weeks, so I'm not going to wait any longer, despite objections.