Closed MarcMichalsky closed 4 months ago
Well, the only case I can think of where empty()
might cause problems is a string containing '0'
. Since the profile returns empty options as empty strings, it should be fine to just check for those.
the profile returns empty options as empty strings,
Actually, that's only true for attributes that have been left empty in the form. The profile constructor fills empty attributes with NULL
, i.e. those that haven't got a value at all (because the form has not been saved since they were added). I think the empty string is not a valid value for all attributes in the first place, so the getAttribute()
method should not assume that.
Could you list the comparisons changed in 8bcdff4a855f621fec11ba255112c1d4ff57046e that actually cause problems? I'd be in favor of fixing those instead, as there's more context for each attribute.
I suspect that there could be problems if a value received from a getAttribute()
call is subsequently tested with isset()
or is_string()
because they would incorrectly assume an empty string as an option that needs to be processed.
Possible troublemakers:
I hope I have found them all!
The line with the membership_type_id
was where I first noticed the problem.
I adressed your findings in 2b8ab813dbe9a3297edfd875539348408f8bb150, could you have another look, @MarcMichalsky?
Fix issue #86