RE: base64-encoding in cookies?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Fletcher Mattox [mailto:fletcher@xxxxxxxxxxxxx]
> Sent: Wednesday, February 07, 2007 2:49 PM
> To: php-general@xxxxxxxxxxxxx
> Subject: Re:  base64-encoding in cookies?
> 
> I wrote:
> 
> > A campus web server (not under my control) returns an authentication
> > string in a cookie named AUTH.  The cookie's value is an encrypted,
> > base64 encoded string.  Unfortunately, when I examine $_COOKIE['AUTH'],
> > it is clear that all of the '+' characters have been replaced with a ' '
> > character in the base64 string.  Why is this?  Obviously, this corrupts
> > the data and makes it impossible to base64-decode the string correctly.
> > I believe this is a php issue and not, say, an apache issue because a
> > perl program can correctly authenticate the same cookie based on perl's
> > $ENV{'HTTP_COOKIE'}.  i.e., the perl cookie contains the original '+'.
> > Does anyone know how to make php (v5.1.5) do the right thing with base64
> > encoded cookies?
> 
> This problem seems to be
> 
> 	http://bugs.php.net/bug.php?id=35523
> 
> where it was dismissed as "Bogus" without any explanation why.  It seems
> that '+' characters are intentionally converted to spaces in all cookies.
> This makes no sense to me.  Can someone explain it?
> 
> Thanks,
> Fletcher
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Could it have something to do with url encoding?

For example:
http://example.com/page.php?foo=ABC+123

echo $_GET['foo']; // should produce: ABC 123

http://example.com/page.php?foo=ABC%2B123

echo $_GET['foo']; // should produce: ABC+123

HTH,

Brad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux