Skip to content

Commit e9a3c83

Browse files
committed
E_STRICT and "Implicitly marking parameter as nullable is deprecated" fixes for PHP8.4
Might be more of these lurking, but this version should at least get PW to load without a huge mess of Tracy errors.
1 parent bf7603c commit e9a3c83

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

TracyDebugger.module.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function getModuleInfo() {
2727
'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__),
2828
'author' => 'Adrian Jones',
2929
'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/',
30-
'version' => '4.26.42',
30+
'version' => '4.26.43',
3131
'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first
3232
'singular' => true,
3333
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',
@@ -1468,6 +1468,10 @@ function bsZIndex() {
14681468

14691469
// TRACY SETTING
14701470
//convert checked log severity strings to constants and array_reduce to bitwise OR (|) line
1471+
// remove E_STRICT in case it's still set from old version of Tracy - it's deprecated in PHP 8.4
1472+
if(($key = array_search('E_STRICT', $this->data['logSeverity'])) !== false) {
1473+
unset($this->data['logSeverity'][$key]);
1474+
}
14711475
$severityOptions = array_map('constant', $this->data['logSeverity']);
14721476
Debugger::$logSeverity = array_reduce($severityOptions, function($a, $b) { return $a | $b; }, 0);
14731477

@@ -3565,7 +3569,6 @@ public function getModuleConfigInputfields(array $data) {
35653569
$f->addOption('E_USER_ERROR', 'E_USER_ERROR');
35663570
$f->addOption('E_USER_WARNING', 'E_USER_WARNING');
35673571
$f->addOption('E_USER_NOTICE', 'E_USER_NOTICE');
3568-
$f->addOption('E_STRICT', 'E_STRICT');
35693572
$f->addOption('E_RECOVERABLE_ERROR', 'E_RECOVERABLE_ERROR');
35703573
$f->addOption('E_DEPRECATED', 'E_DEPRECATED');
35713574
$f->addOption('E_USER_DEPRECATED', 'E_USER_DEPRECATED');

includes/TD.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected static function tracyUnavailable() {
3737
* Tracy\Debugger::debugAll() shortcut.
3838
* @tracySkipLocation
3939
*/
40-
public static function debugAll($var, $title = NULL, array $options = NULL) {
40+
public static function debugAll(string|array $var, string|array|null $title = NULL, ?array $options = NULL) {
4141
if(self::tracyUnavailable()) return false;
4242
static::barDump($var, $title, $options);
4343
static::dump($var, $title, $options);
@@ -51,7 +51,7 @@ public static function debugAll($var, $title = NULL, array $options = NULL) {
5151
* Tracy\Debugger::barEcho() shortcut.
5252
* @tracySkipLocation
5353
*/
54-
public static function barEcho($str, $title = null) {
54+
public static function barEcho(string $str, string|array|null $title = null) {
5555
if(self::tracyUnavailable() && !\TracyDebugger::getDataValue('recordGuestDumps')) return false;
5656
static::dumpToBar($str, $title, null, true);
5757
}
@@ -60,7 +60,7 @@ public static function barEcho($str, $title = null) {
6060
* Tracy\Debugger::barDump() shortcut.
6161
* @tracySkipLocation
6262
*/
63-
public static function barDump($var, $title = NULL, array $options = NULL) {
63+
public static function barDump(string|array $var, string|array|null $title = NULL, ?array $options = NULL) {
6464
if(self::tracyUnavailable() && !\TracyDebugger::getDataValue('recordGuestDumps')) return false;
6565
if(is_array($title)) {
6666
$options = $title;
@@ -85,7 +85,7 @@ public static function barDump($var, $title = NULL, array $options = NULL) {
8585
* Tracy\Debugger::barDumpBig() shortcut dumping with maxDepth = 6, maxLength = 9999, and maxItems = 250.
8686
* @tracySkipLocation
8787
*/
88-
public static function barDumpBig($var, $title = NULL, array $options = NULL) {
88+
public static function barDumpBig(string|array $var, string|array|null $title = NULL, ?array $options = NULL) {
8989
if(self::tracyUnavailable() && !\TracyDebugger::getDataValue('recordGuestDumps')) return false;
9090
if(is_array($title)) {
9191
$options = $title;
@@ -108,7 +108,7 @@ public static function barDumpBig($var, $title = NULL, array $options = NULL) {
108108
* Tracy\Debugger::dump() shortcut.
109109
* @tracySkipLocation
110110
*/
111-
public static function dump($var, $title = NULL, array $options = NULL) {
111+
public static function dump(string|array $var, string|array|null $title = NULL, ?array $options = NULL) {
112112
if(self::tracyUnavailable() && PHP_SAPI !== 'cli') return false;
113113
if(is_array($title)) {
114114
$options = $title;
@@ -153,7 +153,7 @@ public static function dump($var, $title = NULL, array $options = NULL) {
153153
* Tracy\Debugger::dumpBig() shortcut dumping with maxDepth = 6, maxLength = 9999 and maxItems = 250.
154154
* @tracySkipLocation
155155
*/
156-
public static function dumpBig($var, $title = NULL, array $options = NULL) {
156+
public static function dumpBig(string|array $var, string|array|null $title = NULL, ?array $options = NULL) {
157157
if(self::tracyUnavailable() && PHP_SAPI !== 'cli') return false;
158158
if(is_array($title)) {
159159
$options = $title;
@@ -196,7 +196,7 @@ public static function dumpBig($var, $title = NULL, array $options = NULL) {
196196
* Send content to dump bar
197197
* @tracySkipLocation
198198
*/
199-
private static function dumpToBar($var, $title = NULL, array $options = NULL, $echo = false) {
199+
private static function dumpToBar(string|array $var, string|array|null $title = NULL, ?array $options = NULL, $echo = false) {
200200
$dumpItem = array();
201201
$dumpItem['title'] = $title;
202202
$dumpItem['dump'] = $echo ? '<div class="tracy-echo">' . $var . '</div>' : static::generateDump($var, $options);
@@ -214,7 +214,7 @@ private static function dumpToBar($var, $title = NULL, array $options = NULL, $e
214214
* Generate debugInfo and Full Object tabbed output
215215
* @tracySkipLocation
216216
*/
217-
private static function generateDump($var, $options) {
217+
private static function generateDump(string|array $var, array $options) {
218218
// standard options for all dump/barDump variations
219219
$options[Dumper::COLLAPSE] = isset($options['collapse']) ? $options['collapse'] : \TracyDebugger::getDataValue('collapse');
220220
$options[Dumper::COLLAPSE_COUNT] = isset($options['collapse_count']) ? $options['collapse_count'] : \TracyDebugger::getDataValue('collapse_count');
@@ -341,7 +341,7 @@ private static function generateEditViewLinks($var, $type, $section) {
341341
* Tracy\Debugger::log() shortcut.
342342
* @tracySkipLocation
343343
*/
344-
public static function log($message, $priority = Debugger::INFO) {
344+
public static function log(string $message, $priority = Debugger::INFO) {
345345
if(self::tracyUnavailable()) return false;
346346
return Debugger::log($message, $priority);
347347
}
@@ -350,7 +350,7 @@ public static function log($message, $priority = Debugger::INFO) {
350350
* Tracy\Debugger::timer() shortcut.
351351
* @tracySkipLocation
352352
*/
353-
public static function timer($name = NULL) {
353+
public static function timer(?string $name = NULL) {
354354
if(self::tracyUnavailable()) return false;
355355
$roundedTime = round(Debugger::timer($name),4);
356356
if($name) {
@@ -365,7 +365,7 @@ public static function timer($name = NULL) {
365365
* Tracy\Debugger::fireLog() shortcut.
366366
* @tracySkipLocation
367367
*/
368-
public static function fireLog($message = NULL) {
368+
public static function fireLog(?string $message = NULL) {
369369
if(!method_exists('Tracy\Debugger', 'getFireLogger') || self::tracyUnavailable()) return false;
370370
return Debugger::fireLog($message);
371371
}
@@ -375,7 +375,7 @@ public static function fireLog($message = NULL) {
375375
* Zarganwar\PerformancePanel\Register::add() shortcut.
376376
* @tracySkipLocation
377377
*/
378-
public static function addBreakpoint($name = null, $enforceParent = null) {
378+
public static function addBreakpoint(?string $name = null, ?bool $enforceParent = null) {
379379
if(self::tracyUnavailable() || !class_exists('\Zarganwar\PerformancePanel\Register')) return false;
380380
return Zarganwar\PerformancePanel\Register::add($name, $enforceParent);
381381
}

0 commit comments

Comments
 (0)