Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Whoops\Exception; use Whoops\Inspector\InspectorFactory; use Whoops\Inspe..

Decoded Output download

<?php
 namespace Whoops\Exception; use Whoops\Inspector\InspectorFactory; use Whoops\Inspector\InspectorInterface; use Whoops\Util\Misc; class Inspector implements InspectorInterface { private $exception; private $frames; private $previousExceptionInspector; private $previousExceptions; protected $inspectorFactory; public function __construct($exception, $factory = null) { $this->exception = $exception; $this->inspectorFactory = $factory ?: new InspectorFactory(); } public function getException() { return $this->exception; } public function getExceptionName() { return get_class($this->exception); } public function getExceptionMessage() { return $this->extractDocrefUrl($this->exception->getMessage())["message"]; } public function getPreviousExceptionMessages() { return array_map(function ($prev) { return $this->extractDocrefUrl($prev->getMessage())["message"]; }, $this->getPreviousExceptions()); } public function getPreviousExceptionCodes() { return array_map(function ($prev) { return $prev->getCode(); }, $this->getPreviousExceptions()); } public function getExceptionDocrefUrl() { return $this->extractDocrefUrl($this->exception->getMessage())["url"]; } private function extractDocrefUrl($message) { $docref = array("message" => $message, "url" => null); if (!ini_get("html_errors") || !ini_get("docref_root")) { return $docref; } $pattern = "/\[<a href='([^']+)'>(?:[^<]+)<\/a>\]/"; if (preg_match($pattern, $message, $matches)) { $docref["message"] = preg_replace($pattern, '', $message, 1); $docref["url"] = $matches[1]; } return $docref; } public function hasPreviousException() { return $this->previousExceptionInspector || $this->exception->getPrevious(); } public function getPreviousExceptionInspector() { if ($this->previousExceptionInspector === null) { $previousException = $this->exception->getPrevious(); if ($previousException) { $this->previousExceptionInspector = $this->inspectorFactory->create($previousException); } } return $this->previousExceptionInspector; } public function getPreviousExceptions() { if ($this->previousExceptions === null) { $this->previousExceptions = array(); $prev = $this->exception->getPrevious(); while ($prev !== null) { $this->previousExceptions[] = $prev; $prev = $prev->getPrevious(); } } return $this->previousExceptions; } public function getFrames(array $frameFilters = array()) { if ($this->frames === null) { $frames = $this->getTrace($this->exception); foreach ($frames as $k => $frame) { if (empty($frame["file"])) { $file = "[internal]"; $line = 0; $next_frame = !empty($frames[$k + 1]) ? $frames[$k + 1] : array(); if ($this->isValidNextFrame($next_frame)) { $file = $next_frame["file"]; $line = $next_frame["line"]; } $frames[$k]["file"] = $file; $frames[$k]["line"] = $line; } } $i = 0; foreach ($frames as $k => $frame) { if ($frame["file"] == $this->exception->getFile() && $frame["line"] == $this->exception->getLine()) { $i = $k; } } if ($i > 0) { array_splice($frames, 0, $i); } $firstFrame = $this->getFrameFromException($this->exception); array_unshift($frames, $firstFrame); $this->frames = new FrameCollection($frames); if ($previousInspector = $this->getPreviousExceptionInspector()) { $outerFrames = $this->frames; $newFrames = clone $previousInspector->getFrames(); if (isset($newFrames[0])) { $newFrames[0]->addComment($previousInspector->getExceptionMessage(), "Exception message:"); } $newFrames->prependFrames($outerFrames->topDiff($newFrames)); $this->frames = $newFrames; } if (!empty($frameFilters)) { foreach ($frameFilters as $filterCallback) { $this->frames->filter($filterCallback); } } } return $this->frames; } protected function getTrace($e) { $traces = $e->getTrace(); if (!$e instanceof \ErrorException) { return $traces; } if (!Misc::isLevelFatal($e->getSeverity())) { return $traces; } if (!extension_loaded("xdebug") || !function_exists("xdebug_is_enabled") || !xdebug_is_enabled()) { return $traces; } $stack = array_reverse(xdebug_get_function_stack()); $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); $traces = array_diff_key($stack, $trace); return $traces; } protected function getFrameFromException($exception) { return array("file" => $exception->getFile(), "line" => $exception->getLine(), "class" => get_class($exception), "args" => array($exception->getMessage())); } protected function getFrameFromError(ErrorException $exception) { return array("file" => $exception->getFile(), "line" => $exception->getLine(), "class" => null, "args" => array()); } protected function isValidNextFrame(array $frame) { if (empty($frame["file"])) { return false; } if (empty($frame["line"])) { return false; } if (empty($frame["function"]) || !stristr($frame["function"], "call_user_func")) { return false; } return true; } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace Whoops\Exception; use Whoops\Inspector\InspectorFactory; use Whoops\Inspector\InspectorInterface; use Whoops\Util\Misc; class Inspector implements InspectorInterface { private $exception; private $frames; private $previousExceptionInspector; private $previousExceptions; protected $inspectorFactory; public function __construct($exception, $factory = null) { $this->exception = $exception; $this->inspectorFactory = $factory ?: new InspectorFactory(); } public function getException() { return $this->exception; } public function getExceptionName() { return get_class($this->exception); } public function getExceptionMessage() { return $this->extractDocrefUrl($this->exception->getMessage())["\155\145\x73\163\141\x67\x65"]; } public function getPreviousExceptionMessages() { return array_map(function ($prev) { return $this->extractDocrefUrl($prev->getMessage())["\x6d\145\163\163\x61\x67\x65"]; }, $this->getPreviousExceptions()); } public function getPreviousExceptionCodes() { return array_map(function ($prev) { return $prev->getCode(); }, $this->getPreviousExceptions()); } public function getExceptionDocrefUrl() { return $this->extractDocrefUrl($this->exception->getMessage())["\165\162\x6c"]; } private function extractDocrefUrl($message) { $docref = array("\x6d\145\163\163\x61\x67\145" => $message, "\x75\x72\x6c" => null); if (!ini_get("\x68\x74\x6d\154\x5f\145\162\x72\x6f\x72\163") || !ini_get("\x64\x6f\x63\x72\x65\146\x5f\x72\x6f\x6f\x74")) { return $docref; } $pattern = "\x2f\x5c\x5b\74\141\40\x68\x72\x65\x66\75\x27\x28\133\x5e\47\135\x2b\51\47\76\50\77\x3a\x5b\136\74\135\53\x29\74\x5c\57\x61\76\134\x5d\x2f"; if (preg_match($pattern, $message, $matches)) { $docref["\x6d\145\x73\163\141\x67\145"] = preg_replace($pattern, '', $message, 1); $docref["\165\162\x6c"] = $matches[1]; } return $docref; } public function hasPreviousException() { return $this->previousExceptionInspector || $this->exception->getPrevious(); } public function getPreviousExceptionInspector() { if ($this->previousExceptionInspector === null) { $previousException = $this->exception->getPrevious(); if ($previousException) { $this->previousExceptionInspector = $this->inspectorFactory->create($previousException); } } return $this->previousExceptionInspector; } public function getPreviousExceptions() { if ($this->previousExceptions === null) { $this->previousExceptions = array(); $prev = $this->exception->getPrevious(); while ($prev !== null) { $this->previousExceptions[] = $prev; $prev = $prev->getPrevious(); } } return $this->previousExceptions; } public function getFrames(array $frameFilters = array()) { if ($this->frames === null) { $frames = $this->getTrace($this->exception); foreach ($frames as $k => $frame) { if (empty($frame["\146\151\x6c\145"])) { $file = "\133\x69\156\164\x65\x72\156\x61\154\135"; $line = 0; $next_frame = !empty($frames[$k + 1]) ? $frames[$k + 1] : array(); if ($this->isValidNextFrame($next_frame)) { $file = $next_frame["\x66\151\154\145"]; $line = $next_frame["\x6c\151\156\145"]; } $frames[$k]["\x66\x69\x6c\145"] = $file; $frames[$k]["\154\151\x6e\x65"] = $line; } } $i = 0; foreach ($frames as $k => $frame) { if ($frame["\x66\x69\x6c\x65"] == $this->exception->getFile() && $frame["\154\x69\x6e\145"] == $this->exception->getLine()) { $i = $k; } } if ($i > 0) { array_splice($frames, 0, $i); } $firstFrame = $this->getFrameFromException($this->exception); array_unshift($frames, $firstFrame); $this->frames = new FrameCollection($frames); if ($previousInspector = $this->getPreviousExceptionInspector()) { $outerFrames = $this->frames; $newFrames = clone $previousInspector->getFrames(); if (isset($newFrames[0])) { $newFrames[0]->addComment($previousInspector->getExceptionMessage(), "\105\x78\x63\x65\x70\x74\x69\157\156\40\x6d\145\163\163\141\x67\145\72"); } $newFrames->prependFrames($outerFrames->topDiff($newFrames)); $this->frames = $newFrames; } if (!empty($frameFilters)) { foreach ($frameFilters as $filterCallback) { $this->frames->filter($filterCallback); } } } return $this->frames; } protected function getTrace($e) { $traces = $e->getTrace(); if (!$e instanceof \ErrorException) { return $traces; } if (!Misc::isLevelFatal($e->getSeverity())) { return $traces; } if (!extension_loaded("\x78\x64\x65\142\x75\x67") || !function_exists("\170\144\x65\142\165\147\x5f\x69\163\137\x65\x6e\141\x62\x6c\145\144") || !xdebug_is_enabled()) { return $traces; } $stack = array_reverse(xdebug_get_function_stack()); $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); $traces = array_diff_key($stack, $trace); return $traces; } protected function getFrameFromException($exception) { return array("\x66\151\154\145" => $exception->getFile(), "\154\151\156\145" => $exception->getLine(), "\143\x6c\141\163\x73" => get_class($exception), "\141\162\147\163" => array($exception->getMessage())); } protected function getFrameFromError(ErrorException $exception) { return array("\146\x69\154\145" => $exception->getFile(), "\154\151\156\x65" => $exception->getLine(), "\143\154\141\163\x73" => null, "\x61\162\147\163" => array()); } protected function isValidNextFrame(array $frame) { if (empty($frame["\146\151\154\145"])) { return false; } if (empty($frame["\154\x69\x6e\x65"])) { return false; } if (empty($frame["\146\x75\156\x63\x74\x69\x6f\x6e"]) || !stristr($frame["\146\x75\x6e\x63\164\x69\x6f\156"], "\143\141\x6c\x6c\x5f\165\163\145\162\137\146\165\156\143")) { return false; } return true; } }

Function Calls

None

Variables

None

Stats

MD5 11901548e91569ae792e58724753b942
Eval Count 0
Decode Time 101 ms