comparing custom header to zero => You cannot create empty conditions ; -(

View: New views
2 Messages — Rating Filter:   Alert me  

comparing custom header to zero => You cannot create empty conditions ; -(

by Thomas Bätzler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

this is with regard to INGO H3 1.2 as shipped in Horde Webmail 1.1.5
using a sieve backend.

I'm trying to set up a rule to match for the custom header line
"X-GMX-Antispam: 0", which I would expect to look something like this:

  if header :value "eq" :comparator "i;ascii-numeric" "X-GMX-Antispam"
"0"  {
      keep;
  }

If I use Ingo to create a rule like this ("Self-defined Header"
"X-GMX-Antispam" "Is" "0"), I get the error shown above.

I've tracked this message to this block in rule.php at line 91:

            if ($actionID == 'rule_save'
                && empty($value[$key])
                && $condition['match'] != 'exists'
                && $condition['match'] != 'not exist') {
                $notification->push(sprintf(_("You cannot create empty
conditions. Please fill in a value for \"%s\"."), $condition['field']),
'horde.error');
                $valid = false;
            }

I haven't checked the version history of this file but I suspect that
the empty() is part f a fix for http://bugs.horde.org/ticket/5641

I've tried to amend the test to exclude the 0 value, but then I end
up with a broken sieve script:

  6: # Whitelisted by GMX
  7: if No strings specified {
  8:     keep;
  9: }

Curiously, if I use the comparator "equal to" instead of "is" with any
value, I get

  6: # Whitelisted by GMX
  7: if true {
  8:     keep;
  9: }

Could somebody please help me to fix this?

TIA,
Thomas

--
Ingo mailing list - Join the hunt: http://horde.org/bounties/#ingo
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: ingo-unsubscribe@...

Re: comparing custom header to zero => You cannot create empty conditions ; -(

by Jan Schneider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Zitat von Thomas Bätzler <t.baetzler@...>:

> Hi,
>
> this is with regard to INGO H3 1.2 as shipped in Horde Webmail 1.1.5
> using a sieve backend.
>
> I'm trying to set up a rule to match for the custom header line
> "X-GMX-Antispam: 0", which I would expect to look something like this:
>
>   if header :value "eq" :comparator "i;ascii-numeric" "X-GMX-Antispam"
> "0"  {
>       keep;
>   }
>
> If I use Ingo to create a rule like this ("Self-defined Header"
> "X-GMX-Antispam" "Is" "0"), I get the error shown above.
>
> I've tracked this message to this block in rule.php at line 91:
>
>             if ($actionID == 'rule_save'
>                 && empty($value[$key])
>                 && $condition['match'] != 'exists'
>                 && $condition['match'] != 'not exist') {
>                 $notification->push(sprintf(_("You cannot create empty
> conditions. Please fill in a value for \"%s\"."), $condition['field']),
> 'horde.error');
>                 $valid = false;
>             }
>
> I haven't checked the version history of this file but I suspect that
> the empty() is part f a fix for http://bugs.horde.org/ticket/5641

That should probably be a !strlen() check instead.

Jan.

--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/

--
Ingo mailing list - Join the hunt: http://horde.org/bounties/#ingo
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: ingo-unsubscribe@...