You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I know 1.4.2 is now maintenance, but I’ve updated to it recently due to the comments re likelihood of 2.0 have 'paper cut' bugs.
There are still a number of bugs in 1.4.2 on php 8.2. I’m listing some here that’s I’ve patched (hacked) as it may help someone else and possibly it may be relevant to 2.0. I get some of these as appear to have some emails with less common windows encodings. I’m not claiming these are elegant of efficient fixes, but work for me, for now. I’ve posted up a couple before in previous issues. I'm not suggestinganyone resolves these - just TBA for the next 1.4.2 user. Looking forward to a stable 2.x!
PHP Warning: DOMDocument::loadHTML(): Tag o:p invalid in Entity, line: 45 in /…/cypht/modules/core/message_functions.php on line 436
$doc = new DOMDocument();
//$doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); // WAS original line - warnings when invalid entities
// so HACK to suppress errors when malformed html
$doc->strictErrorChecking=false;
$previous_value = libxml_use_internal_errors(true); // MB hack
$doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
libxml_clear_errors(); // MB
libxml_use_internal_errors($previous_value);//MB
// end hack
if ($struct['attributes']['charset'] != 'us-ascii') {
//$res = mb_convert_encoding($res, 'UTF-8', $struct['attributes']['charset']); //original line
// hack as breaks with windows-1257 charset, and others
$charset_mb = $struct['attributes']['charset'] ??'';
$alt_charset = ['UTF-7'=>"UTF7-IMAP", 'WINDOWS-1256'=> "ISO-8859-6", 'WINDOWS-1257'=> "ISO-8859-13"]; // not super sure about 1256 equiv
if(array_key_exists(strtoupper($charset_mb), $alt_charset)){// MB
$charset_mb = $alt_charset[strtoupper($charset_mb)];
}
$res = mb_convert_encoding($res, 'UTF-8', $charset_mb); // modified line
// end of hack
PHP Fatal error: Uncaught TypeError: count(): Argument # 1 ($value) must be of type Countable|array, bool given in… /cypht/modules/imap/functions.php:965
if (array_key_exists('disposition', $struct) && is_array($struct['disposition']) && array_key_exists('attachment', $struct['disposition'])) {
//mb_hack - breaks sometimes on next line - Argument #1 ($value) must be of type Countable|array, bool given
//for ($i=0;$i<count($struct['disposition']['attachment']);$i++) { // original line
$count_1 = is_countable($struct['disposition']['attachment']) ? count($struct['disposition']['attachment']) : 0;
for ($i=0;$i< $count_1;$i++) {
// end of hack
if (strtolower(trim($struct['disposition']['attachment'][$i])) == 'filename') { // existing…
I hope this helps someone
The text was updated successfully, but these errors were encountered:
🐛 Bugreport
Hi
I know 1.4.2 is now maintenance, but I’ve updated to it recently due to the comments re likelihood of 2.0 have 'paper cut' bugs.
There are still a number of bugs in 1.4.2 on php 8.2. I’m listing some here that’s I’ve patched (hacked) as it may help someone else and possibly it may be relevant to 2.0. I get some of these as appear to have some emails with less common windows encodings. I’m not claiming these are elegant of efficient fixes, but work for me, for now. I’ve posted up a couple before in previous issues. I'm not suggestinganyone resolves these - just TBA for the next 1.4.2 user. Looking forward to a stable 2.x!
PHP Warning: DOMDocument::loadHTML(): Tag o:p invalid in Entity, line: 45 in /…/cypht/modules/core/message_functions.php on line 436
PHP Fatal error: Uncaught ValueError: mb_convert_encoding(): Argument # 3 ($from_encoding) contains invalid encoding "windows-1256" in …/cypht/modules/core/message_functions.php:416
Fatal error: Uncaught ValueError: mb_convert_encoding(): Argument # 3 ($from_encoding) contains invalid encoding "windows-1257" in /…/cypht/modules/imap/hm-imap.php:968
PHP Fatal error: Uncaught TypeError: count(): Argument # 1 ($value) must be of type Countable|array, bool given in… /cypht/modules/imap/functions.php:965
I hope this helps someone
The text was updated successfully, but these errors were encountered: