php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28004 Post data weirdly disappearing when stored in a session
Submitted: 2004-04-15 06:54 UTC Modified: 2004-04-15 09:44 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: kevin at cayenne dot co dot uk Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.3.6RC3 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2004-04-15 06:54 UTC] kevin at cayenne dot co dot uk
Description:
------------
Provided is the source for 3 files: bug0.html submits a form to bug1.html, which then stores the post'd data in a session.  A form in bug1.html submits to bug2.html (with no post variables), but the session data is blank where it should have contained the post data from bug0.html (this is more clear if you read the source code).  If the session is inspected in bug1.html, it is as expected, however the file written to /tmp/ is not.

The weird thing is this: there is a style tag in bug1.html which contains a line "@import url()".  This is outside the PHP, and shouldn't affect anything to do with the PHP parsing / running.  If the @import line is removed, the session data gets written properly.

If a better explanation / demo is needed, please feel free to ask.


Reproduce code:
---------------
bug0.html:

<form method="post" action="bug1.html">
      <input name="info" type="hidden" value="baa baa black sheep" />
      <input type="submit" value="  OK  " />
</form>

bug1.html:

<?php
	session_start();
?>

<style>
 @import url();
</style>

<?php
	$_SESSION['blah1'] = $_POST['info'];
	$_SESSION['blah2'] = "Look at this: ".$_POST['info'];
	echo "<pre>";print_r($_SESSION);echo "</pre>";
?>
	<form method="post" action="bug2.html">
		<input type="submit" value="   OK   " />
	</form>

bug2.html:

<?php
    session_start();
    echo "<pre>";print_r($_SESSION);exit;
?>


Expected result:
----------------
In bug1.html:

Array
(
    [blah1] => baa baa black sheep
    [blah2] => Look at this: baa baa black sheep
)

In bug2.html:

Array
(
    [blah1] => baa baa black sheep
    [blah2] => Look at this: baa baa black sheep
)


Actual result:
--------------
In bug1.html:

Array
(
    [blah1] => baa baa black sheep
    [blah2] => Look at this: baa baa black sheep
)

In bug2.html:

Array
(
    [blah1] => 
    [blah2] => Look at this: 
)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-15 06:57 UTC] kevin at cayenne dot co dot uk
I forgot to mention, due to limitations at my work I have only tested this on 4.3.6RC2 but there was no option for that on the drop-down.  I have also experienced this bug on 4.2.3 at another site.
 [2004-04-15 08:15 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Yes, any "outside" stuff can and will affect this since it can disable sending some cookie, etc. Ask further support questions elsewhere.

 [2004-04-15 08:30 UTC] kevin at cayenne dot co dot uk
I don't think that it's anything to do with cookies etc; all other session stuff works fine (I can add other session variables, initiate a different session) and if I delete the file from /tmp/ and/or the cookie from my browser then a new session gets started properly.

The main reason why I think it's a scripting engine bug is that the behaviour of the script changes depending upon the @import line.  This shouldn't have anything to do with PHP, it's an instruction to my browser, yet the PHP behaves differently for these two lines:
 @import url(); (PHP session does not work properly)
 @import url("nothing.css"); (PHP session works)

These lines are not in a PHP tag, or a PHP { } block, and the weird behaviour still exists whether I have output buffering on or not.  The session output being printed to my browser is different to what's being written to the /tmp/ file; surely that's a bug?
 [2004-04-15 09:44 UTC] sniper@php.net
Improper HTML / CSS causes all kinds of weird things. Still not PHP bug.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 08:01:28 2024 UTC