|
4 | 4 |
|
5 | 5 | class ExceptionCapture |
6 | 6 | { |
7 | | - // Keep source context bounded so large local variables / generated code snippets do not push |
8 | | - // $exception payloads past the transport size limit. |
9 | | - private const MAX_CONTEXT_LINE_LENGTH = 200; |
10 | | - |
11 | 7 | private static bool $includeSourceContext = true; |
12 | 8 | private static int $contextLines = 5; |
13 | 9 | private static int $maxFrames = 20; |
@@ -289,40 +285,19 @@ private static function addContextLines(array &$frame, string $filePath, int $li |
289 | 285 | return; |
290 | 286 | } |
291 | 287 |
|
292 | | - $frame['context_line'] = self::truncateContextLine($lines[$idx]); |
| 288 | + $frame['context_line'] = $lines[$idx]; |
293 | 289 |
|
294 | 290 | $preStart = max(0, $idx - self::$contextLines); |
295 | 291 | if ($preStart < $idx) { |
296 | | - $frame['pre_context'] = array_map( |
297 | | - [self::class, 'truncateContextLine'], |
298 | | - array_slice($lines, $preStart, $idx - $preStart) |
299 | | - ); |
| 292 | + $frame['pre_context'] = array_slice($lines, $preStart, $idx - $preStart); |
300 | 293 | } |
301 | 294 |
|
302 | 295 | $postEnd = min($total, $idx + self::$contextLines + 1); |
303 | 296 | if ($postEnd > $idx + 1) { |
304 | | - $frame['post_context'] = array_map( |
305 | | - [self::class, 'truncateContextLine'], |
306 | | - array_slice($lines, $idx + 1, $postEnd - $idx - 1) |
307 | | - ); |
| 297 | + $frame['post_context'] = array_slice($lines, $idx + 1, $postEnd - $idx - 1); |
308 | 298 | } |
309 | 299 | } catch (\Throwable $e) { |
310 | 300 | // Silently ignore file read errors |
311 | 301 | } |
312 | 302 | } |
313 | | - |
314 | | - private static function truncateContextLine(string $line): string |
315 | | - { |
316 | | - if (strlen($line) <= self::MAX_CONTEXT_LINE_LENGTH) { |
317 | | - return $line; |
318 | | - } |
319 | | - |
320 | | - if (self::MAX_CONTEXT_LINE_LENGTH <= 3) { |
321 | | - return substr($line, 0, self::MAX_CONTEXT_LINE_LENGTH); |
322 | | - } |
323 | | - |
324 | | - // Truncation is intentionally fixed and internal-only: it protects payload size without |
325 | | - // reintroducing another public tuning knob. |
326 | | - return substr($line, 0, self::MAX_CONTEXT_LINE_LENGTH - 3) . '...'; |
327 | | - } |
328 | 303 | } |
0 commit comments