1
0
Fork 0

Merge pull request #12561 from MrPetovan/bug/12550-logger-introspection

Add Core\Logger to the introspection skip class list
This commit is contained in:
Philipp 2022-12-29 07:58:27 +01:00 committed by GitHub
commit edfec967de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 12 deletions

View file

@ -20,8 +20,6 @@
*/
namespace Friendica\Core\Logger\Capabilities;
use Friendica\Core\Logger\Factory\Logger;
use Friendica\Util\Profiler;
interface IHaveCallIntrospections
{
@ -31,9 +29,10 @@ interface IHaveCallIntrospections
* @var string[]
*/
public const IGNORE_CLASS_LIST = [
Logger::class,
Profiler::class,
\Friendica\Core\Logger::class,
\Friendica\Core\Logger\Factory\Logger::class,
'Friendica\\Core\\Logger\\Type',
\Friendica\Util\Profiler::class,
];
/**

View file

@ -75,7 +75,7 @@ class Introspection implements IHaveCallIntrospections
$i = 1;
while ($this->isTraceClassOrSkippedFunction($trace, $i)) {
while ($this->isTraceClassOrSkippedFunction($trace[$i] ?? [])) {
$i++;
}
@ -92,24 +92,23 @@ class Introspection implements IHaveCallIntrospections
/**
* Checks if the current trace class or function has to be skipped
*
* @param array $trace The current trace array
* @param int $index The index of the current hierarchy level
* @param array $traceItem The current trace item
*
* @return bool True if the class or function should get skipped, otherwise false
*/
private function isTraceClassOrSkippedFunction(array $trace, int $index): bool
private function isTraceClassOrSkippedFunction(array $traceItem): bool
{
if (!isset($trace[$index])) {
if (!$traceItem) {
return false;
}
if (isset($trace[$index]['class'])) {
if (isset($traceItem['class'])) {
foreach ($this->skipClassesPartials as $part) {
if (strpos($trace[$index]['class'], $part) !== false) {
if (strpos($traceItem['class'], $part) === 0) {
return true;
}
}
} elseif (in_array($trace[$index]['function'], $this->skipFunctions)) {
} elseif (in_array($traceItem['function'], $this->skipFunctions)) {
return true;
}