View Full Version : Transient SID invalidates my XHTML

01-22-2004, 05:43 PM
I already have an ini_set directive to make it use & for the argument separator, and that prevents XML parsing exceptions:


But when a page has forms, PHP inserts the hidden element as a direct child of <form>, which is not allowed - it should be inside a <fieldset>.

What can I do about that - how can I control where hidden inputs are inserted?

01-22-2004, 08:13 PM
You can achieve that effect by tweaking another configuration option:

ini_set('url_rewriter.tags', 'a=href,area=href,frame=src,fieldset=fakeentry');

Works for me with PHP 4.3.4. Older versions may not be that cooperative (see also the comments on http://bugs.php.net/bug.php?id=13472).

I have to admit I never cared for this issue, as long as browsers ate the session code I threw at them. But I haven't used validating parsers on PHP-generated documents yet, so I shut my mouth now. :)

01-23-2004, 01:35 AM
No exactly - I wasn't particularly concerned until I started throwing PHP-generated code at an XML parser ;)

Anyway ta - that works on my live server which runs 4.3.4 - doesn't work on my local server which is 4.2, but I can live without til I have the time to upgrade it.

Cheers :thumbsup:

01-23-2004, 02:48 PM
to be safe when validating i completely turn off the url_rewriter_tags when the user agent matches that of the validator.

you could also try form=action to have the SID appended onto the querystring in the action attr.

01-23-2004, 02:56 PM
Originally posted by ReadMe.txt
to be safe when validating i completely turn off the url_rewriter_tags when the user agent matches that of the validator.

Kinda defeats the purpose of validating, doesn't it? ;)
And what do you do if you want to use a validating parser on your PHP output?

01-23-2004, 03:04 PM
i dont agree. My code is valid - the cvode added automatically by PHP is not.

The validator doesn't need a sesison sicne it only visits one page at a time, so i cant hurt to not give it the session ID

01-23-2004, 04:20 PM
My point was that it doesn't help you to have valid markup that gets invalidated by PHP, if you think of a crawler that fetches the code directly from your site and tries to process it. It will choke on it. So how do you figure out now what clients will use your markup in the future?

Probably a moot point since we know how to fix that issue anyway. But fixing only the output for the validator is IMO the wrong way to handle it. :)

01-25-2004, 05:43 AM
I agree - if you're gonna do that ... well ... you're just paying lip-service to the idea of validity.

That's fair enough if those are your priorities - but you can't really call that valid code, more like "meta-valid" - it passes the validity test because it cheats.