Fatal error: Uncaught Error: Cannot use object of type Closure as array
-
Hi,
when using this plugin with AMP plugin but only on AMP version of page i get an error:
Cannot use object of type Closure as array in /wp-content/plugins/widget-css-classes/includes/widget-css-classes.class.php:747
can You take a look into that?
i use this AMP plugin https://ww.wp.xz.cn/plugins/amp/
best regards
maciej
-
Hello @maciejmackowiak,
Could you share more info about your installation?
– WP version
– PHP version
– Other plugins
– ThemeThanks! Jory
thanks for replay,
so to check if it is not related with any other plugins i made a clean wordpress instalation with only Your plugin and AMP pluginthis error occurs once You click View AMP -> Re-validate link in wp admin bar https://imgur.com/a/LhyXubO
WP Version: 5.1.1
PHP Version: 7.3
Other plugins: AMP plugin
Theme: Twenty sixteenbest regards
@keraweb any news?
Hello @maciejmackowiak
Sorry, I’m on holiday until the 25th. It’s on my radar after then!
If you or one of the AMP plugin authors find a solution in the meantime I’ll make sure to include it in the next update.Thanks, Jory
Hello @maciejmackowiak
Could you provide a call-stack of the error?
I can’t find how to reproduce this.What type of widget are you using?
Also, what type of Template Mode (AMP settings) are you using?Thanks, Jory
-
This reply was modified 7 years ago by
Jory Hogeveen.
Hello @maciejmackowiak,
I’m closing this issue since there is no response anymore.
If you still encounter this issue and/or have more information on how I can reproduce it feel free to re-open this issue and I would gladly help!Cheers, Jory
@maciejmackowiak Please reply with details.
sorry @keraweb , i’ve haven’t seen that You replayed
steps to reproduce:
1. fresh wp install with just two – Your plugin and AMP
https://ww.wp.xz.cn/plugins/amp/
2. template mode – Standard or Transitional – both produced an error
3. theme – Twenty SixteenVersion: 2.0
4. go to home page and click in wp admin bar -> AMP->AMP revalidate( https://imgur.com/a/ttU5cLy )stack trace:
PHP Fatal error: Uncaught Error: Cannot use object of type Closure as array in /var/www/html/wp-content/plugins/widget-css-classes/includes/widget-css-classes.class.php:747
Stack trace:
#0 /var/www/html/wp-content/plugins/widget-css-classes/includes/widget-css-classes.class.php(469): WCSSC::get_widget_opt(Array)
#1 /var/www/html/wp-content/plugins/amp/includes/validation/class-amp-validation-manager.php(1544): WCSSC::add_widget_classes(Array)
#2 /var/www/html/wp-content/plugins/amp/includes/validation/class-amp-validation-manager.php(1254): AMP_Validation_Manager::{closure}(Array)
#3 /var/www/html/wp-includes/class-wp-hook.php(286): AMP_Validation_Manager::{closure}(Array)
#4 /var/www/html/wp-includes/plugin.php(208): WP_Hook->apply_filters(Array, Array)
#5 /var/www/html/wp-includes/widgets.php(738): apply_filters(‘dynamic_sidebar…’, Array)
#6 /var/www/html/wp-content/themes/twentysixteen/sidebar.php(13): dynamic_sidebar(‘sidebar-1’)
#7 /var/www/html/wp-includes/template.php(722): require_once(‘/var/www/html/w…’)
#8 /var/ in /var/www/html/wp-content/plugins/widget-css-classes/includes/widget-css-classes.class.php on line 747hope it helps 😉
best regardsHi @maciejmackowiak,
I might have found a temporary solution.
Since it’s just for AMP validation we could skip this plugin’s functionality.I’ve made a concept branch for a fix: https://github.com/cleverness/widget-css-classes/tree/fix-amp-closure-error
Could you please test it as well?Thanks, Jory
it look like it does the trick, errors are gone 😉
thanks
Awesome. Can we expect a release soon?
Hello @archon810 @maciejmackowiak
I’ve also raised this issue at AMP:
https://github.com/ampproject/amp-wp/issues/2698Looks like they will implement a fix in the AMP plugin (hopefully soon).
For now, please use the quick fix above.
Once I know more from the AMP authors I’ll know if this plugin needs an official release or not.I’ll mark it as resolved here since it’s a compatibility bug caused by the AMP plugin.
Thanks for reporting this issue!
Cheers, Jory
-
This reply was modified 6 years, 11 months ago by
Jory Hogeveen.
@keraweb Is it possible to push the fix and release it in the meantime, while we wait for AMP to make an even more proper fix?
Hello @archon810,
See this comment: https://github.com/ampproject/amp-wp/issues/2698#issuecomment-508344500
The error will be fixed in the AMP plugin.It’s not preferable to make by quickfix an official release since it isn’t actually a fix..
I will however do a maintenance release soon for https://github.com/cleverness/widget-css-classes/pull/37.
Cheers, Jory
-
This reply was modified 7 years ago by
The topic ‘Fatal error: Uncaught Error: Cannot use object of type Closure as array’ is closed to new replies.