We have moved to Github. Please open tickets there.

Opened 2 years ago

Closed 2 years ago

#3454 closed Defect (fixed)

elgg_format_attributes() does not support value = ''

Reported by: cash Owned by:
Priority: normal Milestone: Elgg 1.8.0
Component: Core Version: Github Master
Severity: minor Keywords:
Cc: brett@… Difficulty: easy

Description

As an example, this breaks the advanced plugin sorting because all plugins = "" in the select. What happens is that the "" is dropped as the value do the string "All plugins" is passed as the category. This results in an empty page.

The issue is the call to is_not_null() returns false on "".

Evan wrote this and he is probably more aware of why is_not_null() was chosen. I tried switching it to !== null but that caused problems because false is passed for parameters like selected. Making it !== false && !== null seems to work for me so far.

Change History (3)

comment:1 Changed 2 years ago by cash

Evan, any thoughts on this one? Was stripping empty values done on purpose or by accident?

comment:2 Changed 2 years ago by ewinslow

This may be a case where we were trying to be too helpful. IIRC, selected="" still means selected.

It also may have just been overly aggressive optimization on my part (if it's empty, why send down the attr at all?). I forget exactly.

Either way, I think it makes sense to include empty string attributes as just that. If someone needs otherwise they should use false or null.

comment:3 Changed 2 years ago by cash

  • Resolution set to fixed
  • Status changed from new to closed

(In [svn:9102]) Fixes #3454 not stripping empty attributes

Note: See TracTickets for help on using tickets.