note 31782 added to ref.session
| From: | spooooom at hotmail dot com | Date: | Sat, 03 May 2003 14:54:03 +0000 |
| Subject: | note 31782 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47442@lists.php.net to get a copy of this message | ||
I was recently working on a project using sessions and I wanted to make it XHTML 1.1 compliant.
However, PHP had its own ideas. ;)
When using sessions, and especially when used via the W3C validator script (which doesn't allow
cookies to be set), PHP inserts the session ID in a few different ways.
In links:
<a href="forum.php?fid=1&PHPSESSID=df88be559beb18f9e5ccb2adb6d80922">
This is invalid in XHTML 1.0 Strict or 1.1 because it tries to use PHPSESSID as an HTML entity, such
as (and of course fails and generates a few errors). To fix, set
arg_seperator.output = "&"
in php.ini, put
php_flag arg_seperator.output "&"
in your .htaccess, or use
ini_set("arg_seperator.output", "&");
somewhere in your code (before session_start();).
In forms:
<form id="clockform" action="nonenaddazipzeroblah.php"><input
type="hidden" name="PHPSESSID"
value="df88be559beb18f9e5ccb2adb6d80922" />
This is invalid in 1.0 Strict or 1.1 because elements in the form need to be inside a block level
element, such as <div> (which, from my testing, needs to be inside the form). To fix, set
session.use_trans_sid = 0
in php.ini, put
php_flag session.use_trans_sid off
in your .htaccess, or use
ini_set("session.use_trans_sid", "0");
somewhere in your code (before session_start();).
--
http://www.php.net/manual/en/ref.session.php
http://master.php.net/manage/user-notes.php?action=edit+31782
http://master.php.net/manage/user-notes.php?action=delete+31782
http://master.php.net/manage/user-notes.php?action=reject+31782