File squirrelmail-1.4.22-php54hex2bin.patch of Package squirrelmail
diff -up squirrelmail-webmail-1.4.22/plugins/mail_fetch/functions.php.php54hex2bin squirrelmail-webmail-1.4.22/plugins/mail_fetch/functions.php
--- squirrelmail-webmail-1.4.22/plugins/mail_fetch/functions.php.php54hex2bin 2012-02-23 15:35:56.904404825 +0100
+++ squirrelmail-webmail-1.4.22/plugins/mail_fetch/functions.php 2012-02-23 15:36:20.528620921 +0100
@@ -92,15 +92,20 @@ function validate_mail_fetch_server_addr
return '';
}
-function hex2bin( $data ) {
- /* Original code by josh@superfork.com */
+/**
+ * hex2bin() only exists since PHP 5.4
+ */
+if ( ! function_exists('hex2bin') ) {
+ function hex2bin( $data ) {
+ /* Original code by josh@superfork.com */
- $len = strlen($data);
- $newdata = '';
- for( $i=0; $i < $len; $i += 2 ) {
- $newdata .= pack( "C", hexdec( substr( $data, $i, 2) ) );
+ $len = strlen($data);
+ $newdata = '';
+ for( $i=0; $i < $len; $i += 2 ) {
+ $newdata .= pack( "C", hexdec( substr( $data, $i, 2) ) );
+ }
+ return $newdata;
}
- return $newdata;
}
function mf_keyED( $txt ) {