[dev] Minimal invasive php 8.x fix for Horde_Form

Ralf Lang lang at b1-systems.de
Fri May 13 19:06:44 UTC 2022


Hello,

|Horde_Form and derived classes in some apps are breaking in PHP 8.x, 
namely 8.1. Looking at the code, it was only a matter of time. I have 
worked on fixes and want to propose the strategy for agreement. 
PHP4-style constructors: I have converted them to PHP5-style 
constructors and added a static fallback method for the old name. Unify 
the signature of all init methods to (...$params) and |||move the specific parameter and defaults handling into the method and 
accompanying phpdoc. | Add static keyword to factories Deprecate the 
singleton method (via phpdoc) Some phpdoc touchups 
https://github.com/maintaina-com/Form/commit/ef758d231ee261973ad08f8bda67ed1693a94925 
Most likely some followup patches are required. This will not make the 
library less messy. Code using Horde_Form still ought to be refactored 
to something else, be it an equivalent with Horde_View or a Horde_Form 
rewrite or some SPA framework. Being realistic, this will not be 
available in a big bang and not soon. The ... operator was introduced in 
PHP 5.6, making the change not an issue. For defaults handling I would 
suggest the ||?? operator, raising the bar to PHP 7.0 - arguably also not an issue. 
PHP 7.4 will EOL by Winter 2022. |||| |

-- 
Ralf Lang
Linux Consultant / Developer
Tel.: +49-170-6381563
Mail:lang at b1-systems.de
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg /http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537


More information about the dev mailing list