[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    Re: [PHP-DEV] Making the hardcoded string length limit of Throwable->getTraceAsString() configurable
From:       tyson andre <tysonandre775 () hotmail ! com>
Date:       2020-06-25 13:34:10
Message-ID: DM6PR07MB6618CECEAFFDDB8F27A9E08AF9920 () DM6PR07MB6618 ! namprd07 ! prod ! outlook ! com
[Download RAW message or body]

> > Why is there a 15 byte limit in the first place?
> 
> Presumably it might be so that multi-megabyte strings are not dumped
> to the console when printing out a stack trace. (Disclaimer: I have
> not touched the relevant code and am just guessing.)

It apparently dates back to 2003, when exception::getTraceAsString() was first added.
https://github.com/php/php-src/commit/c80eb4573f8cbc268463c7ec233b467bd9b36b0f#diff-16cc0fb22dbf90c4c465180255880ea0R167
 Arguably, computers have more disk space and better processors.

The reasons I can think of to keep a low default limit:
- Syslogs might use udp for async logging, which has a limit of 4096 bytes or so, \
                which hasn't changed
- Code might truncate before logging an exception, and shorter argument \
                representations would allow logging more frames of the stack trace
- Code might log exceptions to disk during abnormal events (e.g. network outages), \
                and too high of a default would fill up disks faster
- CLI apps might fill up the entire screen or terminal scrollback buffer with \
megabyte-long strings (e.g. `string $file_contents`)

- Tyson
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic