Commit 027deb85 authored by skummer's avatar skummer

ZP-322 #comment use "old" method to check if decode() is called statically, as...

ZP-322 #comment use "old" method to check if decode() is called statically, as usage of is_a() causes E_STRICT messages on 5.0.0 until 5.3.0 #time 20m

git-svn-id: https://z-push.org/svn/z-push/trunk@1612 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 1a3e606b
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
* - Redistributions in binary form must reproduce the above copyright * - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* - Neither the name of the authors, nor the names of its contributors * - Neither the name of the authors, nor the names of its contributors
* may be used to endorse or promote products derived from this * may be used to endorse or promote products derived from this
* software without specific prior written permission. * software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
...@@ -66,6 +66,9 @@ ...@@ -66,6 +66,9 @@
* Reference implementation used: * Reference implementation used:
* http://download.pear.php.net/package/Mail_mimeDecode-1.5.5.tgz * http://download.pear.php.net/package/Mail_mimeDecode-1.5.5.tgz
* *
* used "old" method of checking if called statically, as this is deprecated between php 5.0.0 and 5.3.0
* (isStatic of decode() around line 215)
*
*/ */
/** /**
...@@ -208,7 +211,7 @@ class Mail_mimeDecode ...@@ -208,7 +211,7 @@ class Mail_mimeDecode
function decode($params = null) function decode($params = null)
{ {
// determine if this method has been called statically // determine if this method has been called statically
$isStatic = empty($this) || !is_a($this, __CLASS__); $isStatic = !(isset($this) && get_class($this) == __CLASS__);
// Have we been called statically? // Have we been called statically?
// If so, create an object and pass details to that. // If so, create an object and pass details to that.
...@@ -438,7 +441,7 @@ class Mail_mimeDecode ...@@ -438,7 +441,7 @@ class Mail_mimeDecode
if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $input, $match)) { if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $input, $match)) {
return array($match[1], $match[2]); return array($match[1], $match[2]);
} }
// bug #17325 - empty bodies are allowed. - we just check that at least one line // bug #17325 - empty bodies are allowed. - we just check that at least one line
// of headers exist.. // of headers exist..
if (count(explode("\n",$input))) { if (count(explode("\n",$input))) {
return array($input, ''); return array($input, '');
...@@ -462,11 +465,11 @@ class Mail_mimeDecode ...@@ -462,11 +465,11 @@ class Mail_mimeDecode
// Unfold the input // Unfold the input
$input = preg_replace("/\r?\n/", "\r\n", $input); $input = preg_replace("/\r?\n/", "\r\n", $input);
//#7065 - wrapping.. with encoded stuff.. - probably not needed, //#7065 - wrapping.. with encoded stuff.. - probably not needed,
// wrapping space should only get removed if the trailing item on previous line is a // wrapping space should only get removed if the trailing item on previous line is a
// encoded character // encoded character
$input = preg_replace("/=\r\n(\t| )+/", '=', $input); $input = preg_replace("/=\r\n(\t| )+/", '=', $input);
$input = preg_replace("/\r\n(\t| )+/", ' ', $input); $input = preg_replace("/\r\n(\t| )+/", ' ', $input);
$headers = explode("\r\n", trim($input)); $headers = explode("\r\n", trim($input));
foreach ($headers as $value) { foreach ($headers as $value) {
...@@ -527,7 +530,7 @@ class Mail_mimeDecode ...@@ -527,7 +530,7 @@ class Mail_mimeDecode
$lq = ''; // last quote.. $lq = ''; // last quote..
while ($i < $l) { while ($i < $l) {
$c = $input[$i]; $c = $input[$i];
//var_dump(array('i'=>$i,'c'=>$c,'q'=>$q, 'lq'=>$lq, 'key'=>$key, 'val' =>$val)); //var_dump(array('i'=>$i,'c'=>$c,'q'=>$q, 'lq'=>$lq, 'key'=>$key, 'val' =>$val));
...@@ -539,7 +542,7 @@ class Mail_mimeDecode ...@@ -539,7 +542,7 @@ class Mail_mimeDecode
} }
$escaped = true; $escaped = true;
$c = $input[$i]; $c = $input[$i];
} }
// state - in key.. // state - in key..
...@@ -562,7 +565,7 @@ class Mail_mimeDecode ...@@ -562,7 +565,7 @@ class Mail_mimeDecode
$i++; $i++;
continue; continue;
} }
// state - in value.. (as $val is set..) // state - in value.. (as $val is set..)
if ($q === false) { if ($q === false) {
...@@ -613,7 +616,7 @@ class Mail_mimeDecode ...@@ -613,7 +616,7 @@ class Mail_mimeDecode
$i++; $i++;
continue; continue;
} }
// state - in quote.. // state - in quote..
if (!$escaped && $c == $q) { // potential exit state.. if (!$escaped && $c == $q) { // potential exit state..
...@@ -623,15 +626,15 @@ class Mail_mimeDecode ...@@ -623,15 +626,15 @@ class Mail_mimeDecode
$i++; $i++;
continue; continue;
} }
// normal char inside of quoted string.. // normal char inside of quoted string..
$val.= $c; $val.= $c;
$i++; $i++;
} }
// do we have anything left.. // do we have anything left..
if (strlen(trim($key)) || $val !== false) { if (strlen(trim($key)) || $val !== false) {
$val = trim($val); $val = trim($val);
$added = false; $added = false;
if ($val !== false && preg_match('/\*[0-9]+$/', $key)) { if ($val !== false && preg_match('/\*[0-9]+$/', $key)) {
...@@ -685,7 +688,7 @@ class Mail_mimeDecode ...@@ -685,7 +688,7 @@ class Mail_mimeDecode
$parts[] = $tmp[$i]; $parts[] = $tmp[$i];
} }
} }
// add the last part on if it does not end with the 'closing indicator' // add the last part on if it does not end with the 'closing indicator'
if (!empty($tmp[$len]) && strlen(trim($tmp[$len])) && $tmp[$len][0] != '-') { if (!empty($tmp[$len]) && strlen(trim($tmp[$len])) && $tmp[$len][0] != '-') {
$parts[] = $tmp[$len]; $parts[] = $tmp[$len];
...@@ -864,7 +867,7 @@ class Mail_mimeDecode ...@@ -864,7 +867,7 @@ class Mail_mimeDecode
/** /**
* getSendArray() returns the arguments required for Mail::send() * getSendArray() returns the arguments required for Mail::send()
* used to build the arguments for a mail::send() call * used to build the arguments for a mail::send() call
* *
* Usage: * Usage:
* $mailtext = Full email (for example generated by a template) * $mailtext = Full email (for example generated by a template)
...@@ -906,7 +909,7 @@ class Mail_mimeDecode ...@@ -906,7 +909,7 @@ class Mail_mimeDecode
} }
$to = substr($to,1); $to = substr($to,1);
return array($to,$header,$this->_body); return array($to,$header,$this->_body);
} }
/** /**
* Returns a xml copy of the output of * Returns a xml copy of the output of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment