473,804 Members | 3,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1307
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
808
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 .txt-file in which the data is structured in that way: Project-Nr. ID name lastname 33 9 Lars Lundel 33 12 Emil Korla
26
4490
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 .txt-file in which the data is structured in that way: Project-Nr. ID name lastname 33 9 Lars Lundel 33 12 Emil Korla
9
14125
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). so i wonder is there any faster way to parse string(char array) into float number.
3
2086
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
4738
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 format: struct mst_ {
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10325
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.