From 705561b7736c8e1241b9104d7834b2c4c9537e74 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Thu, 9 Jun 2022 22:04:00 -0700 Subject: [PATCH 1/3] Fix an error with newer PHP versions erroring on date() calls (#63) This solves: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, string given in ... You can recreate this error with the following code: ``` $x = [ 'query_time' => '123456789 ms', 'query_time2' => 123456789 ]; k($x); ``` --- class.krumo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class.krumo.php b/class.krumo.php index 5555925..6ac1550 100644 --- a/class.krumo.php +++ b/class.krumo.php @@ -1424,7 +1424,7 @@ private static function plural($number, $word) private static function is_datetime($name, $value) { // If the name contains date or time, and the value looks like a unixtime - if (preg_match("/date|time/i", $name) && ($value > 10000000 && $value < 4000000000)) { + if (preg_match("/date|time/i", $name) && (is_numeric($value) && $value > 10000000 && $value < 4000000000)) { $ret = date("r", $value); return $ret; From a513a50577427ff5c5d656be86c511d7e9d938f3 Mon Sep 17 00:00:00 2001 From: Dennis Riehle Date: Mon, 1 Aug 2022 16:45:18 +0200 Subject: [PATCH 2/3] Fix deprecation message appearing in CLI context with PHP 8.1 (#65) * fixed deprecation appearing in CLI context with PHP 8.1 * increased minimum PHP version to 7.0 --- class.krumo.php | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/class.krumo.php b/class.krumo.php index 6ac1550..9f571eb 100644 --- a/class.krumo.php +++ b/class.krumo.php @@ -1607,7 +1607,7 @@ private static function cli_dump() { } foreach ($args as $i) { - $out = var_export($i); + $out = var_export($i) ?? ''; print trim($out); if (sizeof($args) >= 1) { diff --git a/composer.json b/composer.json index 5abac28..3781d61 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ } ], "require": { - "php": ">=5.2.17" + "php": ">=7.0" }, "require-dev": { "fabpot/php-cs-fixer": "dev-master", From c2972cc256e76197a156dfccb18affa439364585 Mon Sep 17 00:00:00 2001 From: Dennis Riehle Date: Mon, 1 Aug 2022 16:48:18 +0200 Subject: [PATCH 3/3] Fix deprecated message appearing in web context with PHP 8.1 (#64) * fix deprecated message appearing in web context with PHP 8.1 * use to PHP7-syntax --- class.krumo.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/class.krumo.php b/class.krumo.php index 9f571eb..c83a6f7 100644 --- a/class.krumo.php +++ b/class.krumo.php @@ -499,8 +499,9 @@ public static function dump($data, $second = '') $_ = debug_backtrace(); while ($d = array_pop($_)) { $callback = static::$lineNumberTestCallback; - $function = strToLower($d['function']); - if (in_array($function, array("krumo","k","kd")) || (strToLower(@$d['class']) == 'krumo') || (is_callable($callback) && call_user_func($callback, $d))) { + $class = strtolower($d['class'] ?? ''); + $function = strtolower($d['function'] ?? ''); + if (in_array($function, array('krumo','k','kd')) || $class == 'krumo' || (is_callable($callback) && call_user_func($callback, $d))) { break; } }