Re: Making the hardcoded string length limit of Throwable->getTraceAsString() configurable
| From: | Ryan Jentzsch | Date: | Thu, 25 Jun 2020 02:17:18 +0000 |
| Subject: | Re: Making the hardcoded string length limit of Throwable->getTraceAsString() configurable | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110721@lists.php.net to get a copy of this message | ||
Why is there a 15 byte limit in the first place?
On Wed, Jun 24, 2020, 1:22 PM tyson andre <tysonandre775@hotmail.com> wrote:
>
> Hi internals,
>
> By default, strings in parameter lists are truncated to 15 bytes by
> default in Throwable->getTraceAsString()
> (and Throwable->__toString() as a consequence).
> (in Zend/zend_exception.c in `static void _build_trace_args(zval *arg,
> smart_str *str)`)
>
> This limit is too short to see relevant information such as file paths,
> full urls, etc, which makes reporting bugs in applications inconvenient.
>
> Would there be any interest in an ini setting such as
>
exception_string_length_limit as a non-negative value to raise
> this
> (either allowed to be 0 or more or 15 or more, defaulting to 15)
>
> It's possible to manually work around it by calling Throwable->getTrace(),
> but inconvenient,
> and there's always a concern about the user-space trace generation having
> its own issues
> (e.g.
>
> https://github.com/phan/phan/blob/3.0.3/src/Phan/Debug/Frame.php#L25-L132)
>
> In applications that don't have a custom exception handler, users could
> raise this to make creating bug reports easier.
>
> ```
> php > test('12345678901234567890');
> Warning: Uncaught Exception in php shell code:1
> Stack trace:
> #0 php shell code(1): test('123456789012345...')
> #1 {main}
> thrown in php shell code on line 1
> ```
>
> Thanks,
> - Tyson
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>