On Tue, Mar 30, 2021 at 10:37 AM Jeffrey Walton noloader@gmail.com wrote:
Hi Everyone,
This caught my eye when running one of my maintenance scripts. The Setup.php:563 warning is new.
The warning was not present on the old CentOS machine. The new machine is Ubuntu 20, PHP 7.4, MySQL 8, Mediawiki 1.35.1.
# php /var/www/html/w/maintenance/generateSitemap.php ...
PHP Notice: Trying to access array offset on value of type bool in /var/www/html/w/includes/Setup.php on line 563
Here is the code in question:
557 // Set server name 558 $serverParts = wfParseUrl( $wgCanonicalServer ); 559 if ( $wgServerName !== false ) { 560 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, ' 561 . 'not customized. Overwriting $wgServerName.' ); 562 } 563 $wgServerName = $serverParts['host']; 564 unset( $serverParts );
Would adding an:
if ( is_array( $serverParts ) ) $wgServerName = $serverParts['host'];
Be the proper fix here?
If not, what is the proper fix?
Thanks in advance.