Fatal Error: Cannot use object of type Closure as array
-
Hello,
I have been facing a fatal error in the last 3 updates of Polylang (since version 2.1.2). I know how to fix it, but I have to do the fix every time I update the plugin.
The error message is : “Fatal error: Cannot use object of type Closure as array in Path/wp-content/plugins/polylang/frontend/frontend-filters.php on line 231″
In the same file mentioned in the error message above, I changed this
if ( ! isset( $wp_registered_widgets[ $widget ]['callback'][0] ) || ! is_object( $wp_registered_widgets[ $widget ]['callback'][0] ) || ! method_exists( $wp_registered_widgets[ $widget ]['callback'][0], 'get_settings' ) ) {to this:
if (!is_array($wp_registered_widgets['callback']) || !isset( $wp_registered_widgets[ $widget ]['callback'][0] ) || ! is_object( $wp_registered_widgets[ $widget ]['callback'][0] ) || ! method_exists( $wp_registered_widgets[ $widget ]['callback'][0], 'get_settings' ) ) {Could you please include this fix in the future releases so that I don’t have to repeat it every time a new version is released.
Thank you!
The topic ‘Fatal Error: Cannot use object of type Closure as array’ is closed to new replies.