ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Whoops\Handler\PrettyPageHandler Class Reference
+ Inheritance diagram for Whoops\Handler\PrettyPageHandler:
+ Collaboration diagram for Whoops\Handler\PrettyPageHandler:

Public Member Functions

 __construct ()
 Constructor. More...
 
 handle ()
 
 contentType ()
 
 addDataTable ($label, array $data)
 Adds an entry to the list of tables displayed in the template. More...
 
 addDataTableCallback ($label, $callback)
 Lazily adds an entry to the list of tables displayed in the table. More...
 
 getDataTables ($label=null)
 Returns all the extra data tables registered with this handler. More...
 
 handleUnconditionally ($value=null)
 Allows to disable all attempts to dynamically decide whether to handle or return prematurely. More...
 
 addEditor ($identifier, $resolver)
 
 setEditor ($editor)
 
 getEditorHref ($filePath, $line)
 Given a string file path, and an integer file line, executes the editor resolver and returns, if available, a string that may be used as the href property for that file reference. More...
 
 getEditorAjax ($filePath, $line)
 Given a boolean if the editor link should act as an Ajax request. More...
 
 setPageTitle ($title)
 
 getPageTitle ()
 
 addResourcePath ($path)
 Adds a path to the list of paths to be searched for resources. More...
 
 addCustomCss ($name)
 Adds a custom css file to be loaded. More...
 
 getResourcePaths ()
 
 getResourcesPath ()
 
 setResourcesPath ($resourcesPath)
 
 getApplicationPaths ()
 Return the application paths. More...
 
 setApplicationPaths ($applicationPaths)
 Set the application paths. More...
 
 setApplicationRootPath ($applicationRootPath)
 Set the application root path. More...
 
 blacklist ($superGlobalName, $key)
 blacklist a sensitive value within one of the superglobal arrays. More...
 
- Public Member Functions inherited from Whoops\Handler\Handler
 setRun (RunInterface $run)
 
 setInspector (Inspector $inspector)
 
 setException ($exception)
 

Data Fields

 textmate
 
- Data Fields inherited from Whoops\Handler\Handler
const DONE = 0x10
 
const LAST_HANDLER = 0x20
 The Handler has handled the Throwable in some way, and wishes to skip any other Handler. More...
 
const QUIT = 0x30
 The Handler has handled the Throwable in some way, and wishes to quit/stop execution. More...
 

Protected Member Functions

 getExceptionFrames ()
 Get the stack trace frames of the exception that is currently being handled. More...
 
 getExceptionCode ()
 Get the code of the exception that is currently being handled. More...
 
 getEditor ($filePath, $line)
 Given a boolean if the editor link should act as an Ajax request. More...
 
 getResource ($resource)
 Finds a resource, by its relative path, in all available search paths. More...
 
- Protected Member Functions inherited from Whoops\Handler\Handler
 getRun ()
 
 getInspector ()
 
 getException ()
 

Protected Attributes

 $editor
 
 $editors
 

Private Member Functions

 masked (array $superGlobal, $superGlobalName)
 Checks all values within the given superGlobal array. More...
 

Private Attributes

 $searchPaths = []
 
 $resourceCache = []
 
 $customCss = null
 
 $extraTables = []
 
 $handleUnconditionally = false
 
 $pageTitle = "Whoops! There was an error."
 
 $applicationPaths
 
 $blacklist
 
 $templateHelper
 

Detailed Description

Definition at line 18 of file PrettyPageHandler.php.

Constructor & Destructor Documentation

◆ __construct()

Whoops\Handler\PrettyPageHandler::__construct ( )

Constructor.

Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 109 of file PrettyPageHandler.php.

References $file, and Whoops\Handler\PrettyPageHandler\blacklist().

