From 101ce834b8ad297a6692e62a85717de21bb48ad5 Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Fri, 30 Jun 2023 13:17:03 +0100 Subject: [PATCH] Fix PHP 8.1 strlen() error when database replication Seconds_Behind_Master is NULL Summary: When MySQL database replication is configured, but not running, the slave status Seconds_Behind_Master is NULL. When this value is passed to strlen() an error is thrown. Fixes T15507 Test Plan: * Configure database replication such that Seconds_Behind_Master is NULL * Restart php-fpm * Go to Phorge web site. Reviewers: O1 Blessed Committers, chris Reviewed By: O1 Blessed Committers, chris Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15507 Differential Revision: https://we.phorge.it/D25318 --- src/infrastructure/cluster/PhabricatorDatabaseRef.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infrastructure/cluster/PhabricatorDatabaseRef.php b/src/infrastructure/cluster/PhabricatorDatabaseRef.php index e526eb1639..0fe2aabbcb 100644 --- a/src/infrastructure/cluster/PhabricatorDatabaseRef.php +++ b/src/infrastructure/cluster/PhabricatorDatabaseRef.php @@ -393,7 +393,7 @@ final class PhabricatorDatabaseRef if ($is_replica) { $latency = idx($replica_status, 'Seconds_Behind_Master'); - if (!strlen($latency)) { + if (!phutil_nonempty_string($latency)) { $ref->setReplicaStatus(self::REPLICATION_NOT_REPLICATING); } else { $latency = (int)$latency;