Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove symfony/polyfill-php80 #1592

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.*",
Expand Down
8 changes: 4 additions & 4 deletions src/FrameBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 (Frame::ANONYMOUS_CLASS_PREFIX === mb_substr($functionName, 0, mb_strlen(Frame::ANONYMOUS_CLASS_PREFIX))) {
$functionName = Frame::ANONYMOUS_CLASS_PREFIX . $this->stripPrefixFromFilePath($this->options, substr($backtraceFrame['class'], \strlen(Frame::ANONYMOUS_CLASS_PREFIX)));
}

Expand Down Expand Up @@ -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 && 'Sentry\\' === substr($functionName, 0, \strlen('Sentry\\'))) {
return false;
}

Expand All @@ -117,15 +117,15 @@ 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;
}
}

foreach ($includedAppPaths as $includedAppPath) {
if (str_starts_with($absoluteFilePath, $includedAppPath)) {
if (mb_substr($absoluteFilePath, 0, mb_strlen($includedAppPath)) === $includedAppPath) {
$isInApp = true;

break;
Expand Down
2 changes: 1 addition & 1 deletion src/Tracing/DynamicSamplingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 (self::SENTRY_ENTRY_PREFIX === mb_substr($key, 0, mb_strlen(self::SENTRY_ENTRY_PREFIX))) {
$samplingContext->set(rawurldecode(mb_substr($key, mb_strlen(self::SENTRY_ENTRY_PREFIX))), rawurldecode($value));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Util/PrefixStripper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down