110  {
111  if (ini_get('xdebug.file_link_format') || extension_loaded('xdebug')) {
112  // Register editor using xdebug's file_link_format option.
113  $this->editors['xdebug'] = function ($file, $line) {
114  return str_replace(['%f', '%l'], [$file, $line], ini_get('xdebug.file_link_format'));
115  };
116  }
117 
118  // Add the default, local resource search path:
119  $this->searchPaths[] = __DIR__ . "/../Resources";
120 
121  // blacklist php provided auth based values
122  $this->blacklist('_SERVER', 'PHP_AUTH_PW');
123 
124  $this->templateHelper = new TemplateHelper();
125 
126  if (class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) {
127  $cloner = new VarCloner();
128  // Only dump object internals if a custom caster exists.
129  $cloner->addCasters(['*' => function ($obj, $a, $stub, $isNested, $filter = 0) {
130  $class = $stub->class;
131  $classes = [$class => $class] + class_parents($class) + class_implements($class);
132 
133  foreach ($classes as $class) {
134  if (isset(AbstractCloner::$defaultCasters[$class])) {
135  return $a;
136  }
137  }
138 
139  // Remove all internals
140  return [];
141  }]);
142  $this->templateHelper->setCloner($cloner);
143  }
144  }
blacklist($superGlobalName, $key)
blacklist a sensitive value within one of the superglobal arrays.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomCss()

Whoops\Handler\PrettyPageHandler::addCustomCss (   $name)

Adds a custom css file to be loaded.

Parameters
string$name
Returns
void
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 568 of file PrettyPageHandler.php.

References $name.

569  {
570  $this->customCss = $name;
571  }
if($format !==null) $name
Definition: metadata.php:146

◆ addDataTable()

Whoops\Handler\PrettyPageHandler::addDataTable (   $label,
array  $data 
)

Adds an entry to the list of tables displayed in the template.

The expected data is a simple associative array. Any nested arrays will be flattened with print_r

Parameters
string$label
array$data
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 310 of file PrettyPageHandler.php.

References $data.

311  {
312  $this->extraTables[$label] = $data;
313  }

◆ addDataTableCallback()

Whoops\Handler\PrettyPageHandler::addDataTableCallback (   $label,
  $callback 
)

Lazily adds an entry to the list of tables displayed in the table.

The supplied callback argument will be called when the error is rendered, it should produce a simple associative array. Any nested arrays will be flattened with print_r.

Exceptions
InvalidArgumentExceptionIf $callback is not callable
Parameters
string$label
callable$callbackCallable returning an associative array
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 325 of file PrettyPageHandler.php.

References Whoops\Handler\Handler\$inspector, and $result.

326  {
327  if (!is_callable($callback)) {
328  throw new InvalidArgumentException('Expecting callback argument to be callable');
329  }
330 
331  $this->extraTables[$label] = function (\Whoops\Exception\Inspector $inspector = null) use ($callback) {
332  try {
333  $result = call_user_func($callback, $inspector);
334 
335  // Only return the result if it can be iterated over by foreach().
336  return is_array($result) || $result instanceof \Traversable ? $result : [];
337  } catch (\Exception $e) {
338  // Don't allow failure to break the rendering of the original exception.
339  return [];
340  }
341  };
342  }
$result

◆ addEditor()

Whoops\Handler\PrettyPageHandler::addEditor (   $identifier,
  $resolver 
)
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 393 of file PrettyPageHandler.php.

394  {
395  $this->editors[$identifier] = $resolver;
396  }

◆ addResourcePath()

Whoops\Handler\PrettyPageHandler::addResourcePath (   $path)

Adds a path to the list of paths to be searched for resources.

Exceptions
InvalidArgumentExceptionIf $path is not a valid directory
Parameters
string$path
Returns
void
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 551 of file PrettyPageHandler.php.

References $path.

Referenced by Whoops\Handler\PrettyPageHandler\setResourcesPath().

552  {
553  if (!is_dir($path)) {
554  throw new InvalidArgumentException(
555  "'$path' is not a valid directory"
556  );
557  }
558 
559  array_unshift($this->searchPaths, $path);
560  }
+ Here is the caller graph for this function:

◆ blacklist()

Whoops\Handler\PrettyPageHandler::blacklist (   $superGlobalName,
  $key 
)

blacklist a sensitive value within one of the superglobal arrays.

Parameters
$superGlobalNamestring the name of the superglobal array, e.g. '_GET'
$keystring the key within the superglobal
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 679 of file PrettyPageHandler.php.

References $key.

Referenced by Whoops\Handler\PrettyPageHandler\__construct(), and Whoops\Handler\PrettyPageHandler\masked().

680  {
681  $this->blacklist[$superGlobalName][] = $key;
682  }
blacklist($superGlobalName, $key)
blacklist a sensitive value within one of the superglobal arrays.
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ contentType()

