Skip to content

TypeError: ignore_exceptions expects string[], but receives int elements with Sentry SDK v4 #49

Description

@Schuppel1

Description

After updating to flownative/sentry v3.2 with sentry/sentry ^4.0, the application (docker container) crashes with the following error:

The option "ignore_exceptions" with value array is expected to be of type "string[]", 
but one of the elements is of type "int".

Type: Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
File: Packages/Libraries/symfony/options-resolver/OptionsResolver.php
Line: 1062

Cause

In SentryClient.php line 135:
'ignore_exceptions' => array_keys(array_filter($this->excludeExceptionTypes)),

The array_keys() function returns integer keys when the original array has numeric indices. The Sentry SDK v4 now strictly validates that ignore_exceptions must be string[].

Suggested Fix

'ignore_exceptions' => array_map('strval', array_keys(array_filter($this->excludeExceptionTypes))),

Environment

• PHP: 8.2
• flownative/sentry: 3.2.0
• sentry/sentry: ^4.0
• Neos Flow: 9.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions