> No, it just happens to have sent them in the order his browser liked.
>
> ASP can't do anything "different" from PHP.
>
> I used to laugh when ASPers asked why PHP had to do all this extra stuff
> with cookies and stuff to do sessions.  Sigh. :-)
>
> Some browsers will process the headers in one order, others in the
reverse.
>
> Some will see the Location: and ignore the rest.
>
> You can't do both and support all browsers.

Actually Richard, I'll have to disagree. I replied to Chris Shiflett
privately but perhaps I should cc my reply to the group (it is rather
lengthy & I hate cluttering mailboxes). The long and the short of it is
that, after analysing the data returned to the browser from both ASP and
PHP, there is a difference. Essentially, the redirect headers are identical
(including the status code), but ASP appends the rest of the header
including the "Set-Cookie" header and the Cache requirements. While some of
this data is no doubt redundant it allows the the browser to process the
cookie correctly. I tested this on numerous different browsers (IE,
Netscape, Opera, Mozilla and NeoPlanet) and in all cases without exception,
the ASP script worked and the PHP didn't.

Unless returning all the headers as ASP does totally deviates from the HTML
protocol specification, why not make PHP a more well-rounded product and
include this functionality? Just because using "goto" is bad programming
practice and should be avoided (like the plague!), it has stopped it being
included in most decent languages...


> Re-design and re-factor your code so you don't need to re-direct. :-)

Please understand that I am not defending ASP in any way - I am merely
pointing out that there *is* a difference in the way that the two languages
process the pages. Frankly, I believe that ASP is very poor as scripting
languages go and have spent 3 months motivating a move to PHP. I am not
however that proficient in PHP yet (although I already know more PHP than
ASP) and cannot afford the time it would require to "re-design and
re-factor" all of my code to avoid using redirects and accomodate PHP
idiosyncrasies.

In my mind, the migration from one scripting language to another should
really be a case of changing language syntax. It took three hours to convert
all my code from ASP-based to PHP-based scripting. If PHP wants to gain
market share, this is the kind of bonus a developer is looking for.


> I'm sure a zillion people will disagree with this "rule"   I can only say
> that when I started focussing on what my code was *really* doing, and
really
> factoring out the common things, and organizing my pages better, the
> header("Location: ...") tool got thrown out (mostly) of my tool box.

I agree 100%. There is no excuse for poor programming, and no substitute for
good programming. But, that comes with experience in the language and as one
learns the ins and outs of the environment one can improve one's code. And,
since I don't do anything but sleep between 3am and 6am, I may just
redevelop the legacy code into a better solution.. :)

Kind regards,
Cord




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to