ID: 11403
User Update by: [EMAIL PROTECTED]
Status: Bogus
Bug Type: *Session related
Operating system: linux
PHP Version: 4.0.4pl1
Description: calling session_start with protected images sends bogus headers
adding
session_cache_limiter("private");
before
session_start();
fixed the problem.
<?
session_cache_limiter("private");
session_start();
$filename = "test.jpg";
$fd = fopen ($filename, "rb");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
Header ("Content-type: image/jpeg");
echo $contents;
?>
Previous Comments:
---------------------------------------------------------------------------
[2001-06-19 12:44:33] [EMAIL PROTECTED]
And update to php 4.0.5
---------------------------------------------------------------------------
[2001-06-19 12:43:43] [EMAIL PROTECTED]
1. I am NOT using IE here. I tested this with
IE now, and it works just fine.
2. Works also with Opera.
3. Works also with Mozilla.
I suggest you check your php.ini settings.
---------------------------------------------------------------------------
[2001-06-12 13:08:48] [EMAIL PROTECTED]
adding
Header ("Content-type: image/jpeg");
does NOT fix the problem.
copy the "fixed" script to a new file name, and see that it does not work.
you are looking at cached version. IE will cache the mimetype info associated with
the image even if you clear your history. I am able to reproduce this consistantly on
multiple machines
---------------------------------------------------------------------------
[2001-06-12 01:45:23] [EMAIL PROTECTED]
This works:
<?
session_start();
$filename = "test.jpg";
$fd = fopen ($filename, "rb");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
Header ("Content-type: image/jpeg");
echo $contents;
?>
---------------------------------------------------------------------------
[2001-06-11 14:12:23] [EMAIL PROTECTED]
This script works as expected:
<?
$filename = "someimage.jpg";
$fd = fopen ($filename, "rb");
echo $contents = fread ($fd, filesize ($filename));
fclose ($fd);
?>
Adding sesion start sends bogus header infromation that makes IE think the file is a
bitmap. When right clicking on the image, IE thinks the file is of type .bmp and the
Protocol is HTML. Does the same thing for all image types. Adding header information
in the script does not fix the problem, nor does setting default_mimetype to the
"image/jpeg" in the script.
I was able to reproduce this on 4 different linux machines running 4.0.2, 4.0.4p1, and
4.0.5
<?
session_start();
$filename = "someimage.jpg";
$fd = fopen ($filename, "rb");
echo $contents = fread ($fd, filesize ($filename));
fclose ($fd);
?>
---------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view the rest of the
comments, please view the bug report online.
Full Bug description available at: http://bugs.php.net/?id=11403
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]