Jetpack: Widgets: Social Icons - Missing argument for enqueue_admin_scripts callback when Page Builder (by SiteOrigin) is installed

Created on 4 Apr 2018  Â·  18Comments  Â·  Source: Automattic/jetpack

I created a fresh site with Jetpack 6.0, connected it, added Page Builder and when attempting to add a new page I saw these warnings in the log

Undefined variable: hook
 Type: PHP Notice Line: 48
 File: wp-content/plugins/jetpack/modules/widgets/social-icons.php

Missing argument 1 for Jetpack_Widget_Social_Icons::enqueue_admin_scripts(), 
called in wp-content/plugins/siteorigin-panels/inc/admin.php on line 449 and defined

Steps to reproduce the issue

  • On a connected site with Jetpack 6.0 and Page Builder installed.
  • Make sure WP_DEBUG and/or WP_DEBUG_LOG are turned on
  • Attempt to create a new Page ( Pages -> Add New )
  • Check the logs.
  • Expect to see the warning

What I expected

  • No warnings

What happened instead

  • Those warnings
Extra Sidebar Widgets [Pri] BLOCKER [Type] Bug

Most helpful comment

SiteOrigin has just release version 2.6.4 of Page Builder, addressing issues like the one reported here.

Unfortunately, the fix makes the Social Icons widget not be fully configurable if done through Page Builder.

Props to @Misplon for such a rapid reponse.

I'm closing this issue now.

All 18 comments

Also in 1064342-zen

@jeherve I couldn't reproduce anything heavier than this warning. I actually found this warning when trying to reproduce a comment that someone left on the Release post.

Here is my log of the error breaking the Edit page (fatal error):

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Jetpack_Widget_Social_Icons::enqueue_admin_scripts(), 0 passed in /home//public_html/test/wp-content/plugins/siteorigin-panels/inc/admin.php on line 449 and exactly 1 expected in /home//public_html/test/wp-content/plugins/jetpack/modules/widgets/social-icons.php:45 Stack trace: #0 /home//public_html/test/wp-content/plugins/siteorigin-panels/inc/admin.php(449): Jetpack_Widget_Social_Icons->enqueue_admin_scripts() #1 /home//public_html/test/wp-includes/class-wp-hook.php(286): SiteOrigin_Panels_Admin->enqueue_admin_scripts('') #2 /home//public_html/test/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array) #3 /home//public_html/test/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #4 /home//public_html/test/wp-admin/admin-header.php(118): do_action('admin_print_scr...') #5 /home//public_html/test/wp-admin/edit-form-advanced.php(483): require_once('/home//...') # in /home//public_html/test/wp-content/plugins/jetpack/modules/widgets/social-icons.php on line 45

Here's a screenshot of the bigger problem coming from this issue that happens when the Social Icons Widget is indeed present on any sidebar and WP is running on PHP 7.1 or PHP 7.2:

To reproduce:

  • Same steps described in this issue
  • Add a Social Icons widget to a sidebar. No extra configuration needed.

image

Also reported in 423088-hc

Having the same issue. I had to DEACTIVATE PAGEBUILDER and ALL SiteOrgin plugins in order to be able to add/edit posts/page and customize site.
screenshot-2018-4-4 edit post smart cities library wordpress

Hi Darren. Another option would be to temporarily deactivate Extra Sidebar
Widgets module in Jetpack Settings.

If you need the Extra Sidebar Widgets you could also roll back Jetpack to
previous version until next version is released.
On Wed, Apr 4, 2018 at 5:26 PM Darren Bates notifications@github.com
wrote:

Having the same issue. I had to DEACTIVATE PAGEBUILDER and ALL SiteOrgin
plugins in order to be able to add/edit posts/page and customize site.
[image: screenshot-2018-4-4 edit post smart cities library wordpress]
https://user-images.githubusercontent.com/22603916/38317394-9b1cc15e-37f2-11e8-9cb9-2a97da738159.png

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Automattic/jetpack/issues/9234#issuecomment-378641291,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAwKp1MAAgLKqcTkc4jvGbmdH-KoXcrsks5tlOYjgaJpZM4TGsWA
.

I need the EXTRA SIDEBAR functionality. I use DREAMPRESS and I am not sure how to rollback JETPACK to previous version. Can you send instructions or must I contact DREAMPRESS to roll-back?

thanks.

Seems like the problem is generated when Page builder tries to call the enqueue_admin_scripts() method on all widgets available if the method exists. It does not pass any argument to that method call.

Given that some of the widgets may want to take advantage of the $hook parameter (like social icons) and use this class method to be a callback for the admin_enqueue_scripts WordPress action, this fails as a Fatal Error on PHP 7.1 and PHP 7.2

cc @Misplon .

@oskosk SiteOrigin is working the issue. Testing fix at the moment.

@DarrenBatesLLC You can use: https://wordpress.org/plugins/wp-rollback/. (This isn't the best place for support though.)

Thanks for the heads-up @Misplon !

By looking at the conflicting code here: https://github.com/Automattic/jetpack/blob/master/modules/widgets/social-icons.php#L48

...It seems that even if SiteOrigin updates its behaviour then this widget won't show up properly there because we're trying to scope down the pages where we will be loading the supporting js for the widget form.

There's an "Add Icon" button on the Social Icons widget form. Which is supposed to behave like this:

socialiconwidget

But then, by testing with updating the Social Icons Widget enqueue_admin_scripts method signature to be function enqueue_admin_scripts( $hook = null ) so to not throw a fatal, I get to see, that the widget form shows broken in PageBuilder:

socialiconwidget2

@zinigor @jeherve what do you think about this ?

We’re going to release a fix to prevent the fatal error. Basically, just not calling that function for anything that isn’t a core WP JS widget.

Existing JP widgets not using the new front end admin JS way of doing things should still work as before.

We’d love to have new Jetpack widgets working in Page Builder. In order to do that, we’d need a generic way to enqueue the required front end admin scripts.

Thanks @Misplon!

Looks like there was at least one other Jetpack widget that wasn't working properly with Page Builder (The Twitter Timeline widget) because it also checks if we're on the widgets/customizer page before enqueuing JS. This one didn't conflict because the callback it uses for admin_enqueue_scripts is named admin_scripts so Page Builder didn't attempt to call it

Awesome, thanks for your effort and the update, it's most appreciated.

SiteOrigin has just release version 2.6.4 of Page Builder, addressing issues like the one reported here.

Unfortunately, the fix makes the Social Icons widget not be fully configurable if done through Page Builder.

Props to @Misplon for such a rapid reponse.

I'm closing this issue now.

Was this page helpful?
0 / 5 - 0 ratings