Fix handling of header test with one-element array as header name

pull/269/head
Aleksander Machniak 10 years ago
parent e2fb340289
commit 05b11f7ef0

@ -1,4 +1,7 @@
* version 8.3 [2015-03-12]
-----------------------------------------------------------
- Fix PHP fatal error when visiting Vacation interface and there's no sieve script yet - Fix PHP fatal error when visiting Vacation interface and there's no sieve script yet
- Fix handling of header test with one-element array as header name
* version 8.2 [2015-01-14] * version 8.2 [2015-01-14]
----------------------------------------------------------- -----------------------------------------------------------

@ -3,7 +3,7 @@
"type": "roundcube-plugin", "type": "roundcube-plugin",
"description": "Adds a possibility to manage Sieve scripts (incoming mail filters). It's clickable interface which operates on text scripts and communicates with server using managesieve protocol. Adds Filters tab in Settings.", "description": "Adds a possibility to manage Sieve scripts (incoming mail filters). It's clickable interface which operates on text scripts and communicates with server using managesieve protocol. Adds Filters tab in Settings.",
"license": "GPLv3+", "license": "GPLv3+",
"version": "8.2", "version": "8.3",
"authors": [ "authors": [
{ {
"name": "Aleksander Machniak", "name": "Aleksander Machniak",

@ -63,7 +63,7 @@ class rcube_sieve_engine
1 => 'notifyimportancehigh' 1 => 'notifyimportancehigh'
); );
const VERSION = '8.2'; const VERSION = '8.3';
const PROGNAME = 'Roundcube (Managesieve)'; const PROGNAME = 'Roundcube (Managesieve)';
const PORT = 4190; const PORT = 4190;
@ -1394,19 +1394,21 @@ class rcube_sieve_engine
} }
if (isset($rule['test'])) { if (isset($rule['test'])) {
if (in_array($rule['test'], array('header', 'address', 'envelope')) if (in_array($rule['test'], array('header', 'address', 'envelope'))) {
&& !is_array($rule['arg1']) if (is_array($rule['arg1']) && count($rule['arg1']) == 1) {
&& ($header = strtolower($rule['arg1'])) $rule['arg1'] = $rule['arg1'][0];
&& isset($this->headers[$header]) }
) {
$test = $header; $matches = ($header = strtolower($rule['arg1'])) && isset($this->headers[$header]);
$test = $matches ? $header : '...';
} }
else if ($rule['test'] == 'exists' else if ($rule['test'] == 'exists') {
&& !is_array($rule['arg']) if (is_array($rule['arg']) && count($rule['arg']) == 1) {
&& ($header = strtolower($rule['arg'])) $rule['arg'] = $rule['arg'][0];
&& isset($this->headers[$header]) }
) {
$test = $header; $matches = ($header = strtolower($rule['arg'])) && isset($this->headers[$header]);
$test = $matches ? $header : '...';
} }
else if (in_array($rule['test'], array('size', 'body', 'date', 'currentdate'))) { else if (in_array($rule['test'], array('size', 'body', 'date', 'currentdate'))) {
$test = $rule['test']; $test = $rule['test'];

Loading…
Cancel
Save