-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 8.X compatibility #17
Comments
How far have you come? What are the remaining errors? That could give some indication of how much work there is to do. |
It would be good what errors you are getting from your webserver logs. That should indicate where there is work to do. |
No errors in logs while trying to release a mail from quarantine ### Whatever errors:) [Sun Feb 25 11:10:06.468215 2024] [php:warn] [pid 25428] [client 1.1.1.1:52206] PHP Warning: Undefined variable $content_type in /srv/www/htdocs/mz-test/messagesPendingAdmin.php on line 57, referer: https://mydomain.abc/mz-test/messagesAdmin.php?t_criterion=contains&t_string=&m_criterion=contains&m_string=&f_criterion=contains&f_string=&s_criterion=contains&s_string=&ctype=A&search_action=Search ### open mail [Sun Feb 25 11:16:22.379448 2024] [php:warn] [pid 3497] [client 1.1.1.1:52240] PHP Warning: Undefined variable $emailaddresses in /srv/www/htdocs/mz-test/lib/DBEngine.class.php on line 500, referer: https://mydomain.abc/mz-test/messagesIndex.php?ctype=A hope this helps a bit |
It seems mycomment got vanished. |
@piperino721 even though the warnings don't look nice, I don't think they are actual showstoppers or you would have seen Fatal Errors in your log. After a previous U/G from Debian 10 to 11 and thus PHP 7.2 to 7.4 I had a similar error (at least I think it is similar to yours) where mailzu hangs on "retrieving messages". I found out that the mbstring extension was missing in PHP. Hence a simple:
solved that. Maybe that is your case as well? Maybe go through all PHP config and chech against a working installation (my highest install is on 7.4). |
php81-mbstring is installed here. |
OK that was just a hunch. There must be something else blocking. The warnings in your log don't explain this. Try and put your PHP to debug level, for example via your php.ini to so if you can capture some more info. |
this is what i get with "display_errors = On" in php.ini [Tue Feb 27 15:44:11.759494 2024] [php:warn] [pid 17803] [client 1.1.1.1:54700] PHP Warning: Undefined variable $emailaddresses in /srv/www/htdocs/mz-test/lib/DBEngine.class.php on line 500, referer: https://mydomain.abc/mz-test/messagesIndex.php?ctype=A **Just saw when i try to release a message it is trying to connect to the FQDN of the server on port 9998 which is of course not allowed. also tried 127.0.0.1 but it makes no difference.** |
Your log shows only warnings so the issue doesn't come from there. It might well be a system/configuration issue. Indeed amavisd runs on 127.0.0.1:9998 and that's where it should be adressed. You should have this in your config/config.php:
which can't point to the FQDN... |
The logs are written while trying to open a quarantined mail. thats one issue. no idea why PHP/mailzu is doing this Besides that the system runs fine for years. |
Difficult to say but IMHO it still doesn't look like a pure PHP issue. When I release a quaraintained mail, I see following in the webserver logs:
Maybe you can better see what happens here when the error in the GUI occurs? |
below is all i get. i think it's something in the code or with some PHP libraries needed for mailzu is wrong or missing. BTW. you run it on php8 or php7? ==> /var/log/apache2/access_log <== ==> /var/log/apache2/ssl_request_log <== |
I'm still running this on 2 machines both on PHP 7.4. I can't U/G PHP as yet since I have other software that I know is not compatible. Maybe MailZu isn't neither but we haven't really proved that unfortunately... To be able to further help, I would need to change the PHP version of one of my machines but can't do immediately since these are prod... I'm not sure if I can help further. Did you notice the change directly upon upgrading that machine or upon moving the webapp to a different server? The call of FQDN rather than localhost still sounds fishy and I'm almost convinced it's not PHP and some sysconf somewhere... |
No worries. i just thought i can't loose anything asking here:). |
Out of the box I got it working with this change: --- a/lib/classes/Auth.class.php
+++ b/lib/classes/Auth.class.php
@@ -78,7 +78,7 @@ class Auth
{
global $conf;
if (isset($_COOKIE['ID'])) {
- if (self::isAllowedToLogin($_COOKIE['ID'])) {
+ if ((new self)->isAllowedToLogin($_COOKIE['ID'])) {
$_SESSION['sessionID'] = $_COOKIE['ID'];
$_SESSION['sessionName'] = $_COOKIE['ID'];
$_SESSION['sessionMail'] = array($_COOKIE['ID']); This static function called a non-static function, and with self:: this doesn't work in php 8.2. However, postgresql was giving me a hard time, so I had to "encode(column,'escape')" a lot. --- a/lib/classes/DBEngine.class.php
+++ b/lib/classes/DBEngine.class.php
@@ -415,14 +415,14 @@ class DBEngine
$query = "SELECT
msgs.time_num,
msgs.from_addr,
- msgs.mail_id,
+ encode(msgs.mail_id,'escape') as mail_id,
msgs.partition_tag,
msgs.subject,
msgs.spam_level,
msgs.content,
msgrcpt.rs,
msgs.quar_type,
- recip.email
+ encode(recip.email,'escape') as email
FROM msgs
INNER JOIN msgrcpt ON msgs.mail_id = msgrcpt.mail_id
$join_type maddr AS sender ON msgs.sid = sender.id
@@ -503,7 +503,7 @@ class DBEngine
$rval = array();
- $query = 'SELECT msgs.time_num, msgs.secret_id, msgs.partition_tag, msgs.subject, msgs.from_addr, msgs.spam_level,'
+ $query = 'SELECT msgs.time_num, encode(msgs.secret_id,\'escape\') as secret_id, msgs.partition_tag, msgs.subject, msgs.from_addr, msgs.spam_level,'
. ' msgrcpt.rs, recip.email, msgs.host, msgs.content, msgs.quar_type, msgs.quar_loc'
. ' FROM msgs'
. ' INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id'
@@ -583,7 +583,7 @@ class DBEngine
if ($emailaddr_clause != '')
$emailaddr_clause = ' AND ' . $emailaddr_clause;
- $query = 'SELECT mail_id FROM msgrcpt, maddr as recip'
+ $query = 'SELECT encode(mail_id,\'escape\') as mail_id FROM msgrcpt, maddr as recip'
. ' WHERE msgrcpt.rid=recip.id'
. $emailaddr_clause
. ' AND rs=?';
@@ -689,9 +689,9 @@ class DBEngine
function cleanRow($data)
{
$rval = array();
-
foreach ($data as $key => $val)
- $rval[$key] = stripslashes($val);
+ $rval[$key] = stripslashes(strval($val));
+ //$rval[$key] = stripslashes($val);
return $rval;
} Edit: added the last one, without the strval it doesn't work either. |
@pboosten i am happy to read it worked with just these few modifications. |
Hello
Are there any plans to make your mailzu fork compatible with PHP 8+.
Got it partially working copying some files over from a Freebsd Repo. https://www.freshports.org/security/mailzu/
Unfortunately, i have no coding skills but could help testing.
cheer
The text was updated successfully, but these errors were encountered: