From:             r dot wilczek at web-appz dot de
Operating system: Windows XP Prof.
PHP version:      5.0.0
PHP Bug Type:     Session related
Bug description:  trans-sid randomly not added to forms

Description:
------------
Sometimes I encounter the strange behaviour that PHP does not add an 
<input type="hidden" name="PHPSESSID" value="6745etcetc" />
in forms having additional whitespaces in the <form>-tag.

I like to have forms readable and often write them like shown in
tmplt_button_form.php below.

Sometimes it works; sometimes I have to strip all additional whitespaces
from the opening <form>-tag to make PHP rewriting the HTML-output. 
Switching output-buffering on and off did not change the effect. Had the
same phenomenon in PHP 4 before.

So my workaround for now is not to write
<form method="post" 
      action="[-- URL --]">

but 
<form method="post" action="[-- URL --]">

- Roland

Reproduce code:
---------------
// The method ...
function HTMLButton($url, $action, $comment)
{
    $file  = 'templates/tmplt_button_form.php';
    $tmplt = implode('', file($file));
    $replace = array(
           '[-- URL --]'     => htmlentities($url),
           '[-- ACTION --]'  => htmlentities($action),
           '[-- COMMENT --]' => htmlentities($comment)
    );
    echo strtr($tmplt, $replace);
}

-- The file tmplt_button_form.php: --

<form method="post" 
      action="[-- URL --]">
 <input type="hidden" 
        name="myaction" 
        value="[-- ACTION --]">
 <input type="submit" 
        value="[-- COMMENT --]">
</form>

Expected result:
----------------
<form method="post" 
      action="http://www.default.com";><input type="hidden"
name="PHPSESSID" value="6745135150906f4748b27d0cbe43d99a" />
 <input type="hidden" 
        name="myaction" 
        value="someAction">
 <input type="submit" 
        value="Just do it!">
</form>

Actual result:
--------------
<form method="post" 
      action="http://www.default.com";>
 <input type="hidden" 
        name="myaction" 
        value="someAction">
 <input type="submit" 
        value="Just do it!">
</form>

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

Reply via email to