Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $text = trim($_GET['errorLog']);
- $lines = explode('Exception in thread', $text);
- $result = '<ul>';
- foreach ($lines as $line) {
- if (preg_match('/java\./', $line) && !preg_match('/\(\)/', $line)) {
- $rows = preg_split('/\r?\n/', $line, -1, PREG_SPLIT_NO_EMPTY);
- $exc = preg_split('/[\.\:]/', trim($rows[0]));
- $exception = $exc[sizeof($exc) - 2];
- for ($i = 1; $i < sizeof($rows); $i++) {
- if (strpos(trim($rows[$i]), 'at ') !== false) {
- $elements = preg_split('/[\.\(\)\:]/', trim($rows[1]), -1, PREG_SPLIT_NO_EMPTY);
- $row = trim($elements[4]);
- $file = trim($elements[2]) . '.' . trim($elements[3]);
- $method = trim($elements[1]);
- $result .= '<li>line <strong>' . htmlspecialchars($row) . '</strong> - <strong>' . htmlspecialchars($exception) . '</strong> in <em>' . htmlspecialchars($file) . ':' . htmlspecialchars($method) . '</em></li>';
- break;
- }
- }
- }
- }
- $result .= '</ul>';
- echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement