fix: Correct Horde_Form_Type::isValid() signature#5
fix: Correct Horde_Form_Type::isValid() signature#5amulet1 wants to merge 1 commit intohorde:FRAMEWORK_6_0from
Conversation
The $message parameter is string and it should be passed by reference. See commit 070af2
|
I'm not so fond of this approach. Alternatives:
As for the getInfo, we have made virtually all getInfo usages return the value and read the return value. Let me look up any leftovers. |
|
In this case And all the callers should be updated to retrieve the property, if it is needed.
I would like to offer my help with the changes. Please advise. |
|
Help is much appreciated. However we should be careful with timing. Changing signatures again in a base class which is littered all over horde and external products needs a bit of care. We want to go beta next week and stable in July. Let's work on Forms 4 with a proper OO model and then upgrade apps step by step in a .1 feature release. |
|
Well, right now it is broken - $message is not returned at all. It has to be fixed. Maybe we can do it in stages:
Same can be done with |
|
Yes, let's do it in stages.
Let's implement the incompatible, better type system in the PSR-4 namespace (src folder) src/V3/Types/Text.php This way
|
|
Superseded by #6 - Let's do it in stages. |
fix: Discussion from #5 - use a getter and property instead of a return parameter
fix: Add missing message assignment chore: Add more V3 types chore: Draft V3 design docs(README): Add upgrading instructions fix: Discussion from #5 - use a getter and property instead of a return parameter
As far as I understand, by default (without
&) PHP passes non-objects (which includes arrays) by value.For example:
Output (nothing changes):
The commit 070af29 removed
&from$messageinIsValid()signature. This causes loss of value possibly assigned to$message.Possible example of other signature issue (not in this patch, but I can update it, if needed) is in
getInfo. Implementations are inconsistent - some return$info, others modify its in place.But in the below case nothing is returned and
$infois not passed by reference, so the assigned value is lost:If this PR is accepted, signatures in other apps (for example, see Ingo_Form_Type_Longemail::isValid()) that extend Horde_Form_Type or its derivatives need to be updated as well.