Whoops\Handler\PrettyPageHandler::contentType ( )
Returns
string
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 298 of file PrettyPageHandler.php.

299  {
300  return 'text/html';
301  }

◆ getApplicationPaths()

Whoops\Handler\PrettyPageHandler::getApplicationPaths ( )

◆ getDataTables()

Whoops\Handler\PrettyPageHandler::getDataTables (   $label = null)

Returns all the extra data tables registered with this handler.

Optionally accepts a 'label' parameter, to only return the data table under that label.

Parameters
string | null$label
Returns
array[]|callable
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 351 of file PrettyPageHandler.php.

References Whoops\Handler\PrettyPageHandler\$extraTables.

Referenced by Whoops\Handler\PrettyPageHandler\handle().

352  {
353  if ($label !== null) {
354  return isset($this->extraTables[$label]) ?
355  $this->extraTables[$label] : [];
356  }
357 
358  return $this->extraTables;
359  }
+ Here is the caller graph for this function:

◆ getEditor()

Whoops\Handler\PrettyPageHandler::getEditor (   $filePath,
  $line 
)
protected

Given a boolean if the editor link should act as an Ajax request.

The editor must be a valid callable function/closure

Parameters
string$filePath
int$line
Returns
array
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 489 of file PrettyPageHandler.php.

References Whoops\Handler\PrettyPageHandler\$editor.

Referenced by Whoops\Handler\PrettyPageHandler\getEditorAjax(), and Whoops\Handler\PrettyPageHandler\getEditorHref().

490  {
491  if (!$this->editor || (!is_string($this->editor) && !is_callable($this->editor))) {
492  return [];
493  }
494 
495  if (is_string($this->editor) && isset($this->editors[$this->editor]) && !is_callable($this->editors[$this->editor])) {
496  return [
497  'ajax' => false,
498  'url' => $this->editors[$this->editor],
499  ];
500  }
501 
502  if (is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) {
503  if (is_callable($this->editor)) {
504  $callback = call_user_func($this->editor, $filePath, $line);
505  } else {
506  $callback = call_user_func($this->editors[$this->editor], $filePath, $line);
507  }
508 
509  if (is_string($callback)) {
510  return [
511  'ajax' => false,
512  'url' => $callback,
513  ];
514  }
515 
516  return [
517  'ajax' => isset($callback['ajax']) ? $callback['ajax'] : false,
518  'url' => isset($callback['url']) ? $callback['url'] : $callback,
519  ];
520  }
521 
522  return [];
523  }
+ Here is the caller graph for this function:

◆ getEditorAjax()

Whoops\Handler\PrettyPageHandler::getEditorAjax (   $filePath,
  $line 
)

Given a boolean if the editor link should act as an Ajax request.

The editor must be a valid callable function/closure

Exceptions
UnexpectedValueExceptionIf editor resolver does not return a boolean
Parameters
string$filePath
int$line
Returns
bool
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 467 of file PrettyPageHandler.php.

References Whoops\Handler\PrettyPageHandler\$editor, and Whoops\Handler\PrettyPageHandler\getEditor().

468  {
469  $editor = $this->getEditor($filePath, $line);
470 
471  // Check that the ajax is a bool
472  if (!isset($editor['ajax']) || !is_bool($editor['ajax'])) {
473  throw new UnexpectedValueException(
474  __METHOD__ . " should always resolve to a bool; got something else instead."
475  );
476  }
477  return $editor['ajax'];
478  }
getEditor($filePath, $line)
Given a boolean if the editor link should act as an Ajax request.
+ Here is the call graph for this function:

◆ getEditorHref()

Whoops\Handler\PrettyPageHandler::getEditorHref (   $filePath,
  $line 
)

Given a string file path, and an integer file line, executes the editor resolver and returns, if available, a string that may be used as the href property for that file reference.

Exceptions
InvalidArgumentExceptionIf editor resolver does not return a string
Parameters
string$filePath
int$line
Returns
string|bool
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 435 of file PrettyPageHandler.php.

References Whoops\Handler\PrettyPageHandler\$editor, and Whoops\Handler\PrettyPageHandler\getEditor().

