PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Web Services » SOAP » Bug #5525

Namespace issues: MAIL_MIMEPART_CRLF

Details

Submitted2005-09-26 20:48 UTC
Fromjsirovic at gmail dot com
StatusBogus
PackageSOAP
PHP VersionIrrelevant
OSIrrelevent
Roadmaps(Not assigned)

Comments

[2005-09-26 20:48 UTC] jsirovic at gmail dot com

Description:
------------
Using PEAR::SOAP with PEAR::Mail_mime results in a major issue if you want your mime encoded emails to be correctly formed.

The problem is the fact that the class uses the constant MAIL_MIMEPART_CRLF to designate the proper line seperator.

If you're using Unix, you want \n, not \r\n.

Well, in PEAR::SOAP in /SOAP/Base.php
------------------------------------------
@include_once 'Mail/mimePart.php';
@include_once 'Mail/mimeDecode.php';
if (class_exists('Mail_mimePart')) {
$GLOBALS['SOAP_options']['Mime'] = 1;
define('MAIL_MIMEPART_CRLF', "\r\n");
}
------------------------------------------

it decides what you want. So if you're using Unix, and what to send email somewhere where you're using SOAP, forget it.

This is related, but the converse of

"Bug #466: 'MAIL_MIMEPART_CRLF' is defined as only line break. It must be '\r\n'"

It's the same issue ..., just backwards. At this point, though, it is difficult to fix, because constants are in a global namespace, and really, that's a bad idea for classes. But I won't complain about free code :)

Test script:
---------------
require_once "SOAP/Client.php";
require_once "Mail/mimePart.php";

$x = new Mail_mime("\n");
$y = new Mail_mimePart();

echo MAIL_MIMEPART_CRLF;

Expected result:
----------------
This should not create a dependency. I'd argue PHP constants are a bad idea here.

Not knowing the code, I'd expect \n, but we get \r\n. Even worse, it only affects the mime parts constant MAIL_MIMEPART_CRLF, not MAIL_MIME_CRLF, so you pull your hair out wondering why you only get a \r in one spot in the header.

Actual result:
--------------
\r\n

[2005-09-26 20:53 UTC] jsirovic at gmail dot com

What I said is incorrect, it's not really related in the way I said to bug 466, but quite obviously, if you use Mail_mime and SOAP, the order of declaration will cause one or the other to not be in spec ...