laminas / laminas-inputfilter

Normalize and validate input sets from the web, APIs, the CLI, and more, including files
https://docs.laminas.dev/laminas-inputfilter/
BSD 3-Clause "New" or "Revised" License
42 stars 28 forks source link

Input Fallback Value is not merged on Input::merge() #12

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

I think the fallback value should be replaced when merge is done.


Originally posted by @Maks3w at https://github.com/zendframework/zend-inputfilter/issues/35

weierophinney commented 4 years ago

I think this is bug not a BC break. I don't think someone is relying on current behavior. But yes also it can be BC break, but very unlikely. This is not documented, no tests.. so I think we don't need to wait till 3.0


Originally posted by @svycka at https://github.com/zendframework/zend-inputfilter/issues/35#issuecomment-134206139

weierophinney commented 4 years ago

Imho the intended behavior of merge is to also take care of the fallback value. Therefore this qualifies as a bugfix. I really would like to see this fixed asap.

        if ($input instanceof Input && $input->hasFallback()) {
            $this->setFallbackValue($input->getFallbackValue());
        }

ping @Maks3w


Originally posted by @netiul at https://github.com/zendframework/zend-inputfilter/issues/35#issuecomment-145016514

weierophinney commented 4 years ago

Fallback feature and merge method exists since a long time and nobody appreciate this before. My conclusion any change in the current behavior introduces a BC break.


Originally posted by @Maks3w at https://github.com/zendframework/zend-inputfilter/issues/35#issuecomment-145018402