php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24805 skip_long_header_sep routine break email
Submitted: 2003-07-25 12:14 UTC Modified: 2003-08-09 09:39 UTC
From: bobe at phpcodeur dot net Assigned:
Status: No Feedback Package: Mail related
PHP Version: 4.3.2 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bobe at phpcodeur dot net
New email:
PHP Version: OS:

 

 [2003-07-25 12:14 UTC] bobe at phpcodeur dot net
Description:
------------
Hello, 

The problem arises when we envoit an email with the subject encoded in quoted-printable and of type "long header". 

skip_long_header_sep routine accept accepts only the separations \r\n<LWS> but on some systems, it doubles the line feed in the header: 

to test, send a long subject on a linux system

Reproduce code:
---------------
From - Fri Jul 25 18:53:24 2003
X-UIDL: 1059152088.14117.wsa-2037,S=4715
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Return-Path: <test@domain.tld>
Delivered-To: test2@domain.tld
Received: (qmail 14115 invoked by uid 99); 25 Jul 2003 16:54:48 -0000
To: Undisclosed-recipients: ;
Subject: =?iso-8859-1?Q?ceci_est_un_petit_test_pour_d=E9terminer_les_bugs_?=

 =?iso-8859-1?Q?existants_avec_la_classe_mail?=
Date: Fri, 25 Jul 2003 18:54:48 +0200
From: "test" <test@domain.tld>
X-Env: Linux - Apache PHP/4.3.2
MIME-Version: 1.0
Message-ID: <h9VYpi7ADcC2VuPJHlFs3VJEE3jiyx@domain.tld>
Content-Type: multipart/mixed;
	boundary="-----=_Part0_6fEwBy2N74yqUJ0vNbQYrw0HBJrhLT--"

This is a multi-part message in MIME format.

Expected result:
----------------
simply that subject of mail correctly display

Actual result:
--------------
the headers undo the long sybject aren't interpreted

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-25 12:22 UTC] bobe at phpcodeur dot net
Sorry for the bad translation :/
note that quoted-printable encoding plays no role in the problem
 [2003-07-25 17:46 UTC] iliaa@php.net
Where is the bug occuring imap, or something else? Who does the message parsing?
 [2003-07-26 05:31 UTC] bobe at phpcodeur dot net
The bug occurs for example with this code :

mail(
'test@domain.tld',
"=?iso-8859-1?Q?ceci_est_un_petit_test_pour_d=E9terminer_les_bugs_?=\r\n =?iso-8859-1?Q?existants_avec_la_classe_mail?=",
'This is the message',
"From: my@domain.tld\nMIME-Version: 1.0"
);

result is : 
------------
 =?iso-8859-1?Q?existants_avec_la_classe_mail?=
From: my@domain.tld
MIME-Version: 1.0

This is the message.
------------

Maybe that the problem occurs with qmail because there are sequences \r\n instead of \n in long subject ?
 [2003-07-26 20:17 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The separator for long headers should be "\r\n" followed by either a space or a "\t" no other character such as "\n" or "\r" will be accepted. If you don't use tab or a space entire sequence will be converted to spaces.
 [2003-07-27 10:37 UTC] bobe at phpcodeur dot net
"The separator for long headers should be "\r\n" followed by either a
space or a "\t""

It is exactely what i do..
The bug tracker put the long subject of my previous example on 2 lines but it is a sequence \r\n<SP>

This code also reproduces the bug : 

mail(
  'bobe@phpcodeur.net',
  "this is a long subject \r\n to test the mail function",
  'This is the message',
  "From: my@domain.tld\nMIME-Version: 1.0"
);
 [2003-07-27 12:30 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

It works perfectly on 4.3.3dev for me.
 [2003-07-27 19:30 UTC] bobe at phpcodeur dot net
The problem does not appear under Windows, and I can't update php on the server where I test :/.

But probably, the sequence \r\n provokes a problem with sendmail and/or qmail. 
It should be \n, not ?

( Skip_long_header_sep was not modifyed between php 4.3.2 and 4.3.3dev, and I see anybody that sequences \r\n are transformed \n before the sending in sendmail/qmail)
 [2003-07-27 22:05 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

I am using qmail as well as sendmail and in both cases the code works fine.
 [2003-07-29 12:55 UTC] bobe at phpcodeur dot net
mhh, and if you test with an address on the same server (and qmail). 

the test script on domain.tld and the "to" address example@domain.tld

What is the result ?
 [2003-07-30 10:31 UTC] bobe at phpcodeur dot net
Sorry, i re-open this bug
 [2003-07-30 11:08 UTC] sniper@php.net
Sorry, I re-bogus this bug.
(you're not using latest CVS, we are, it works.)

 [2003-07-31 09:42 UTC] bobe at phpcodeur dot net
Mhh, there is no difference between the version 4.3.2 and the lastest version except this: 
http://cvs.php.net/diff.php/php4.fubar/ext/standard/mail.c?login=2&r1=1.71&r2=1.72&ty=h&php=828897d059357e53be222dc10bd8be65

Why the sequence \r\n was replaced by \n here and not in skip_long_header_sep ()?
 [2003-08-04 08:10 UTC] bobe at phpcodeur dot net
No response ? :(
 [2003-08-09 09:39 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC