- Status changed to Closed: works as designed
2 months ago 6:14pm 21 November 2024 - π¨π¦Canada joseph.olstad
I checked the PHP documentation. debug_backtrace is not deprecated!
These errors are based on what?
Marking this as "works as designed".
- π©πͺGermany uuf6429 MΓΌnchen
Hello Stephen!
I'm not sure how you got those messages, but it seems to be that they are from an extension of PHPStan (a code quality static analysis tool) called phpstan-banned-code.
In general they are not errors, but rather warnings about (potentially) badly written code.
You can see the code generating those warnings here:
https://github.com/ekino/phpstan-banned-code/blob/e7bb53abf376e97ea590ea...
and here:
https://github.com/ekino/phpstan-banned-code/blob/e7bb53abf376e97ea590ea...The (default) configuration that causes those warnings can be seen here:
https://github.com/ekino/phpstan-banned-code/blob/e7bb53abf376e97ea590ea...
and here:
https://github.com/ekino/phpstan-banned-code/blob/e7bb53abf376e97ea590ea...I think you might have mixed up something, because you mentioned deprecated warnings, but provided code quality warnings from a 3rd party tool. The tool is complaining about code written in the "deprecated" method of the the "Bootstrap" class.
The reason why the tool complained is because in normal user code, you don't use `debug_backtrace` nor `print_r` - they are developer utilities. Typically such code is leftover from developers that forgot about it.
Joseph or whoever maintains this bootstrap project should add annotations to that code to tell PHPStan that those functions are intentional and not leftover. I have not tried it, but probably you can use @phpstan-ignore-next-line, e.g.
// @phpstan-ignore-next-line $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); // @phpstan-ignore-next-line \Drupal::logger('bootstrap')->warning('<pre>< code>' . print_r($backtrace, TRUE) . '</code></pre>');
(first one because of debug_backtrace and second one because of print_r)