473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

String parsing bug

Hi,

I'm trying to track down why some recipients of our emails never receive
them. These emails are sent from a PHP script which uses the 3rd party
phpmailer class. The possible cause for the email problem is that the
email headers have an invalid "Return-path". This is due to an apparent
bug in PHP, which I have replicated as follows:

The following code:

class Bug
{
var $From = 'a******@domain.com';

function Test()
{
echo "FROM=[$this->From]<br>";

$returnpath = "Return-path: <$this->From>\n";
echo "1: $returnpath<br>";

$returnpath = "Return-path: <{$this->From}>\n";
echo "2: $returnpath<br>";

$returnpath = 'Return-path: <'.$this->From.">\n";
echo "3: $returnpath<br>";

$returnpath = 'Return-path: '.'<'.$this->From.">\n";
echo "4: $returnpath<br>";

$returnpath = 'Return-path: <['.$this->From."]>\n";
echo "5: $returnpath<br>";

$returnpath = "Return-path: [$this->From]\n";
echo "6: $returnpath<br>";
}
}

$instance = new Bug();
$instance->Test();

Results in this output:

FROM=[ad*****@domain.com]
1: Return-path:
2: Return-path:
3: Return-path:
4: Return-path:
5: Return-path: <[ad*****@domain.com]>
6: Return-path: [ad*****@domain.com]

It appears that everything after the < character in the string is
getting truncated. I have so far been unable to generate a valid
Return-path string. My web host is using PHP 4.4.2. I have attached a
sample PHP file that replicates this bug. Does anyone know if this bug
still exists in 4.4.4?
Sep 11 '06 #1
3 1289
Rik
ooba gooba wrote:
Hi,

I'm trying to track down why some recipients of our emails never
receive them. These emails are sent from a PHP script which uses the
3rd party phpmailer class. The possible cause for the email problem
is that the email headers have an invalid "Return-path". This is due
to an apparent bug in PHP, which I have replicated as follows:

The following code:

class Bug
{
var $From = 'a******@domain.com';

function Test()
{
echo "FROM=[$this->From]<br>";

$returnpath = "Return-path: <$this->From>\n";
echo "1: $returnpath<br>";

$returnpath = "Return-path: <{$this->From}>\n";
echo "2: $returnpath<br>";

$returnpath = 'Return-path: <'.$this->From.">\n";
echo "3: $returnpath<br>";

$returnpath = 'Return-path: '.'<'.$this->From.">\n";
echo "4: $returnpath<br>";

$returnpath = 'Return-path: <['.$this->From."]>\n";
echo "5: $returnpath<br>";

$returnpath = "Return-path: [$this->From]\n";
echo "6: $returnpath<br>";
}
}

$instance = new Bug();
$instance->Test();

Results in this output:

FROM=[ad*****@domain.com]
1: Return-path:
2: Return-path:
3: Return-path:
4: Return-path:
5: Return-path: <[ad*****@domain.com]>
6: Return-path: [ad*****@domain.com]

It appears that everything after the < character in the string is
getting truncated. I have so far been unable to generate a valid
Return-path string. My web host is using PHP 4.4.2. I have attached
a sample PHP file that replicates this bug. Does anyone know if this
bug still exists in 4.4.4?
I highly doubt it.
Browsers usually hide everything in beteween the <>.
Look at the source of the page, and probably all data is there like it
should be.

If you're curious what headers are sent, send yourself an email, and check
it's headers. Don't try to emulate them in a browser. Aside from the fact
that a browser has got his own logic you can't trace the path/possible
added headers by either your or another server.

Grtz,
--
Rik Wasmus
Sep 11 '06 #2
Doh. You're right. It still doesn't explain why the return-path header
doesn't appear in the received email. <sigh>

Thanks, Rik.

Rik wrote:
ooba gooba wrote:
>Hi,

I'm trying to track down why some recipients of our emails never
receive them. These emails are sent from a PHP script which uses the
3rd party phpmailer class. The possible cause for the email problem
is that the email headers have an invalid "Return-path". This is due
to an apparent bug in PHP, which I have replicated as follows:

The following code:

class Bug
{
var $From = 'a******@domain.com';

function Test()
{
echo "FROM=[$this->From]<br>";

$returnpath = "Return-path: <$this->From>\n";
echo "1: $returnpath<br>";

$returnpath = "Return-path: <{$this->From}>\n";
echo "2: $returnpath<br>";

$returnpath = 'Return-path: <'.$this->From.">\n";
echo "3: $returnpath<br>";

$returnpath = 'Return-path: '.'<'.$this->From.">\n";
echo "4: $returnpath<br>";

$returnpath = 'Return-path: <['.$this->From."]>\n";
echo "5: $returnpath<br>";

$returnpath = "Return-path: [$this->From]\n";
echo "6: $returnpath<br>";
}
}

