• peterrivardhotmailcom

    (@peterrivardhotmailcom)


    My host update PHP installation from 7.4 to 8.1. I have updated all my themes and plugins, but I have one site which, when 8.1 is applied, will not open. It returns this error message: “0 passed in /home/jaspriv0/public_html/navidad2012/wp-includes/class-wp-widget-factory.php on line 61 and at least 2 expected”

    I am running the NexGen Gallery plug-in which says it is updated (3.3) There is the block widget that’s part of WordPress…otherwise, there are no widgets on the site.

    Here are lines 56 – 61 of the file “class-wp-widget-factory.php.”

    */
    	public function register( $widget ) {
    		if ( $widget instanceof WP_Widget ) {
    			$this->widgets[ spl_object_hash( $widget ) ] = $widget;
    		} else {
    			$this->widgets[ $widget ] = new $widget();

    How should I edit this code for compatibility with PHP 8.1 and WP 6.0.3
    Any suggestions will be much appreciated – I can toggle from PHP 7.4 to 8.1 for the next 24 hours or so.

    Thanks for any help offered,
    Pedro

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator James Huff

    (@macmanx)

    The issue is with what’s being passed through that, it’s either a plugin or theme function.

    Try manually resetting your plugins (no Dashboard access required). If that resolves the issue, reactivate each one individually until you find the cause.

    If that does not resolve the issue, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel (consult your hosting provider’s documentation for specifics on these), navigate to /wp-content/themes/ and rename the directory of your currently active theme. Hopefully, this will force the default theme to activate and rule out a theme-specific issue (theme functions can interfere like plugins).

    Thread Starter peterrivardhotmailcom

    (@peterrivardhotmailcom)

    PS: The full error message actually begins with “Too few arguments…”

    Also, I checked this code against the same file in a site which is working just fine, and these lines are the same, so my puzzlement increases.

    Moderator James Huff

    (@macmanx)

    Please see my reply above.

    Thread Starter peterrivardhotmailcom

    (@peterrivardhotmailcom)

    Thank you, James Huff – that gives me something to work with.

    Thread Starter peterrivardhotmailcom

    (@peterrivardhotmailcom)

    Posted PS before I saw your reply. Changing the name of the theme directory didn’t cause it to default to another. Just threw an error message. But, once I reverted to 7.4 and changed the theme, it opened fine in php 8.1, so you are right on about the theme.

    Thanks

    Moderator James Huff

    (@macmanx)

    Excellent, if you report it to the theme’s support, they’ll be able to take care of that for you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP 8.1 WP 6.0.3Too few arguments to function WP_Widget::’ is closed to new replies.