Commit d39f0ce4 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-934 Use is_resource() to check the stream, check if categories are

set before intersecting.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 8cabbd51
...@@ -2459,7 +2459,7 @@ class MAPIProvider { ...@@ -2459,7 +2459,7 @@ class MAPIProvider {
$addrbook = $this->getAddressbook(); $addrbook = $this->getAddressbook();
$stream = mapi_inetmapi_imtoinet($this->session, $addrbook, $mapimessage, array('use_tnef' => -1)); $stream = mapi_inetmapi_imtoinet($this->session, $addrbook, $mapimessage, array('use_tnef' => -1));
if (isset($stream)) { if (is_resource($stream)) {
$mstreamstat = mapi_stream_stat($stream); $mstreamstat = mapi_stream_stat($stream);
$streamsize = $mstreamstat["cb"]; $streamsize = $mstreamstat["cb"];
if (isset($streamsize)) { if (isset($streamsize)) {
......
...@@ -127,10 +127,12 @@ class SyncNote extends SyncObject { ...@@ -127,10 +127,12 @@ class SyncNote extends SyncObject {
// is a color other than yellow set // is a color other than yellow set
if (isset($this->Color) && $this->Color != 3 && $this->Color > -1 && $this->Color < 5) { if (isset($this->Color) && $this->Color != 3 && $this->Color > -1 && $this->Color < 5) {
// check existing categories - do not rewrite category if the category is already a supported or unsupported color // check existing categories - do not rewrite category if the category is already a supported or unsupported color
$insecUnsupp = array_intersect($this->categories, array_values(self::$unsupportedColors)); if (!empty($this->categories)) {
$insecColors = array_intersect($this->categories, array_values(self::$colors)); $insecUnsupp = array_intersect($this->categories, array_values(self::$unsupportedColors));
if (!empty($this->categories) && (!empty($insecUnsupp) || !empty($insecColors))) { $insecColors = array_intersect($this->categories, array_values(self::$colors));
return false; if (!empty($insecUnsupp) || !empty($insecColors)) {
return false;
}
} }
if(!isset($this->categories)) { if(!isset($this->categories)) {
$this->categories = array(); $this->categories = array();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment