From 7f75fdec333b2f5adb2e4815e523e2b41e3fb264 Mon Sep 17 00:00:00 2001 From: Nathan Gass Date: Thu, 28 Aug 2025 14:55:11 +0200 Subject: add print_r argument to it_debug::dump --- it_debug.class | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'it_debug.class') diff --git a/it_debug.class b/it_debug.class index 6cad9b5..8284093 100644 --- a/it_debug.class +++ b/it_debug.class @@ -120,6 +120,7 @@ static function setup() * @param $p['color'] Allow color [true] * @param $p['html'] Allow html [default based on REMOTE_ADDR] * @param $p['short'] Omit variable names + * @param $p['print_r'] Use print_r instead of var_export (no escaping for strings) * @return String representation of dump */ static function dump($args, $p = []) @@ -170,7 +171,7 @@ static function dump($args, $p = []) foreach ($args as $arg) { $var = array_shift($argnames); - $item = gettype($arg) == 'resource' || is_array($arg) && isset($arg['GLOBALS']) || is_object($arg) && is_a($arg, "SimpleXMLElement") ? trim(print_r($arg, true)) : trim(var_export($arg, true)); + $item = gettype($arg) == 'resource' || is_array($arg) && isset($arg['GLOBALS']) || is_object($arg) && is_a($arg, "SimpleXMLElement") || $p['print_r'] ? trim(print_r($arg, true)) : trim(var_export($arg, true)); # Replace PHP 5+ var_export object representation by old readable style while (preg_match("#(.*\b)(\w+)::__set_state\(array\(([^()]+)\)\)(.*)#s", $item, $regs) && ++$iterations < 100) -- cgit v1.2.3