I'd like to post a solution to the Preg_replace() issue in Squirrelmail.
I rewrote the code in utf_8.php (starting line 76) to modify the functions
generating the errors:
<code>
// decode four byte unicode characters
$string =
preg_replace_callback("/([\360-\367])([\200-\277])([\200-\277])([\200-\277])/",
function ($matches) {
return '&#' . ((ord($matches[1])-240)*262144 +
(ord($matches[2])-128)*4096 + (ord($matches[3])-128)*64 +
(ord($matches[4])-128)) . ';';
},
//
"'&#'.((ord('\\1')-240)*262144+(ord('\\2')-128)*4096+(ord('\\3')-128)*64+(ord('\\4')-128)).';'",
$string);
// decode three byte unicode characters
$string =
preg_replace_callback("/([\340-\357])([\200-\277])([\200-\277])/",
function ($matches) {
return '&#' . ((ord($matches[1])-224)*4096 +
(ord($matches[2])-128)*64 + (ord($matches[3])-128)) . ';';
},
//
"'&#'.((ord('\\1')-224)*4096+(ord('\\2')-128)*64+(ord('\\3')-128)).';'",
$string);
// decode two byte unicode characters
$string = preg_replace_callback("/([\300-\337])([\200-\277])/",
function ($matches) {
return '&#' . ((ord($matches[1])-192)*64 +
(ord($matches[2])-128)) . ';';
},
// "'&#'.((ord('\\1')-192)*64+(ord('\\2')-128)).';'",
$string);
// remove broken unicode
$string = preg_replace("/[\200-\237]|\240|[\241-\377]/",'?',$string);
return $string;
}
</code>
And the code for the mime.php file starting at line 705:
<code>
$replace = preg_replace_callback('/=([0-9a-f]{2})/i',
function ($matches) {
return chr(hexdec($matches[1]));
},
//'chr(hexdec("\1"))',
$replace);
</code>
--
View this message in context:
http://squirrelmail.5843.n7.nabble.com/PHP5-PHP7-with-SquirrelMail-1-4-22-causes-large-quantity-of-error-log-warnings-tp26356p26404.html
Sent from the squirrelmail-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
-----
squirrelmail-users mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.user
List info (subscribe/unsubscribe/change options):
https://lists.sourceforge.net/lists/listinfo/squirrelmail-users