436  {
437  $editor = $this->getEditor($filePath, $line);
438 
439  if (empty($editor)) {
440  return false;
441  }
442 
443  // Check that the editor is a string, and replace the
444  // %line and %file placeholders:
445  if (!isset($editor['url']) || !is_string($editor['url'])) {
446  throw new UnexpectedValueException(
447  __METHOD__ . " should always resolve to a string or a valid editor array; got something else instead."
448  );
449  }
450 
451  $editor['url'] = str_replace("%line", rawurlencode($line), $editor['url']);
452  $editor['url'] = str_replace("%file", rawurlencode($filePath), $editor['url']);
453 
454  return $editor['url'];
455  }
getEditor($filePath, $line)
Given a boolean if the editor link should act as an Ajax request.
+ Here is the call graph for this function:

◆ getExceptionCode()

Whoops\Handler\PrettyPageHandler::getExceptionCode ( )
protected

Get the code of the exception that is currently being handled.

Returns
string
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 282 of file PrettyPageHandler.php.

References $code, Whoops\Handler\Handler\$exception, Whoops\Handler\Handler\getException(), and Whoops\Util\Misc\translateErrorCode().

Referenced by Whoops\Handler\PrettyPageHandler\handle().

283  {
284  $exception = $this->getException();
285 
286  $code = $exception->getCode();
287  if ($exception instanceof \ErrorException) {
288  // ErrorExceptions wrap the php-error types within the 'severity' property
289  $code = Misc::translateErrorCode($exception->getSeverity());
290  }
291 
292  return (string) $code;
293  }
static translateErrorCode($error_code)
Translate ErrorException code into the represented constant.
Definition: Misc.php:48
$code
Definition: example_050.php:99
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExceptionFrames()

Whoops\Handler\PrettyPageHandler::getExceptionFrames ( )
protected

Get the stack trace frames of the exception that is currently being handled.

Returns
;
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 259 of file PrettyPageHandler.php.

References $path, Whoops\Handler\PrettyPageHandler\getApplicationPaths(), and Whoops\Handler\Handler\getInspector().

Referenced by Whoops\Handler\PrettyPageHandler\handle().

260  {
261  $frames = $this->getInspector()->getFrames();
262 
263  if ($this->getApplicationPaths()) {
264  foreach ($frames as $frame) {
265  foreach ($this->getApplicationPaths() as $path) {
266  if (strpos($frame->getFile(), $path) === 0) {
267  $frame->setApplication(true);
268  break;
269  }
270  }
271  }
272  }
273 
274  return $frames;
275  }
getApplicationPaths()
Return the application paths.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageTitle()

Whoops\Handler\PrettyPageHandler::getPageTitle ( )

◆ getResource()

Whoops\Handler\PrettyPageHandler::getResource (   $resource)
protected

Finds a resource, by its relative path, in all available search paths.

The search is performed starting at the last search path, and all the way back to the first, enabling a cascading-type system of overrides for all resources.

Exceptions
RuntimeExceptionIf resource cannot be found in any of the available paths
Parameters
string$resource
Returns
string
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 592 of file PrettyPageHandler.php.

References $path.

Referenced by Whoops\Handler\PrettyPageHandler\handle().

593  {
594  // If the resource was found before, we can speed things up
595  // by caching its absolute, resolved path:
596  if (isset($this->resourceCache[$resource])) {
597  return $this->resourceCache[$resource];
598  }
599 
600  // Search through available search paths, until we find the
601  // resource we're after:
602  foreach ($this->searchPaths as $path) {
603  $fullPath = $path . "/$resource";
604 
605  if (is_file($fullPath)) {
606  // Cache the result:
607  $this->resourceCache[$resource] = $fullPath;
608  return $fullPath;
609  }
610  }
611 
612  // If we got this far, nothing was found.
613  throw new RuntimeException(
614  "Could not find resource '$resource' in any resource paths."
615  . "(searched: " . join(", ", $this->searchPaths). ")"
616  );
617  }
+ Here is the caller graph for this function:

◆ getResourcePaths()

Whoops\Handler\PrettyPageHandler::getResourcePaths ( )

◆ getResourcesPath()

Whoops\Handler\PrettyPageHandler::getResourcesPath ( )
Deprecated:
Returns
string
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 624 of file PrettyPageHandler.php.

References Whoops\Handler\PrettyPageHandler\getResourcePaths().

