From:  pear-qa@lists.php.net ("sschmitz99@aol.com")
Date:  28 Aug 2016 11:01:18 Hong Kong Time
Newsgroup:  news.php.net/php.pear.bugs
Subject:  

[PEAR-BUG] Doc #18538 [Com]: Fatal Error w/ Mail_mimedecode 1.5.5 and php 5.2.17

NNTP-Posting-Host:  null

Edit report at https://pear.php.net/bugs/bug.php?id=18538&edit=1

 ID:               18538
 Comment by:       sschmitz99@aol.com
 Reported By:      afduggan at gmail dot com
 Summary:          Fatal Error w/ Mail_mimedecode 1.5.5 and php 5.2.17
 Status:           Feedback
 Type:             Documentation Problem
 Package:          Mail_mimeDecode
 Operating System: CentOS 5.6
 Package Version:  1.5.5
 PHP Version:      5.2.12
 Roadmap Versions: 
 New Comment:

here's the fixed function:

function _quotedPrintableDecode($input)
   {
       // Remove soft line breaks
       $input = preg_replace("/=\r?\n/", '', $input);
       // Replace encoded characters
		// ERP-modification: PHP7 deprecated the /e PCRE modifier.
//		$input = preg_replace('/=([a-f0-9]{2})/ie', 
"chr(hexdec('\\1'))", $input);
		$input = preg_replace_callback('/=([a-f0-9]{2})/i', function 
($matches) { return chr(hexdec($matches[1])); }, $input);
       return $input;
   }


Previous Comments:
------------------------------------------------------------------------

[2015-07-21 16:12:20] bchris999

Same problem here with PHP 5.3.3 on CentOS 5.6.

The documentation only mentions and shows examples of calling getXML
statically.

$decoder->getXML(); doesn't work, however
$decoder->getXML($decodeoutput); does work!

------------------------------------------------------------------------

[2011-05-15 12:40:02] doconnor

-Status: Open
+Status: Feedback
-Type:   Bug
+Type:   Documentation Problem
Alex, if you think about it; you already have an instantiated $decoder
variable 
containing a Mail_mimeDecode object - why would you need to call a
static method?

I'll agree that perhaps there is a doc bug or it might need more
examples - where did 
you expect to find usage examples &  didn't?.

------------------------------------------------------------------------

[2011-05-15 04:37:07] aldug

Description:
------------
Calling the getXML () method statically, the only way I can find
documentation to call it, throws a fatal error.

php 5.2.17



Test script:
---------------
$params['include_bodies'] = true;
$params['decode_bodies'] = true;
$params['decode_headers'] = true;

$decoder = new Mail_mimeDecode (file_get_contents ($filename));
$structure = $decoder->decode ($params);
$xml    = Mail_mimeDecode::getXML($structure);

Expected result:
----------------
To get an xml document

Actual result:
--------------
Fatal error: Using $this when not in object context in
/usr/local/php5/lib/php/Mail/mimeDecode.php on line 486

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=18538&edit=1