From:             kevin at cayenne dot co dot uk
Operating system: Gentoo Linux
PHP version:      4.3.6RC3
PHP Bug Type:     Scripting Engine problem
Bug description:  Post data weirdly disappearing when stored in a session

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: 

)





-- 
Edit bug report at http://bugs.php.net/?id=28004&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28004&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28004&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28004&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28004&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28004&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28004&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28004&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28004&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28004&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28004&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28004&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28004&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28004&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28004&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28004&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28004&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28004&r=float

Reply via email to