String parsing bug

This is a discussion on String parsing bug within the PHP Language forums, part of the PHP Programming Forums category; Hi, I'm trying to track down why some recipients of our emails never receive them. These emails are sent ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-11-2006
ooba gooba
 
Posts: n/a
Default 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 = 'address@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=[address@domain.com]
1: Return-path:
2: Return-path:
3: Return-path:
4: Return-path:
5: Return-path: <[address@domain.com]>
6: Return-path: [address@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?
Reply With Quote
  #2 (permalink)  
Old 09-11-2006
Rik
 
Posts: n/a
Default Re: String parsing bug

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 = 'address@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=[address@domain.com]
> 1: Return-path:
> 2: Return-path:
> 3: Return-path:
> 4: Return-path:
> 5: Return-path: <[address@domain.com]>
> 6: Return-path: [address@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


Reply With Quote
  #3 (permalink)  
Old 09-11-2006
ooba gooba
 
Posts: n/a
Default Re: String parsing bug

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 = 'address@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=[address@domain.com]
>> 1: Return-path:
>> 2: Return-path:
>> 3: Return-path:
>> 4: Return-path:
>> 5: Return-path: <[address@domain.com]>
>> 6: Return-path: [address@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,

Reply With Quote
  #4 (permalink)  
Old 09-12-2006
Norman Peelman
 
Posts: n/a
Default Re: String parsing bug

>
> 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 = 'address@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=[address@domain.com]
> >> 1: Return-path:
> >> 2: Return-path:
> >> 3: Return-path:
> >> 4: Return-path:
> >> 5: Return-path: <[address@domain.com]>
> >> 6: Return-path: [address@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" <nospam@nojunk.com> wrote in message
news:eOednXP_1twUVJjYnZ2dnUVZ_qadnZ2d@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:
address@my.site.com' instead of Return-path...

Norm


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:40 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0