Skip to content

PropertyGetterTask: a scalar input throws an uncaught TypeError, bypassing the error_strategy #239

Closed

Description

@njoubert-cleverage

Description

PropertyGetterTask only catches \Exception: on a scalar input, the TypeError thrown by the PropertyAccessor escapes execute(), so the property error context is not set and the task error_strategy is bypassed. The reference documentation states that "if the value cannot be read, the exception is set on the state (with the property added to the error context) and handled according to the task error_strategy".

Reproduction

get_sku:
    service: '@CleverAge\ProcessBundle\Task\PropertyGetterTask'
    options:
        property: '[sku]'

With the input 'foo':

TypeError: Symfony\Component\PropertyAccess\PropertyAccessor::getValue(): Argument #1 ($objectOrArray) must be of type object|array, string given, called in src/Task/PropertyGetterTask.php on line 40

Expected: the TypeError is set on the state, with property: '[sku]' in the error context.

Reproduced on main (ad31c1f), PHP 8.5, Symfony 8.1, by calling the task / transformer directly. Found while adding the missing tests of #197.

Cause

PropertyGetterTask.php#L41 catches \Exception instead of \Throwable.

Proposed fix

Catch \Throwable, as PropertySetterTask does since #232. Add a test.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None: this case currently throws an uncaught TypeError.

Activity

  1. added a commit that references this issue on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions