- Issue created by @SKrossa
- Assigned to abhishek_virasat
- Issue was unassigned.
- Status changed to Needs review
8 months ago 7:59am 1 April 2024 - 🇮🇳India dineshkumarbollu
created patch by declaring optional parameters after required parameters.
- 🇺🇸United States SKrossa
The patch in #4 may cause issues if the function is called by another module, as the variables would be in the wrong order.
Based on info at Migrating from PHP 7.4.x to PHP 8.0.x on this deprecated feature (https://www.php.net/manual/en/migration80.deprecated.php), "If a parameter with a default value is followed by a required parameter, the default value has no effect. This is deprecated as of PHP 8.0.0 and can generally be resolved by dropping the default value, without a change in functionality"
So the. patch should simply change
function switch_value_callback($element, $input = FALSE, &$form_state){
to
function switch_value_callback($element, $input, &$form_state){
And it would function just the same as before, as in PHP 7.4 the default value of FALSE was already being ignored, anyway.
I will try to create a patch that does this later (when I have a bit more time to figure out how one does that!)