laminas / laminas-form

Validate and display simple and complex forms, casting forms to business objects and vice versa
https://docs.laminas.dev/laminas-form/
BSD 3-Clause "New" or "Revised" License
80 stars 52 forks source link

Helper optional renderer consistency #266

Closed oldpec closed 6 months ago

oldpec commented 7 months ago
Q A
Documentation no
Bugfix yes
BC Break no
New Feature no
RFC no
QA no

Description

Inconsistencies in the way different view helpers load plugins meant that while most helpers worked without a renderer being attached on $this->view, a few failed.

This PR brings the few cases where plugins weren't successfully created when $this->view wasn't populated into line with the others and includes unit tests that fail before the change.

Arguably? In some older versions of PHP (ie 7.4) some of these cases (eg FormSelect::getFormHiddenHelper()) would work (because $this->view being null only became a TypeError for method_exists() in PHP 8.0) and then stopped working on current PHP versions. So these fixes would make code that worked for people under older versions of PHP continue to work as they uplift their PHP and Laminas versions.

There is a little background on: https://discourse.laminas.dev/t/laminas-form-view-helper-retrieval-consistency/3591