|
1 | 1 | <h1>A 404 error occurred</h1> |
2 | 2 | <h2><?= $this->message ?></h2> |
3 | 3 |
|
4 | | -<?php if (isset($this->reason) && $this->reason): ?> |
5 | | - |
6 | | -<?php |
7 | | -$reasonMessage= ''; |
8 | | -switch ($this->reason) { |
9 | | - case 'error-controller-cannot-dispatch': |
10 | | - $reasonMessage = 'The requested controller was unable to dispatch the request.'; |
11 | | - break; |
12 | | - case 'error-controller-not-found': |
13 | | - $reasonMessage = 'The requested controller could not be mapped to an existing controller class.'; |
14 | | - break; |
15 | | - case 'error-controller-invalid': |
16 | | - $reasonMessage = 'The requested controller was not dispatchable.'; |
17 | | - break; |
18 | | - case 'error-router-no-match': |
19 | | - $reasonMessage = 'The requested URL could not be matched by routing.'; |
20 | | - break; |
21 | | - default: |
22 | | - $reasonMessage = 'We cannot determine at this time why a 404 was generated.'; |
23 | | - break; |
24 | | -} |
25 | | -?> |
26 | | - |
| 4 | +<?php if (! empty($this->reason)) : ?> |
| 5 | + <?php |
| 6 | + switch ($this->reason) { |
| 7 | + case \Zend\Mvc\Application::ERROR_CONTROLLER_CANNOT_DISPATCH: |
| 8 | + $reasonMessage = 'The requested controller was unable to dispatch the request.'; |
| 9 | + break; |
| 10 | + case \Zend\Mvc\Application::ERROR_MIDDLEWARE_CANNOT_DISPATCH: |
| 11 | + $reasonMessage = 'The requested middleware was unable to dispatch the request.'; |
| 12 | + break; |
| 13 | + case \Zend\Mvc\Application::ERROR_CONTROLLER_NOT_FOUND: |
| 14 | + $reasonMessage = 'The requested controller could not be mapped to an existing controller class.'; |
| 15 | + break; |
| 16 | + case \Zend\Mvc\Application::ERROR_CONTROLLER_INVALID: |
| 17 | + $reasonMessage = 'The requested controller was not dispatchable.'; |
| 18 | + break; |
| 19 | + case \Zend\Mvc\Application::ERROR_ROUTER_NO_MATCH: |
| 20 | + $reasonMessage = 'The requested URL could not be matched by routing.'; |
| 21 | + break; |
| 22 | + default: |
| 23 | + $reasonMessage = 'We cannot determine at this time why a 404 was generated.'; |
| 24 | + break; |
| 25 | + } |
| 26 | + ?> |
27 | 27 | <p><?= $reasonMessage ?></p> |
28 | | - |
29 | 28 | <?php endif ?> |
30 | 29 |
|
31 | | -<?php if (isset($this->controller) && $this->controller): ?> |
32 | | - |
| 30 | +<?php if (! empty($this->controller)) : ?> |
33 | 31 | <dl> |
34 | 32 | <dt>Controller:</dt> |
35 | | - <dd><?= $this->escapeHtml($this->controller) ?> |
36 | | -<?php |
37 | | -if (isset($this->controller_class) |
38 | | - && $this->controller_class |
39 | | - && $this->controller_class != $this->controller |
40 | | -) { |
41 | | - echo '(' . sprintf('resolves to %s', $this->escapeHtml($this->controller_class)) . ')'; |
42 | | -} |
43 | | -?> |
44 | | -</dd> |
| 33 | + <dd> |
| 34 | + <?= $this->escapeHtml($this->controller) ?> |
| 35 | + <?php |
| 36 | + if (! empty($this->controller_class) && $this->controller_class != $this->controller) { |
| 37 | + printf('(resolves to %s)', $this->escapeHtml($this->controller_class)); |
| 38 | + } |
| 39 | + ?> |
| 40 | + </dd> |
45 | 41 | </dl> |
46 | | - |
47 | 42 | <?php endif ?> |
48 | 43 |
|
49 | | -<?php if (isset($this->display_exceptions) && $this->display_exceptions): ?> |
50 | | - |
51 | | -<?php if(isset($this->exception) && ($this->exception instanceof Exception || $this->exception instanceof Error)): ?> |
| 44 | +<?php if (! empty($this->display_exceptions)) : ?> |
| 45 | + <?php if (isset($this->exception) && ($this->exception instanceof \Exception || $this->exception instanceof \Error)) : ?> |
52 | 46 | <hr/> |
| 47 | + |
53 | 48 | <h2>Additional information:</h2> |
54 | 49 | <h3><?= get_class($this->exception) ?></h3> |
55 | 50 | <dl> |
56 | 51 | <dt>File:</dt> |
57 | 52 | <dd> |
58 | | - <pre class="prettyprint linenums"><?= $this->exception->getFile() ?>:<?= $this->exception->getLine() ?></pre> |
| 53 | + <pre><?= $this->exception->getFile() ?>:<?= $this->exception->getLine() ?></pre> |
59 | 54 | </dd> |
60 | 55 | <dt>Message:</dt> |
61 | 56 | <dd> |
62 | | - <pre class="prettyprint linenums"><?= $this->exception->getMessage() ?></pre> |
| 57 | + <pre><?= $this->escapeHtml($this->exception->getMessage()) ?></pre> |
63 | 58 | </dd> |
64 | 59 | <dt>Stack trace:</dt> |
65 | 60 | <dd> |
66 | | - <pre class="prettyprint linenums"><?= $this->exception->getTraceAsString() ?></pre> |
| 61 | + <pre><?= $this->escapeHtml($this->exception->getTraceAsString()) ?></pre> |
67 | 62 | </dd> |
68 | 63 | </dl> |
69 | | -<?php |
70 | | - $e = $this->exception->getPrevious(); |
71 | | - $icount = 0; |
72 | | - if ($e) : |
73 | | -?> |
| 64 | + |
| 65 | + <?php if ($ex = $this->exception->getPrevious()) : ?> |
74 | 66 | <hr/> |
| 67 | + |
75 | 68 | <h2>Previous exceptions:</h2> |
76 | | -<ul class="unstyled"> |
77 | | - <?php while($e) : ?> |
| 69 | +<ul class="list-unstyled"> |
| 70 | + <?php $icount = 0 ?> |
| 71 | + <?php while ($ex) : ?> |
78 | 72 | <li> |
79 | | - <h3><?= get_class($e) ?></h3> |
| 73 | + <h3><?= get_class($ex) ?></h3> |
80 | 74 | <dl> |
81 | 75 | <dt>File:</dt> |
82 | 76 | <dd> |
83 | | - <pre class="prettyprint linenums"><?= $e->getFile() ?>:<?= $e->getLine() ?></pre> |
| 77 | + <pre><?= $ex->getFile() ?>:<?= $ex->getLine() ?></pre> |
84 | 78 | </dd> |
85 | 79 | <dt>Message:</dt> |
86 | 80 | <dd> |
87 | | - <pre class="prettyprint linenums"><?= $e->getMessage() ?></pre> |
| 81 | + <pre><?= $this->escapeHtml($ex->getMessage()) ?></pre> |
88 | 82 | </dd> |
89 | 83 | <dt>Stack trace:</dt> |
90 | 84 | <dd> |
91 | | - <pre class="prettyprint linenums"><?= $e->getTraceAsString() ?></pre> |
| 85 | + <pre><?= $this->escapeHtml($ex->getTraceAsString()) ?></pre> |
92 | 86 | </dd> |
93 | 87 | </dl> |
94 | 88 | </li> |
95 | | - <?php |
96 | | - $e = $e->getPrevious(); |
97 | | - $icount += 1; |
98 | | - if ($icount >=50) { |
99 | | - echo "<li>There may be more exceptions, but we have no enough memory to proccess it.</li>"; |
100 | | - break; |
101 | | - } |
102 | | - endwhile; |
103 | | - ?> |
| 89 | + <?php |
| 90 | + $ex = $ex->getPrevious(); |
| 91 | + if (++$icount >= 50) { |
| 92 | + echo '<li>There may be more exceptions, but we do not have enough memory to process it.</li>'; |
| 93 | + break; |
| 94 | + } |
| 95 | + ?> |
| 96 | + <?php endwhile ?> |
104 | 97 | </ul> |
105 | | -<?php endif; ?> |
106 | | - |
107 | | -<?php else: ?> |
108 | | - |
| 98 | + <?php endif ?> |
| 99 | + <?php else : ?> |
109 | 100 | <h3>No Exception available</h3> |
110 | | - |
111 | | -<?php endif ?> |
112 | | - |
| 101 | + <?php endif ?> |
113 | 102 | <?php endif ?> |
0 commit comments