dev_error.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. * @var \Cake\Core\Exception\CakeException $error
  15. */
  16. use Cake\Error\Debugger;
  17. ?>
  18. <!DOCTYPE html>
  19. <html>
  20. <head>
  21. <?= $this->Html->charset() ?>
  22. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  23. <title>
  24. Error: <?= h($this->fetch('title')) ?>
  25. </title>
  26. <?= $this->Html->meta('icon') ?>
  27. <style>
  28. * {
  29. box-sizing: border-box;
  30. }
  31. body {
  32. font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
  33. color: #404041;
  34. background: #F5F7FA;
  35. font-size: 14px;
  36. letter-spacing: .01em;
  37. line-height: 1.6;
  38. padding: 0 0 40px;
  39. margin: 0;
  40. height: 100%;
  41. }
  42. header {
  43. flex: 1;
  44. background-color: #D33C47;
  45. color: #ffffff;
  46. padding: 10px;
  47. }
  48. .header-title {
  49. display: flex;
  50. align-items: center;
  51. font-size: 30px;
  52. margin: 0;
  53. }
  54. .header-title a {
  55. font-size: 18px;
  56. cursor: pointer;
  57. margin-left: 10px;
  58. user-select: none;
  59. }
  60. .header-title code {
  61. margin: 0 10px;
  62. }
  63. .header-description {
  64. display: block;
  65. font-size: 18px;
  66. line-height: 1.2;
  67. margin-bottom: 16px;
  68. }
  69. .header-type {
  70. display: block;
  71. font-size: 16px;
  72. }
  73. .header-help a {
  74. color: #fff;
  75. }
  76. .error-content {
  77. display: flex;
  78. }
  79. .col-left,
  80. .col-right {
  81. overflow-y: auto;
  82. padding: 10px;
  83. }
  84. .col-left {
  85. background: #ececec;
  86. flex: 0 0 30%;
  87. }
  88. .col-right {
  89. flex: 1;
  90. }
  91. .toggle-vendor-frames {
  92. color: #404041;
  93. display: block;
  94. padding: 5px;
  95. margin-bottom: 10px;
  96. text-align: center;
  97. text-decoration: none;
  98. }
  99. .toggle-vendor-frames:hover,
  100. .toggle-vendor-frames:active {
  101. background: #e5e5e5;
  102. }
  103. .code-dump,
  104. pre {
  105. background: #fff;
  106. border-radius: 4px;
  107. padding: 5px;
  108. white-space: pre-wrap;
  109. margin: 0;
  110. }
  111. .error,
  112. .error-subheading {
  113. font-size: 18px;
  114. margin-top: 0;
  115. padding: 20px 16px;
  116. }
  117. .error-subheading {
  118. color: #fff;
  119. background-color: #319795;
  120. }
  121. .error-subheading strong {
  122. color: #fff;
  123. background-color: #4fd1c5;
  124. border-radius: 9999px;
  125. padding: 4px 12px;
  126. margin-right: 8px;
  127. }
  128. .error {
  129. color: #fff;
  130. background: #2779BD;
  131. }
  132. .error strong {
  133. color: #fff;
  134. background-color: #6CB2EB;
  135. border-radius: 9999px;
  136. padding: 4px 12px;
  137. margin-right: 8px;
  138. }
  139. .stack-trace {
  140. list-style: none;
  141. margin: 0;
  142. padding: 0;
  143. }
  144. .stack-frame {
  145. background: #e5e5e5;
  146. padding: 10px;
  147. margin-bottom: 10px;
  148. }
  149. .stack-frame:last-child {
  150. border-bottom: none;
  151. margin-bottom: 0;
  152. }
  153. .stack-frame a {
  154. display: block;
  155. color: #212121;
  156. text-decoration: none;
  157. }
  158. .stack-frame.active {
  159. background: #F5F7FA;
  160. }
  161. .stack-frame a:hover {
  162. text-decoration: underline;
  163. }
  164. .stack-frame-header {
  165. display: flex;
  166. align-items: center;
  167. }
  168. .stack-frame-file a {
  169. color: #212121;
  170. }
  171. .stack-frame-args {
  172. flex: 0 0 150px;
  173. display: block;
  174. padding: 8px 14px;
  175. text-decoration: none;
  176. background-color: #606c76;
  177. border-radius: 4px;
  178. cursor: pointer;
  179. color: #fff;
  180. text-align: center;
  181. margin-bottom: 10px;
  182. }
  183. .stack-frame-args:hover {
  184. background-color: #D33C47;
  185. }
  186. .stack-frame-file {
  187. flex: 1;
  188. word-break:break-all;
  189. margin-right: 10px;
  190. font-size: 16px;
  191. }
  192. .stack-file,
  193. .stack-function {
  194. display: block;
  195. }
  196. .stack-frame-file,
  197. .stack-file {
  198. font-family: consolas, monospace;
  199. }
  200. .stack-function {
  201. font-weight: bold;
  202. }
  203. .stack-file {
  204. font-size: 0.9em;
  205. white-space: nowrap;
  206. text-overflow: ellipsis;
  207. overflow: hidden;
  208. direction: rtl;
  209. }
  210. .stack-details {
  211. background: #ececec;
  212. border-radius: 4px;
  213. padding: 10px;
  214. margin-bottom: 18px;
  215. }
  216. .code-excerpt {
  217. width: 100%;
  218. margin: 10px 0 0 0;
  219. background: #fefefe;
  220. }
  221. .code-highlight {
  222. display: block;
  223. background: #fff59d;
  224. }
  225. .excerpt-line {
  226. padding: 0;
  227. }
  228. .excerpt-number {
  229. background: #f6f6f6;
  230. width: 50px;
  231. text-align: right;
  232. color: #666;
  233. border-right: 1px solid #ddd;
  234. padding: 2px;
  235. }
  236. .excerpt-number:after {
  237. content: attr(data-number);
  238. }
  239. .cake-debug {
  240. margin-top: 10px;
  241. }
  242. table {
  243. text-align: left;
  244. }
  245. th, td {
  246. padding: 4px;
  247. }
  248. th {
  249. border-bottom: 1px solid #ccc;
  250. }
  251. </style>
  252. </head>
  253. <body>
  254. <header>
  255. <?php
  256. $title = explode("\n", trim($this->fetch('title')));
  257. $errorTitle = array_shift($title);
  258. $errorDescription = implode("\n", $title);
  259. ?>
  260. <h1 class="header-title">
  261. <span><?= Debugger::formatHtmlMessage($errorTitle) ?></span>
  262. <a>&#128203</a>
  263. </h1>
  264. <?php if (strlen($errorDescription)) : ?>
  265. <span class="header-description"><?= Debugger::formatHtmlMessage($errorDescription) ?></span>
  266. <?php endif ?>
  267. <span class="header-type"><?= get_class($error) ?></span>
  268. </header>
  269. <div class="error-content">
  270. <div class="col-left">
  271. <?= $this->element('exception_stack_trace_nav') ?>
  272. </div>
  273. <div class="col-right">
  274. <?php if ($this->fetch('subheading')): ?>
  275. <p class="error-subheading">
  276. <?= $this->fetch('subheading') ?>
  277. </p>
  278. <?php endif; ?>
  279. <?= $this->element('exception_stack_trace'); ?>
  280. <div class="error-suggestion">
  281. <?= $this->fetch('file') ?>
  282. </div>
  283. <?php if ($this->fetch('templateName')): ?>
  284. <p class="customize">
  285. If you want to customize this error message, create
  286. <em><?= 'templates' . DIRECTORY_SEPARATOR . 'Error' . DIRECTORY_SEPARATOR . $this->fetch('templateName') ?></em>
  287. </p>
  288. <?php endif; ?>
  289. </div>
  290. </div>
  291. <script type="text/javascript">
  292. function bindEvent(selector, eventName, listener) {
  293. var els = document.querySelectorAll(selector);
  294. for (var i = 0, len = els.length; i < len; i++) {
  295. els[i].addEventListener(eventName, listener, false);
  296. }
  297. }
  298. function toggleElement(el) {
  299. if (el.style.display === 'none') {
  300. el.style.display = 'block';
  301. } else {
  302. el.style.display = 'none';
  303. }
  304. }
  305. function each(els, cb) {
  306. var i, len;
  307. for (i = 0, len = els.length; i < len; i++) {
  308. cb(els[i], i);
  309. }
  310. }
  311. window.addEventListener('load', function() {
  312. bindEvent('.stack-frame-args', 'click', function(event) {
  313. var target = this.dataset['target'];
  314. var el = document.getElementById(target);
  315. toggleElement(el);
  316. event.preventDefault();
  317. });
  318. var details = document.querySelectorAll('.stack-details');
  319. var frames = document.querySelectorAll('.stack-frame');
  320. bindEvent('.stack-frame a', 'click', function(event) {
  321. each(frames, function(el) {
  322. el.classList.remove('active');
  323. });
  324. this.parentNode.classList.add('active');
  325. each(details, function(el) {
  326. el.style.display = 'none';
  327. });
  328. var target = document.getElementById(this.dataset['target']);
  329. toggleElement(target);
  330. event.preventDefault();
  331. });
  332. bindEvent('.toggle-vendor-frames', 'click', function(event) {
  333. each(frames, function(el) {
  334. if (el.classList.contains('vendor-frame')) {
  335. toggleElement(el);
  336. }
  337. });
  338. event.preventDefault();
  339. });
  340. bindEvent('.header-title a', 'click', function(event) {
  341. event.preventDefault();
  342. var text = '';
  343. each(this.parentNode.childNodes, function(el) {
  344. if (el.nodeName !== 'A') {
  345. text += el.textContent.trim();
  346. }
  347. });
  348. // Use execCommand(copy) as it has the widest support.
  349. var textArea = document.createElement("textarea");
  350. textArea.value = text;
  351. document.body.appendChild(textArea);
  352. textArea.focus();
  353. textArea.select();
  354. var el = this;
  355. try {
  356. document.execCommand('copy');
  357. // Show a success icon and then revert
  358. var original = el.innerText;
  359. el.innerText = '\ud83c\udf70';
  360. setTimeout(function () {
  361. el.innerText = original;
  362. }, 1000);
  363. } catch (err) {
  364. alert('Unable to update clipboard ' + err);
  365. }
  366. document.body.removeChild(textArea);
  367. this.parentNode.parentNode.scrollIntoView(true);
  368. });
  369. });
  370. </script>
  371. </body>
  372. </html>