Skip to content

InputFileReaderTask: a null input raises a warning then a TypeError instead of an explicit exception #242

Closed

Description

@njoubert-cleverage

Description

InputFileReaderTask with a null input raises a PHP warning, then a raw TypeError, instead of an explicit exception.

Reproduction

read:
    service: '@CleverAge\ProcessBundle\Task\File\InputFileReaderTask'

With a null input:

Warning: Undefined array key "filename"
TypeError: file_exists(): Argument #1 ($filename) must be of type string, null given

Expected: an explicit \UnexpectedValueException (e.g. No file path given as input, like InputFolderBrowserTask since #232).

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

InputFileReaderTask::getOptions() only sets filename when the input is not null, and the filename option is removed from the resolver, so FileReaderTask::execute() reads an undefined key.

Proposed fix

Throw an \UnexpectedValueException when the input is not a non-empty string. Update input_file_reader_task.md, add tests.

Requirements

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

Breaking changes

None: this case currently throws a 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