625  {
626  $allPaths = $this->getResourcePaths();
627 
628  // Compat: return only the first path added
629  return end($allPaths) ?: null;
630  }
+ Here is the call graph for this function:

◆ handle()

Whoops\Handler\PrettyPageHandler::handle ( )
Returns
int|null

Implements Whoops\Handler\HandlerInterface.

Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 149 of file PrettyPageHandler.php.

References $_COOKIE, $_GET, $_POST, $_SERVER, $_SESSION, $code, Whoops\Handler\PrettyPageHandler\$extraTables, Whoops\Handler\Handler\$inspector, $table, Whoops\Handler\Handler\DONE, Whoops\Exception\Formatter\formatExceptionPlain(), Whoops\Handler\PrettyPageHandler\getApplicationPaths(), Whoops\Handler\PrettyPageHandler\getDataTables(), Whoops\Handler\Handler\getException(), Whoops\Handler\PrettyPageHandler\getExceptionCode(), Whoops\Handler\PrettyPageHandler\getExceptionFrames(), Whoops\Handler\Handler\getInspector(), Whoops\Handler\PrettyPageHandler\getPageTitle(), Whoops\Handler\PrettyPageHandler\getResource(), Whoops\Handler\Handler\getRun(), Whoops\Handler\PrettyPageHandler\handleUnconditionally(), Whoops\Handler\PrettyPageHandler\masked(), and Whoops\Handler\Handler\QUIT.

