Skip to content

[BUG]: Closure not working in filter #14417

Closed
@ruudboon

Description

Describe the bug
When using a closure as a filter sanitizing fails.

To Reproduce

Steps to reproduce the behavior:

        $locator = new FilterFactory();
        $filter = $locator->newInstance();
        $filter->set(
            'testappend',
            function ($input) {
                return $input.'test';
            }
        );
        $value = 'cheese';
        $actual = $filter->sanitize($value, 'testappend');

        $expected = $value.'test';
        $I->assertEquals($expected, $actual);

Output

[ArgumentCountError] Too few arguments to function Phalcon\Test\Unit\Filter\Filter\SanitizeMultipleCest::Phalcon\Test\Unit\Filter\Filter\{closure}(), 0 passed and exactly 1 expected  

Details

  • Phalcon version: (4.0.0-rc.1)
  • PHP Version: (7.3)

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