From 105ba2b8ebbdf4e65f2300bf79b233850107c4d6 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Thu, 26 Apr 2018 08:48:09 -0400 Subject: [PATCH] Add __debugInfo() method to WireInput class per processwire/processwire-issues#575 --- wire/core/WireInput.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wire/core/WireInput.php b/wire/core/WireInput.php index a5bb993a..7b6867f7 100644 --- a/wire/core/WireInput.php +++ b/wire/core/WireInput.php @@ -650,5 +650,24 @@ class WireInput extends Wire { } } } + + /** + * debugInfo PHP 5.6+ magic method + * + * This is used when you print_r() an object instance. + * + * @return array + * + */ + public function __debugInfo() { + $info = parent::__debugInfo(); + $info['get'] = $this->getVars ? $this->getVars->getArray() : null; + $info['post'] = $this->postVars ? $this->postVars->getArray() : null; + $info['cookie'] = $this->cookieVars ? $this->cookieVars->getArray() : null; + $info['whitelist'] = $this->whitelist ? $this->whitelist->getArray() : null; + $info['urlSegments'] = $this->urlSegments; + $info['pageNum'] = $this->pageNum; + return $info; + } }