Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Dec 2018 02:03:29 +0100
From:      Miroslav Lachman <000.fbsd@quip.cz>
To:        Janketh Jay <jankyj@unfs.us>, freebsd-ports@freebsd.org
Subject:   Re: Maia Mailgaurd
Message-ID:  <95f7bde5-62c7-c79b-366d-45d8a9147edd@quip.cz>
In-Reply-To: <c3a0c93d0d2bcbbefedff7c5f89cf3c0@unfs.us>
References:  <3695c8be-c969-1715-a902-72752faf7d5e@hayers.org> <f8c68abc-049c-3ded-5739-f658cfb8dfec@unfs.us> <B99FC248102343D980E03E07F63E4F13@RIVENDELL> <c204d13e-69ef-fdfe-4619-b27500126608@unfs.us> <9BE00ADB383D4AC1A8E546A8B4F0DD89@RIVENDELL> <c3a0c93d0d2bcbbefedff7c5f89cf3c0@unfs.us>

next in thread | previous in thread | raw e-mail | index | archive | help
Janketh Jay wrote on 2018/12/30 01:03:

[...]

> diff -Naur maia.orig/cache.php maia/cache.php
> --- maia.orig/cache.php 2015-02-15 15:19:45.000000000 -0700
> +++ maia/cache.php      2018-10-14 20:25:30.278960000 -0600
> @@ -554,7 +554,7 @@
>                       $rectmp = "";
>                       foreach ($to_list as $recipient) {
>                           if (isset($personal_addresses[$recipient]) || 
> $domain_default) {
> -                          $rectmp[] = $recipient;
> +                          $rectmp = $recipient;
>                           }
>                       }
>                       $rows[$count]['recipient_email'] = $rectmp;
> 
> 
>        Essentially, you just need to remove the "[]" from "rectmp" on 
> line 558 in your /usr/local/www/maia/cache.php file.

I don't use Maia Mailguard and I didn't read the source code but I think 
your patch is wrong. It changed the function. Original code assigned all 
recipient addresses (appending) in to an array (hash) $rectmp in a 
foreach loop and then assign this array to $rows[$count]['recipient_email'].
But now you are using it as variable so if there are more than one 
recipient this variable is overwritten on each iteration and then just 
the last recipient is assigned to $rows[$count]['recipient_email'].

My very wild guess is that it should be like this

-                    $rectmp = "";
+                    $rectmp = array();
                      foreach ($to_list as $recipient) {
                          if (isset($personal_addresses[$recipient]) || 
$domain_default) {
                           $rectmp[] = $recipient;
                          }
                      }
                      $rows[$count]['recipient_email'] = $rectmp;

I guess you want to fix some PHP 7 warning / syntax error with $rectmp 
created ass plain variable and later used as an array so I defined as an 
array first.

But maybe I am totally wrong :)

I just made similar fix few days ago in an old version of PostfixAdmin 
after upgrade from PHP 5.6 to 7.1.


Miroslav Lachman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95f7bde5-62c7-c79b-366d-45d8a9147edd>