Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

bugfix : options can't be passed to SeparatorToSeparator via PluginManager #6666

Closed

Conversation

Tauop
Copy link
Contributor

@Tauop Tauop commented Sep 12, 2014

Hi,

When you try to create a SeparatorToSeparator via PluginManager, array options are not passed correctly to the Filter

This exemple

$filter = new Filter\FilterChain(array(
    'filters' => array(
        array(
            'name' => 'wordseparatortoseparator',
            'options' => array(
                'search_separator' => '/',
                'remplacement_separator' => '-'
            ),
        ),
     )
));

$filter('/path/to/file');

throws this error :

PHP Warning:  preg_quote() expects parameter 1 to be string, array given in ./vendor/zendframework/zendframework/library/Zend/Filter/Word/SeparatorToSeparator.php on line 94

My PR propose to change the Zend\Filter\Word\SeparatorToSeparator constructor argument to an array option, as all descending classes.

Cheers,
Patrick

{
$this->setSearchSeparator($searchSeparator);
$this->setReplacementSeparator($replacementSeparator);
public function __construct($options = null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected. sorry for the mistake

@Ocramius
Copy link
Member

This is a major BC break IMO: instead, we should probably just register a factory for this filter to workaround the current limitations.

@Tauop
Copy link
Contributor Author

Tauop commented Jan 25, 2015

Hi Ocramius,

I have made a new branch. Is it what you want ?
https://github.com/Tauop/zf2/tree/feature/zend-filter-SeparatorToSeparator-factory

Thanks,
Patrick

@Ocramius
Copy link
Member

@Tauop that looks correct, yes

Ocramius added a commit that referenced this pull request Feb 2, 2015
Ocramius added a commit that referenced this pull request Feb 2, 2015
Ocramius added a commit that referenced this pull request Feb 2, 2015
…r-to-separator-filter' into develop

Close #7169
Forward port #7169
@Ocramius Ocramius added this to the 2.3.5 milestone Feb 2, 2015
@Ocramius Ocramius removed the BC Break label Feb 2, 2015
@Ocramius
Copy link
Member

Ocramius commented Feb 2, 2015

Handled in #7169

@Ocramius Ocramius closed this Feb 2, 2015
TomHAnderson pushed a commit to TomHAnderson/zf2 that referenced this pull request Feb 24, 2015
TomHAnderson pushed a commit to TomHAnderson/zf2 that referenced this pull request Feb 24, 2015
gianarb pushed a commit to zendframework/zend-filter that referenced this pull request May 15, 2015
…emoving duplicate filter entry from plugin manager
gianarb pushed a commit to zendframework/zend-filter that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants