1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

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
This commit is contained in:
Steve Campbell 2023-06-30 13:17:03 +01:00
parent 0a17287e08
commit 101ce834b8

View file

@ -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;