File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 ),
3131 'excludedClasses ' => $ params ['yiisoft/yii-debug ' ]['excludedClasses ' ],
3232 ],
33+ 'reset ' => function () {
34+ /** @var Debugger $this */
35+ $ this ->allowStart = true ;
36+ },
3337 ],
3438];
Original file line number Diff line number Diff line change 3232 ),
3333 'excludedClasses ' => $ params ['yiisoft/yii-debug ' ]['excludedClasses ' ],
3434 ],
35+ 'reset ' => function () {
36+ /** @var Debugger $this */
37+ $ this ->allowStart = true ;
38+ },
3539 ],
3640];
Original file line number Diff line number Diff line change @@ -30,6 +30,16 @@ final class Debugger
3030 */
3131 private readonly DataNormalizer $ dataNormalizer ;
3232
33+ /**
34+ * @var string|null ID of the current request. `null` if debugger is not active.
35+ */
36+ private ?string $ id = null ;
37+
38+ /**
39+ * @var bool Whether debugger startup is allowed.
40+ */
41+ private bool $ allowStart = true ;
42+
3343 /**
3444 * @param StorageInterface $storage The storage to store collected data.
3545 * @param CollectorInterface[] $collectors Collectors to be used.
@@ -57,11 +67,6 @@ public function __construct(
5767 register_shutdown_function ([$ this , 'stop ' ]);
5868 }
5969
60- /**
61- * @var string|null ID of the current request. `null` if debugger is not active.
62- */
63- private ?string $ id = null ;
64-
6570 /**
6671 * Returns whether debugger is active.
6772 *
@@ -91,7 +96,17 @@ public function getId(): string
9196 */
9297 public function start (object $ event ): void
9398 {
99+ if (!$ this ->allowStart ) {
100+ return ;
101+ }
102+
94103 if (!$ this ->debuggerStartupPolicy ->satisfies ($ event )) {
104+ $ this ->allowStart = false ;
105+ $ this ->kill ();
106+ return ;
107+ }
108+
109+ if ($ this ->isActive ()) {
95110 return ;
96111 }
97112
You can’t perform that action at this time.
0 commit comments