Skip to content

PHP Warning During WordPress Core Updates #822

@j-hoffmann

Description

@j-hoffmann

Description
A missing variable causes a PHP warning during WordPress Core updates.

The error message is as follows:

PHP Warning: compact(): Undefined variable $new_version in [...]/wp-content/plugins/mainwp-child/class/class-mainwp-child-actions.php on line 655

The update itself is not interrupted and the notification email about the automatic update gets delivered normally.

Steps To Reproduce

  • To be safe use a fresh install of WordPress
  • Install MainWP Child plugin and activate
  • Connect MainWP Child to a MainWP Dashboard (it won't work without this step)
  • Install and activate the plugins "Core Rollback" and "WP Console"
  • Use "Tools" > "Rollback Core" to select WordPress version 6.8.1 and click on "Rollback", when redirected press the button "Re-install version 6.8.1".
  • To immediately force trigger the auto update process go to "Tools" > "WP Console" and run the following command:
    wp_maybe_auto_update(); You should immediately be shown the PHP warning message.
  • As an alternative you can also wait for wp cron to trigger the update process (takes up to 12 hours), but then you need
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );
    
    set in your wp-config.php file. After the update /wp-content/debug.log for the PHP warning message.

Expected behavior
Of course the expected behavior is the update going through without any PHP error messages or warnings.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions