Bug #10000 Updated: corrupt http_post_vars when using session_start
| From: | sniper@php.net | Date: | Fri, 15 Jun 2001 03:33:03 +0000 |
| Subject: | Bug #10000 Updated: corrupt http_post_vars when using session_start | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-56955@lists.php.net to get a copy of this message | ||
ID: 10000
Updated by: sniper
Reported By: john_rief@yahoo.com
Old-Status: Open
Status: Bogus
Bug Type: *Session related
Operating system:
PHP Version: 4.0.4pl1
Assigned To:
Comments:
Can't reproduce. Get the latest RC from here:
http://www.php.net/~andi/php-4.0.6RC3.tar.gz
(if that doesn't work, try with RC4)
And if it still doesn't work, submit a new bug report,
with SHORT example script. Not over 15 lines..
Previous Comments:
---------------------------------------------------------------------------
[2001-03-26 12:51:46] john_rief@yahoo.com
When posting to a php script using sessions and pdf the HTTP_POST_VARS disappear. If you change the
variable $type to 1, which displays the variables from a text file, everything works fine. Writing
to a pdf file will show empty variables. If the session_start() is commented out, the
HTTP_POST_VARS return.
********Script 1***********
<?php
session_start();
session_register("s_CompanyId");
session_register("s_SiteId");
$s_CompanyId = 1;
$s_SiteId = 2;
?>
<html>
<head><title>s1</title></head>
<body class="svc-sch" onload="javascript: init();">
<form name="claims" method="post" action="s2.php">
<input type="hidden" name="form_name" value="claims">
<input type="hidden" name="site_id" value="<?php echo $s_SiteId;
?>">
<input type="hidden" name="co_id" value="<?php echo $s_CompanyId;
?>">
<input type="submit" name="print" value="Print">
</form>
</body>
</html>
********Script 2***********
<?php
session_start();
$my_site_id = $HTTP_POST_VARS['site_id'];
$my_co_id = $HTTP_POST_VARS['co_id'];
$fn=$HTTP_POST_VARS['form_name'];
// change to $type = 1; works
$type = 0;
$page_width = 612; // width of page
$page_height = 792; // height of page
// open document
if( $type == 0 )
$file_name = "/tmp/claim.pdf";
else if( $type == 1 )
$file_name = "/tmp/claim.txt";
$fp = fopen( $file_name, "w" );
//
// PDF
//
if( $type == 0 )
{
$pdf = PDF_open( $fp );
// begin page
PDF_begin_page( $pdf, $page_width, $page_height ); // 8.5" x 11.0"
$page = $page + 1;
// add bookmark
PDF_add_bookmark( $pdf, $page );
// set font
PDF_set_font( $pdf, "Courier", 10, "host" );
PDF_set_value( $pdf, "textrendering", 0 );
PDF_show_xy( $pdf, "form_name=$fn", 50, 350 );
PDF_show_xy( $pdf, "co_id=$my_co_id", 50, 360 );
PDF_show_xy( $pdf, "site_id=$my_site_id", 50, 370 );
PDF_show_xy( $pdf, "s_CompanyId=$s_CompanyId", 50, 380 );
PDF_show_xy( $pdf, "s_SiteId=$s_SiteId", 50, 390 );
// end page
PDF_end_page( $pdf );
// close document
PDF_close( $pdf );
}
else if( $type == 1 )
{
fwrite( $fp, "form_name=$fnn" );
fwrite( $fp, "co_id=$my_co_idn" );
fwrite( $fp, "site_id=$my_site_idn" );
fwrite( $fp, "s_CompanyId=$s_CompanyIdn" );
fwrite( $fp, "s_SiteId=$s_SiteIdn" );
}
fflush( $fp );
fclose( $fp );
// transmit file
$len = filesize( $file_name );
if( $type == 0 )
header( "Content-Type: application/pdf" );
else if( $type == 1 )
header( "Content-Type: text/plain" );
header( "Content-Length: $len" );
/*
header( "Pragma: " );
header( "Last-Modified: ".gmdate("D, d M Y H:i:s", time())." GMT" );
header( "Expires: ".gmdate("D, d M Y H:i:s", time()+5)." GMT" );
header( "Cache-Control: must-revalidate, max-age=5, s-max-age=5" );
*/
header("Content-Disposition: inline; filename=claims.pdf");
$rtn=readfile( $file_name );
?>
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10000&edit=2