Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#63408 closed defect (bug) (duplicate)

PHP Warning/Notice MultiSite when running wp-cron from cli

Reported by: elialum's profile elialum Owned by:
Milestone: Priority: normal
Severity: minor Version: 6.8
Component: Cron API Keywords:
Focuses: multisite Cc:

Description

Hi,

WordPress Multi site setup, when running the cron via the CLI, getting various PHP warnings/notices, depending on the PHP version.
No plugin installed (besides the "beta tester" plugin), default "Twenty Twenty-Four" theme

PHP 7.4

$/opt/cpanel/ea-php74/root/bin/php /home/user/public_html/wp-cron.php 

Notice: Undefined index: HTTP_HOST in /home/user/public_html/wp-includes/ms-settings.php on line 62

PHP 8.2

$/opt/cpanel/ea-php82/root/bin/php /home/user/public_html/wp-cron.php 

Warning: Undefined array key "HTTP_HOST" in /home/user/public_html/wp-includes/ms-settings.php on line 62
Deprecated: stripslashes(): Passing null to parameter #1 ($string) of type string is deprecated in /home/user/public_html/wp-includes/ms-settings.php on line 62

PHP 8.4

$/opt/cpanel/ea-php84/root/bin/php /home/user/public_html/wp-cron.php 

PHP Warning:  PHP Startup: session.gc_divisor must be greater than 0 in Unknown on line 0
Warning: Undefined array key "HTTP_HOST" in /home/user/public_html/wp-includes/ms-settings.php on line 62
Deprecated: stripslashes(): Passing null to parameter #1 ($string) of type string is deprecated in /home/user/public_html/wp-includes/ms-settings.php on line 62

Change History (2)

#1 @SergeyBiryukov
11 months ago

  • Focuses multisite added
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome to WordPress Trac!

Thanks for the report, we're already tracking this issue in #47733.

#2 @BackupGuard
11 months ago

Thanks @SergeyBiryukov !
I've applied the patch from https://core.trac.wordpress.org/changeset/60226 and can confirm it's working with PHP 7.4, 8.2, 8.4

/opt/cpanel/ea-php74/root/bin/php /home/user/public_html/wp-cron.php 
/opt/cpanel/ea-php82/root/bin/php /home/user/public_html/wp-cron.php 
/opt/cpanel/ea-php84/root/bin/php /home/user/public_html/wp-cron.php 

No errors :)

Note: See TracTickets for help on using tickets.