From 61e58df994a05c601e349c679e43981b2a1bfb33 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 30 Jan 2019 11:12:09 -0800 Subject: [PATCH 1/4] Work on fixing the countable warnings that popup in PHP 7.2+ --- class.krumo.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/class.krumo.php b/class.krumo.php index b7f116b..3334a6c 100644 --- a/class.krumo.php +++ b/class.krumo.php @@ -1074,8 +1074,13 @@ private static function _vars(&$data) // stain it static::_hive($data); + $count = 0; + if (is_countable($data)) { + $count = count($data); + } + // render it - $collapsed = static::_isCollapsed(static::$_level, count($data)-1); + $collapsed = static::_isCollapsed(static::$_level, $count - 1); if ($collapsed) { $collapse_style = 'style="display: none;"'; } else { @@ -1290,7 +1295,7 @@ private static function _object(&$data, $name) } print "
  • 0) { + if (is_countable($data) && count($data) > 0) { print 'onClick="krumo.toggle(this);"'; } print 'onMouseOver="krumo.over(this);" onMouseOut="krumo.out(this);">'; @@ -1675,4 +1680,12 @@ function kd() exit(); } } + +// Polyfill for is_countable() from https://secure.php.net/manual/en/function.is-countable.php +if (!function_exists('is_countable')) { + function is_countable($var) { + return (is_array($var) || $var instanceof Countable); + } +} + // vim: tabstop=4 shiftwidth=4 expandtab autoindent From 3209d212c96f523f778274c6023cb92d8752ec48 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 30 Jan 2019 11:14:35 -0800 Subject: [PATCH 2/4] Bump the version since we're fixing a major thing for PHP 7.2 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 659914a..a918a2a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.8 +0.6.0 From 143efce3141841a2db5adce4c9f1c1d3480f8d8d Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 30 Jan 2019 16:19:04 -0800 Subject: [PATCH 3/4] Add ctrl + click as an option for expand/collapse all. Addresses #30 --- class.krumo.php | 19 ++++------- js/krumo.js | 91 ++++++++++++++++++++++++++++++++++++++++++------- js/krumo.min.js | 2 +- 3 files changed, 85 insertions(+), 27 deletions(-) diff --git a/class.krumo.php b/class.krumo.php index 3334a6c..1ed6ffd 100644 --- a/class.krumo.php +++ b/class.krumo.php @@ -818,8 +818,12 @@ private static function _css() // the JS print "