Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

cleptric
Copy link
Member

Fixes #1861

@cleptric
Copy link
Member Author

@poldixd could you give this a try and lmk if it fixes your issue? I'm not sure in which cases this problem can actually happen, hence the fix is purely based on a synthetic test.
If you can share a repro, even better.

@cleptric cleptric requested a review from Copilot June 12, 2025 16:26
@cleptric cleptric self-assigned this Jun 12, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the handling of backtrace frames by correctly reindexing variadic function arguments, ensuring that gaps in the backtrace indices are handled properly.

  • Added a test to verify that gaps in backtrace array indices are correctly processed
  • Simplified the code by replacing a loop with array_slice and array_values to extract and reindex variadic arguments

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/FrameBuilderTest.php Added a test for verifying proper handling of gaps in backtrace args
src/FrameBuilder.php Replaced loop with array_slice and array_values for variadic arguments

@cleptric cleptric added the Bug label Jun 12, 2025
@poldixd
Copy link

poldixd commented Jun 13, 2025

Thanks! The issue is now resolved on my end.

My original code looked like this and I created a test for this exception:

try {
    $contactPerson->addMediaFromUrl('foo.bar')
        ->preservingOriginal()
        ->toMediaCollection(Attachment::MEDIALIBRARY_COLLECTIONNAME);
} catch (UnreachableUrl $th) {
    report($th);
}

It’s possible that the exception UnreachableUrl from the spatie/laravel-medialibrary package played a role in this:
https://github.com/spatie/laravel-medialibrary/blob/main/src/MediaCollections/Exceptions/UnreachableUrl.php

So far, everything seems to work fine with your fix—thanks again!

@cleptric cleptric merged commit d86faef into master Jun 13, 2025
38 checks passed
@cleptric cleptric deleted the cursor/fix-bug-in-sentry-php-ace0 branch June 13, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Since updating to version 4.13.0, I’m encountering the following error during CI tests:
4 participants