diff --git a/composer.json b/composer.json index 32ea2f592..2fc11051f 100644 --- a/composer.json +++ b/composer.json @@ -34,8 +34,7 @@ "psr/http-factory": "^1.0", "psr/http-factory-implementation": "^1.0", "psr/log": "^1.0|^2.0|^3.0", - "symfony/options-resolver": "^3.4.43|^4.4.30|^5.0.11|^6.0", - "symfony/polyfill-php80": "^1.17" + "symfony/options-resolver": "^3.4.43|^4.4.30|^5.0.11|^6.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.19|3.4.*", diff --git a/src/FrameBuilder.php b/src/FrameBuilder.php index 5cd61bae6..6fe5f08b0 100644 --- a/src/FrameBuilder.php +++ b/src/FrameBuilder.php @@ -74,7 +74,7 @@ public function buildFromBacktraceFrame(string $file, int $line, array $backtrac if (isset($backtraceFrame['class']) && isset($backtraceFrame['function'])) { $functionName = $backtraceFrame['class']; - if (str_starts_with($functionName, Frame::ANONYMOUS_CLASS_PREFIX)) { + if (mb_substr($functionName, 0, mb_strlen(Frame::ANONYMOUS_CLASS_PREFIX)) === Frame::ANONYMOUS_CLASS_PREFIX) { $functionName = Frame::ANONYMOUS_CLASS_PREFIX . $this->stripPrefixFromFilePath($this->options, substr($backtraceFrame['class'], \strlen(Frame::ANONYMOUS_CLASS_PREFIX))); } @@ -107,7 +107,7 @@ private function isFrameInApp(string $file, ?string $functionName): bool return false; } - if (null !== $functionName && str_starts_with($functionName, 'Sentry\\')) { + if (null !== $functionName && substr($functionName, 0, strlen('Sentry\\')) === 'Sentry\\') { return false; } @@ -117,7 +117,7 @@ private function isFrameInApp(string $file, ?string $functionName): bool $isInApp = true; foreach ($excludedAppPaths as $excludedAppPath) { - if (str_starts_with($absoluteFilePath, $excludedAppPath)) { + if (mb_substr($absoluteFilePath, 0, mb_strlen($excludedAppPath)) === $excludedAppPath) { $isInApp = false; break; @@ -125,7 +125,7 @@ private function isFrameInApp(string $file, ?string $functionName): bool } foreach ($includedAppPaths as $includedAppPath) { - if (str_starts_with($absoluteFilePath, $includedAppPath)) { + if (mb_substr($absoluteFilePath, 0, mb_strlen($includedAppPath)) === $includedAppPath) { $isInApp = true; break; diff --git a/src/Tracing/DynamicSamplingContext.php b/src/Tracing/DynamicSamplingContext.php index a9ac69ade..c0b3dd39c 100644 --- a/src/Tracing/DynamicSamplingContext.php +++ b/src/Tracing/DynamicSamplingContext.php @@ -127,7 +127,7 @@ public static function fromHeader(string $header): self [$key, $value] = explode('=', $keyValue, 2); - if (str_starts_with($key, self::SENTRY_ENTRY_PREFIX)) { + if (mb_substr($key, 0, mb_strlen(self::SENTRY_ENTRY_PREFIX)) === self::SENTRY_ENTRY_PREFIX) { $samplingContext->set(rawurldecode(mb_substr($key, mb_strlen(self::SENTRY_ENTRY_PREFIX))), rawurldecode($value)); } } diff --git a/src/Util/PrefixStripper.php b/src/Util/PrefixStripper.php index 35c261312..d4f24286a 100644 --- a/src/Util/PrefixStripper.php +++ b/src/Util/PrefixStripper.php @@ -18,7 +18,7 @@ protected function stripPrefixFromFilePath(?Options $options, string $filePath): } foreach ($options->getPrefixes() as $prefix) { - if (str_starts_with($filePath, $prefix)) { + if (mb_substr($filePath, 0, mb_strlen($prefix)) === $prefix) { return mb_substr($filePath, mb_strlen($prefix)); } }