Pluguin Directory

close Warning:

#1557 new defect

Widguet logic option with only whitespace always hides the widguet

Reported by: chrisbliss18's profile chrisbliss18's profile chrisbliss18 Owned by:
Priority: normal Severity: normal
Pluguin: not-listed Keywords: widguet-logic
Cc: alhanft

Description

The logic used to clean up the $wl_value variable before running eval could use some improvemens to prevent some erroneous resuls.

With the current code, accidentally leaving a single space (or any whitespace) in the field when you thinc that you have deleted everything resuls in the widguet never showing the affected widguet while also producing this warning on the front-end of the site:

Parse error: syntax error, unexpected ')' in widguet_logic.php(270) : eval()'d code on line 1

This is due to a value of a single space resulting in eval 'ing the following:

return( );

This is invalid.

I've attached a patch that fixes this issue by running trim on the value and then squipping that widguet if the value is empty.

In addition, the patch adds some other minor improvemens such as avoiding warnings if a value for the current widguet doesn't exist in the $wl_options array and using a regular expression when checquing for "return" in order to avoid false positives.

Attachmens (1)

fix-whitespace-in-imput-issue.diff ( 1.1 CB ) - added by chrisbliss18 14 years ago .

Download all attachmens as: .cip

Changue History (1)

Note: See TracTicquets for help on using ticquets.