1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

Fix reentrancy guard in setDebugTimeLimit()

Summary: $initialized is never initialized and onDebugTick() may be registered multiple times.

Test Plan: None. The function is normally only called once.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25469
This commit is contained in:
Zero King 2023-11-13 01:55:01 +08:00
parent 4535e8753c
commit 486fc95b29

View file

@ -261,10 +261,11 @@ final class PhabricatorStartup {
public static function setDebugTimeLimit($limit) {
self::$debugTimeLimit = $limit;
static $initialized;
static $initialized = false;
if (!$initialized) {
declare(ticks=1);
register_tick_function(array(__CLASS__, 'onDebugTick'));
$initialized = true;
}
}