150  {
151  if (!$this->handleUnconditionally()) {
152  // Check conditions for outputting HTML:
153  // @todo: Make this more robust
154  if (PHP_SAPI === 'cli') {
155  // Help users who have been relying on an internal test value
156  // fix their code to the proper method
157  if (isset($_ENV['whoops-test'])) {
158  throw new \Exception(
159  'Use handleUnconditionally instead of whoops-test'
160  .' environment variable'
161  );
162  }
163 
164  return Handler::DONE;
165  }
166  }
167 
168  $templateFile = $this->getResource("views/layout.html.php");
169  $cssFile = $this->getResource("css/whoops.base.css");
170  $zeptoFile = $this->getResource("js/zepto.min.js");
171  $prettifyFile = $this->getResource("js/prettify.min.js");
172  $clipboard = $this->getResource("js/clipboard.min.js");
173  $jsFile = $this->getResource("js/whoops.base.js");
174 
175  if ($this->customCss) {
176  $customCssFile = $this->getResource($this->customCss);
177  }
178 
179  $inspector = $this->getInspector();
180  $frames = $this->getExceptionFrames();
181  $code = $this->getExceptionCode();
182 
183  // List of variables that will be passed to the layout template.
184  $vars = [
185  "page_title" => $this->getPageTitle(),
186 
187  // @todo: Asset compiler
188  "stylesheet" => file_get_contents($cssFile),
189  "zepto" => file_get_contents($zeptoFile),
190  "prettify" => file_get_contents($prettifyFile),
191  "clipboard" => file_get_contents($clipboard),
192  "javascript" => file_get_contents($jsFile),
193 
194  // Template paths:
195  "header" => $this->getResource("views/header.html.php"),
196  "header_outer" => $this->getResource("views/header_outer.html.php"),
197  "frame_list" => $this->getResource("views/frame_list.html.php"),
198  "frames_description" => $this->getResource("views/frames_description.html.php"),
199  "frames_container" => $this->getResource("views/frames_container.html.php"),
200  "panel_details" => $this->getResource("views/panel_details.html.php"),
201  "panel_details_outer" => $this->getResource("views/panel_details_outer.html.php"),
202  "panel_left" => $this->getResource("views/panel_left.html.php"),
203  "panel_left_outer" => $this->getResource("views/panel_left_outer.html.php"),
204  "frame_code" => $this->getResource("views/frame_code.html.php"),
205  "env_details" => $this->getResource("views/env_details.html.php"),
206 
207  "title" => $this->getPageTitle(),
208  "name" => explode("\\", $inspector->getExceptionName()),
209  "message" => $inspector->getExceptionMessage(),
210  "docref_url" => $inspector->getExceptionDocrefUrl(),
211  "code" => $code,
212  "plain_exception" => Formatter::formatExceptionPlain($inspector),
213  "frames" => $frames,
214  "has_frames" => !!count($frames),
215  "handler" => $this,
216  "handlers" => $this->getRun()->getHandlers(),
217 
218  "active_frames_tab" => count($frames) && $frames->offsetGet(0)->isApplication() ? 'application' : 'all',
219  "has_frames_tabs" => $this->getApplicationPaths(),
220 
221  "tables" => [
222  "GET Data" => $this->masked($_GET, '_GET'),
223  "POST Data" => $this->masked($_POST, '_POST'),
224  "Files" => isset($_FILES) ? $this->masked($_FILES, '_FILES') : [],
225  "Cookies" => $this->masked($_COOKIE, '_COOKIE'),
226  "Session" => isset($_SESSION) ? $this->masked($_SESSION, '_SESSION') : [],
227  "Server/Request Data" => $this->masked($_SERVER, '_SERVER'),
228  "Environment Variables" => $this->masked($_ENV, '_ENV'),
229  ],
230  ];
231 
232  if (isset($customCssFile)) {
233  $vars["stylesheet"] .= file_get_contents($customCssFile);
234  }
235 
236  // Add extra entries list of data tables:
237  // @todo: Consolidate addDataTable and addDataTableCallback
238  $extraTables = array_map(function ($table) use ($inspector) {
239  return $table instanceof \Closure ? $table($inspector) : $table;
240  }, $this->getDataTables());
241  $vars["tables"] = array_merge($extraTables, $vars["tables"]);
242 
243  $plainTextHandler = new PlainTextHandler();
244  $plainTextHandler->setException($this->getException());
245  $plainTextHandler->setInspector($this->getInspector());
246  $vars["preface"] = "<!--\n\n\n" . $this->templateHelper->escape($plainTextHandler->generateResponse()) . "\n\n\n\n\n\n\n\n\n\n\n-->";
247 
248  $this->templateHelper->setVariables($vars);
249  $this->templateHelper->render($templateFile);
250 
251  return Handler::QUIT;
252  }
$_COOKIE['client_id']
Definition: server.php:9
getExceptionFrames()
Get the stack trace frames of the exception that is currently being handled.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$_SESSION["AccountId"]
$_GET["client_id"]
$code
Definition: example_050.php:99
masked(array $superGlobal, $superGlobalName)
Checks all values within the given superGlobal array.
getExceptionCode()
Get the code of the exception that is currently being handled.
handleUnconditionally($value=null)
Allows to disable all attempts to dynamically decide whether to handle or return prematurely.
getDataTables($label=null)
Returns all the extra data tables registered with this handler.
static formatExceptionPlain(Inspector $inspector)
Definition: Formatter.php:49
getResource($resource)
Finds a resource, by its relative path, in all available search paths.
const QUIT
The Handler has handled the Throwable in some way, and wishes to quit/stop execution.
Definition: Handler.php:31
getApplicationPaths()
Return the application paths.
if(empty($password)) $table
Definition: pwgen.php:24
$_POST["username"]
+ Here is the call graph for this function:

◆ handleUnconditionally()

Whoops\Handler\PrettyPageHandler::handleUnconditionally (   $value = null)

Allows to disable all attempts to dynamically decide whether to handle or return prematurely.

Set this to ensure that the handler will perform no matter what.

Parameters
bool | null$value
Returns
bool|null
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 368 of file PrettyPageHandler.php.

References Whoops\Handler\PrettyPageHandler\$handleUnconditionally.

Referenced by Whoops\Handler\PrettyPageHandler\handle().

369  {
370  if (func_num_args() == 0) {
372  }
373 
374  $this->handleUnconditionally = (bool) $value;
375  }
handleUnconditionally($value=null)
Allows to disable all attempts to dynamically decide whether to handle or return prematurely.
+ Here is the caller graph for this function:

◆ masked()

Whoops\Handler\PrettyPageHandler::masked ( array  $superGlobal,
  $superGlobalName 
)
private

Checks all values within the given superGlobal array.

Blacklisted values will be replaced by a equal length string cointaining only '*' characters.

We intentionally dont rely on $GLOBALS as it depends on 'auto_globals_jit' php.ini setting.