$instance = new Bug();
$instance->Test();

Results in this output:

FROM=[ad*****@domain.com]
1: Return-path:
2: Return-path:
3: Return-path:
4: Return-path:
5: Return-path: <[ad*****@domain.com]>
6: Return-path: [ad*****@domain.com]

It appears that everything after the < character in the string is
getting truncated. I have so far been unable to generate a valid
Return-path string. My web host is using PHP 4.4.2. I have attached
a sample PHP file that replicates this bug. Does anyone know if this
bug still exists in 4.4.4?

I highly doubt it.
Browsers usually hide everything in beteween the <>.
Look at the source of the page, and probably all data is there like it
should be.

If you're curious what headers are sent, send yourself an email, and check
it's headers. Don't try to emulate them in a browser. Aside from the fact
that a browser has got his own logic you can't trace the path/possible
added headers by either your or another server.

Grtz,
Sep 11 '06 #3
>
Rik wrote:
ooba gooba wrote:
Hi,

I'm trying to track down why some recipients of our emails never
receive them. These emails are sent from a PHP script which uses the
3rd party phpmailer class. The possible cause for the email problem
is that the email headers have an invalid "Return-path". This is due
to an apparent bug in PHP, which I have replicated as follows:

The following code:

class Bug
{
var $From = 'a******@domain.com';

function Test()
{
echo "FROM=[$this->From]<br>";

$returnpath = "Return-path: <$this->From>\n";
echo "1: $returnpath<br>";

$returnpath = "Return-path: <{$this->From}>\n";
echo "2: $returnpath<br>";

$returnpath = 'Return-path: <'.$this->From.">\n";
echo "3: $returnpath<br>";

$returnpath = 'Return-path: '.'<'.$this->From.">\n";
echo "4: $returnpath<br>";

$returnpath = 'Return-path: <['.$this->From."]>\n";
echo "5: $returnpath<br>";

$returnpath = "Return-path: [$this->From]\n";
echo "6: $returnpath<br>";
}
}

$instance = new Bug();
$instance->Test();

Results in this output:

FROM=[ad*****@domain.com]
1: Return-path:
2: Return-path:
3: Return-path:
4: Return-path:
5: Return-path: <[ad*****@domain.com]>
6: Return-path: [ad*****@domain.com]

It appears that everything after the < character in the string is
getting truncated. I have so far been unable to generate a valid
Return-path string. My web host is using PHP 4.4.2. I have attached
a sample PHP file that replicates this bug. Does anyone know if this
bug still exists in 4.4.4?
I highly doubt it.
Browsers usually hide everything in beteween the <>.
Look at the source of the page, and probably all data is there like it
should be.

If you're curious what headers are sent, send yourself an email, and
check
it's headers. Don't try to emulate them in a browser. Aside from the
fact
that a browser has got his own logic you can't trace the path/possible
added headers by either your or another server.

Grtz,
"ooba gooba" <no****@nojunk.comwrote in message
news:eO******************************@comcast.com. ..
Doh. You're right. It still doesn't explain why the return-path header
doesn't appear in the received email. <sigh>

Thanks, Rik.
Have you tried it without the < in the string? Although I use 'Reply-to:
ad*****@my.site.com' instead of Return-path...

Norm
Sep 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Kai Jaensch | last post by:
Hello, i am an newbie and i have to to solve this problem as fast as i can. But at this time i donīt have a lot of success. Can anybody help me (and understand my english :-))? I have a...
26
by: Kai Jaensch | last post by:
Hello, i am an newbie and i have to to solve this problem as fast as i can. But at this time i donīt have a lot of success. Can anybody help me (and understand my english :-))? I have a...
9
by: Python.LeoJay | last post by:
Dear all, i need to parse billions of numbers from a file into float numbers for further calculation. i'm not satisfied with the speed of atof() function on my machine(i'm using visual c++ 6)....
3
by: dimasteg | last post by:
Hi all C. Nead some help with string "on the fly" parsing, how it can be realized ? Any ideas? I got some of my own, but it's interesting to get other points of view . Regards.
6
by: (2b|!2b)==? | last post by:
I am expecting a string of this format: "id1:param1,param2;id2:param1,param2,param3;id" The tokens are seperated by semicolon ";" However each token is really a struct of the following...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.