dev_error.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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-previous {
  145. margin: 24px 0 12px 8px;
  146. }
  147. .stack-frame {
  148. background: #e5e5e5;
  149. padding: 10px;
  150. margin-bottom: 10px;
  151. }
  152. .stack-frame:last-child {
  153. border-bottom: none;
  154. margin-bottom: 0;
  155. }
  156. .stack-frame a {
  157. display: block;
  158. color: #212121;
  159. text-decoration: none;
  160. }
  161. .stack-frame.active {
  162. background: #F5F7FA;
  163. }
  164. .stack-frame a:hover {
  165. text-decoration: underline;
  166. }
  167. .stack-frame-header {
  168. display: flex;
  169. align-items: center;
  170. }
  171. .stack-frame-file a {
  172. color: #212121;
  173. }
  174. .stack-frame-args {
  175. flex: 0 0 150px;
  176. display: block;
  177. padding: 8px 14px;
  178. text-decoration: none;
  179. background-color: #606c76;
  180. border-radius: 4px;
  181. cursor: pointer;
  182. color: #fff;
  183. text-align: center;
  184. margin-bottom: 10px;
  185. }
  186. .stack-frame-args:hover {
  187. background-color: #D33C47;
  188. }
  189. .stack-frame-file {
  190. flex: 1;
  191. word-break:break-all;
  192. margin-right: 10px;
  193. font-size: 16px;
  194. }
  195. .stack-file,
  196. .stack-function {
  197. display: block;
  198. }
  199. .stack-frame-file,
  200. .stack-file {
  201. font-family: consolas, monospace;
  202. }
  203. .stack-function {
  204. font-weight: bold;
  205. }
  206. .stack-file {
  207. font-size: 0.9em;
  208. white-space: nowrap;
  209. text-overflow: ellipsis;
  210. overflow: hidden;
  211. direction: rtl;
  212. }
  213. .stack-details {
  214. background: #ececec;
  215. border-radius: 4px;
  216. padding: 10px;
  217. margin-bottom: 18px;
  218. }
  219. .code-excerpt {
  220. width: 100%;
  221. margin: 10px 0 0 0;
  222. background: #fefefe;
  223. }
  224. .code-highlight {
  225. display: block;
  226. background: #fff59d;
  227. }
  228. .excerpt-line {
  229. padding: 0;
  230. }
  231. .excerpt-number {
  232. background: #f6f6f6;
  233. width: 50px;
  234. text-align: right;
  235. color: #666;
  236. border-right: 1px solid #ddd;
  237. padding: 2px;
  238. }
  239. .excerpt-number:after {
  240. content: attr(data-number);
  241. }
  242. .cake-debug {
  243. margin-top: 10px;
  244. }
  245. table {
  246. text-align: left;
  247. }
  248. th, td {
  249. padding: 4px;
  250. }
  251. th {
  252. border-bottom: 1px solid #ccc;
  253. }
  254. </style>
  255. <?php require CAKE . 'Error/Debug/dumpHeader.html'; ?>
  256. </head>
  257. <body>
  258. <header>
  259. <?php
  260. $title = explode("\n", trim($this->fetch('title')));
  261. $errorTitle = array_shift($title);
  262. $errorDescription = implode("\n", $title);
  263. ?>
  264. <h1 class="header-title">
  265. <span><?= Debugger::formatHtmlMessage($errorTitle) ?></span>
  266. <a>&#128203</a>
  267. </h1>
  268. <?php if (strlen($errorDescription)) : ?>
  269. <span class="header-description"><?= Debugger::formatHtmlMessage($errorDescription) ?></span>
  270. <?php endif ?>
  271. <span class="header-type"><?= get_class($error) ?></span>
  272. </header>
  273. <div class="error-content">
  274. <div class="col-left">
  275. <?= $this->element('exception_stack_trace_nav') ?>
  276. </div>
  277. <div class="col-right">
  278. <?php if ($this->fetch('subheading')): ?>
  279. <p class="error-subheading">
  280. <?= $this->fetch('subheading') ?>
  281. </p>
  282. <?php endif; ?>
  283. <?= $this->element('exception_stack_trace'); ?>
  284. <div class="error-suggestion">
  285. <?= $this->fetch('file') ?>
  286. </div>
  287. <?php if ($this->fetch('templateName')): ?>
  288. <p class="customize">
  289. If you want to customize this error message, create
  290. <em><?= 'templates' . DIRECTORY_SEPARATOR . 'Error' . DIRECTORY_SEPARATOR . $this->fetch('templateName') ?></em>
  291. </p>
  292. <?php endif; ?>
  293. </div>
  294. </div>
  295. <script type="text/javascript">
  296. function bindEvent(selector, eventName, listener) {
  297. var els = document.querySelectorAll(selector);
  298. for (var i = 0, len = els.length; i < len; i++) {
  299. els[i].addEventListener(eventName, listener, false);
  300. }
  301. }
  302. function toggleElement(el) {
  303. if (el.style.display === 'none') {
  304. el.style.display = 'block';
  305. } else {
  306. el.style.display = 'none';
  307. }
  308. }
  309. function each(els, cb) {
  310. var i, len;
  311. for (i = 0, len = els.length; i < len; i++) {
  312. cb(els[i], i);
  313. }
  314. }
  315. window.addEventListener('load', function() {
  316. bindEvent('.stack-frame-args', 'click', function(event) {
  317. var target = this.dataset['target'];
  318. var el = document.getElementById(target);
  319. toggleElement(el);
  320. event.preventDefault();
  321. });
  322. var details = document.querySelectorAll('.stack-details');
  323. var frames = document.querySelectorAll('.stack-frame');
  324. bindEvent('.stack-frame a', 'click', function(event) {
  325. each(frames, function(el) {
  326. el.classList.remove('active');
  327. });
  328. this.parentNode.classList.add('active');
  329. each(details, function(el) {
  330. el.style.display = 'none';
  331. });
  332. var target = document.getElementById(this.dataset['target']);
  333. toggleElement(target);
  334. event.preventDefault();
  335. });
  336. bindEvent('.toggle-vendor-frames', 'click', function(event) {
  337. each(frames, function(el) {
  338. if (el.classList.contains('vendor-frame')) {
  339. toggleElement(el);
  340. }
  341. });
  342. event.preventDefault();
  343. });
  344. bindEvent('.header-title a', 'click', function(event) {
  345. event.preventDefault();
  346. var text = '';
  347. each(this.parentNode.childNodes, function(el) {
  348. if (el.nodeName !== 'A') {
  349. text += el.textContent.trim();
  350. }
  351. });
  352. // Use execCommand(copy) as it has the widest support.
  353. var textArea = document.createElement("textarea");
  354. textArea.value = text;
  355. document.body.appendChild(textArea);
  356. textArea.focus();
  357. textArea.select();
  358. var el = this;
  359. try {
  360. document.execCommand('copy');
  361. // Show a success icon and then revert
  362. var original = el.innerText;
  363. el.innerText = '\ud83c\udf70';
  364. setTimeout(function () {
  365. el.innerText = original;
  366. }, 1000);
  367. } catch (err) {
  368. alert('Unable to update clipboard ' + err);
  369. }
  370. document.body.removeChild(textArea);
  371. this.parentNode.parentNode.scrollIntoView(true);
  372. });
  373. });
  374. </script>
  375. </body>
  376. </html>