Parameters
$superGlobalarray One of the superglobal arrays
$superGlobalNamestring the name of the superglobal array, e.g. '_GET'
Returns
array $values without sensitive data
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 694 of file PrettyPageHandler.php.

References $key, and Whoops\Handler\PrettyPageHandler\blacklist().

Referenced by Whoops\Handler\PrettyPageHandler\handle().

695  {
696  $blacklisted = $this->blacklist[$superGlobalName];
697 
698  $values = $superGlobal;
699  foreach ($blacklisted as $key) {
700  if (isset($superGlobal[$key])) {
701  $values[$key] = str_repeat('*', strlen($superGlobal[$key]));
702  }
703  }
704  return $values;
705  }
blacklist($superGlobalName, $key)
blacklist a sensitive value within one of the superglobal arrays.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setApplicationPaths()

Whoops\Handler\PrettyPageHandler::setApplicationPaths (   $applicationPaths)

Set the application paths.

Parameters
array$applicationPaths
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 658 of file PrettyPageHandler.php.

References Whoops\Handler\PrettyPageHandler\$applicationPaths.

659  {
660  $this->applicationPaths = $applicationPaths;
661  }

◆ setApplicationRootPath()

Whoops\Handler\PrettyPageHandler::setApplicationRootPath (   $applicationRootPath)

Set the application root path.

Parameters
string$applicationRootPath
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 668 of file PrettyPageHandler.php.

669  {
670  $this->templateHelper->setApplicationRootPath($applicationRootPath);
671  }

◆ setEditor()

Whoops\Handler\PrettyPageHandler::setEditor (   $editor)
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 412 of file PrettyPageHandler.php.

References Whoops\Handler\PrettyPageHandler\$editor.

413  {
414  if (!is_callable($editor) && !isset($this->editors[$editor])) {
415  throw new InvalidArgumentException(
416  "Unknown editor identifier: $editor. Known editors:" .
417  implode(",", array_keys($this->editors))
418  );
419  }
420 
421  $this->editor = $editor;
422  }

◆ setPageTitle()

Whoops\Handler\PrettyPageHandler::setPageTitle (   $title)
Parameters
string$title
Returns
void
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 529 of file PrettyPageHandler.php.

References $title, and string.

530  {
531  $this->pageTitle = (string) $title;
532  }
Add rich text string

◆ setResourcesPath()

Whoops\Handler\PrettyPageHandler::setResourcesPath (   $resourcesPath)
Deprecated:
Parameters
string$resourcesPath
Returns
void
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 638 of file PrettyPageHandler.php.

References Whoops\Handler\PrettyPageHandler\addResourcePath().

639  {
640  $this->addResourcePath($resourcesPath);
641  }
addResourcePath($path)
Adds a path to the list of paths to be searched for resources.
+ Here is the call graph for this function:

Field Documentation

◆ $applicationPaths

◆ $blacklist

Whoops\Handler\PrettyPageHandler::$blacklist
private

◆ $customCss

Whoops\Handler\PrettyPageHandler::$customCss = null
private

◆ $editor

◆ $editors

Whoops\Handler\PrettyPageHandler::$editors
protected
Initial value:
= [
"sublime" => "subl://open?url=file://%file&line=%line"
Examples:
/usr/local/src/ilias/release_5-3/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 91 of file PrettyPageHandler.php.

◆ $extraTables

◆ $handleUnconditionally

Whoops\Handler\PrettyPageHandler::$handleUnconditionally = false
private

◆ $pageTitle

Whoops\Handler\PrettyPageHandler::$pageTitle = "Whoops! There was an error."
private

◆ $resourceCache

Whoops\Handler\PrettyPageHandler::$resourceCache = []
private

◆ $searchPaths

◆ $templateHelper

Whoops\Handler\PrettyPageHandler::$templateHelper
private

◆ textmate

Whoops\Handler\PrettyPageHandler::textmate
Initial value:
=> "txmt://open?url=file://%file&line=%line",
"emacs" => "emacs://open?url=file://%file&line=%line",
"macvim" => "mvim://open/?url=file://%file&line=%line",
"phpstorm" => "phpstorm://open?file=%file&line=%line",
"idea" => "idea://open?file=%file&line=%line",
"vscode" => "vscode://file/%file:%line",
]

Definition at line 93 of file PrettyPageHandler.php.


The documentation for this class was generated from the following file: