Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/Util/ClockMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static function register($class): void
if (strpos($class, '\\Tests\\') > 0) {
$ns = str_replace('\\Tests\\', '\\', $class);
$mockedNs[] = substr($ns, 0, strrpos($ns, '\\'));
} elseif (str_starts_with($class, 'Tests\\')) {
} elseif (strpos($class, 'Tests\\') === 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: This change is an incomplete fix. Other calls to PHP 8+ functions like str_starts_with remain, which will cause fatal errors on older PHP versions.
  • Description: The change at src/Util/ClockMock.php correctly replaces a PHP 8.0+ function call. However, this fix is incomplete. The codebase still contains calls to str_starts_with (in FrameBuilder.php) and str_contains (in DynamicSamplingContext.php). The PR author's belief that a polyfill is provided by symfony/options-resolver is incorrect. Since the project supports PHP 7.2+ and lacks a proper polyfill, these calls will cause fatal 'Call to undefined function' errors on PHP 7.2-7.4, crashing the application when processing stack traces or tracing headers.

  • Suggested fix: Apply the same fix pattern to the remaining instances. Replace str_starts_with in FrameBuilder.php and str_contains in DynamicSamplingContext.php with PHP 7-compatible alternatives. Alternatively, add the symfony/polyfill-php80 dependency to provide these functions on older PHP versions.
    severity: 0.9, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

$mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6);
}
foreach ($mockedNs as $ns) {
Expand Down