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 Wikimedia\Rdbms\DBConnectionError from line 1420 of /var/www/html/w/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Unknown error (localhost) #0 /var/www/html/w/includes/libs/rdbms/loadbalancer/LoadBalancer.php(934): Wikimedia\Rdbms\LoadBalancer->reportConnectionError() #1 /var/www/html/w/includes/libs/rdbms/loadbalancer/LoadBalancer.php(901): Wikimedia\Rdbms\LoadBalancer->getServerConnection() #2 /var/www/html/w/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1046): Wikimedia\Rdbms\LoadBalancer->getConnection() #3 /var/www/html/w/maintenance/includes/Maintenance.php(1371): Wikimedia\Rdbms\LoadBalancer->getMaintenanceConnectionRef() #4 /var/www/html/w/maintenance/generateSitemap.php(200): Maintenance->getDB() #5 /var/www/html/w/maintenance/doMaintenance.php(107): GenerateSitemap->execute() #6 /var/www/html/w/maintenance/generateSitemap.php(564): require_once('/var/www/html/w...') #7 {main}
I think the exception is expected and due to some troubles with our system users.
Jeff
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.
mediawiki-l@lists.wikimedia.org