multiple successive URL parameter delimiters?

This is a discussion on multiple successive URL parameter delimiters? within the PHP Language forums, part of the PHP Programming Forums category; I've got a few php pages that I invoke like this: http://sample.php/?parm1=xxx&parm2=yyy&...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-06-2008
Greg N.
 
Posts: n/a
Default multiple successive URL parameter delimiters?

I've got a few php pages that I invoke like this:

http://sample.php/?parm1=xxx&parm2=yyy&parm3=zzz

Sometimes though, I end up with this:

http://sample.php/?&parm2=yyy
^^
Although this seems to work as far as I could test it, it is maybe not
as clean as it should be.

I could add some more code to clean it up. My question is, do I have
to? Why?

Or is this kind of double delimiter (?&) considered valid and harmless?

--
Gregor mit dem Motorrad auf Reisen
http://hothaus.de/greg-tour/
Reply With Quote
  #2 (permalink)  
Old 05-06-2008
Paul Lautman
 
Posts: n/a
Default Re: multiple successive URL parameter delimiters?

Greg N. wrote:
> I've got a few php pages that I invoke like this:
>
> http://sample.php/?parm1=xxx&parm2=yyy&parm3=zzz
>
> Sometimes though, I end up with this:
>
> http://sample.php/?&parm2=yyy
> ^^
> Although this seems to work as far as I could test it, it is maybe not
> as clean as it should be.
>
> I could add some more code to clean it up. My question is, do I have
> to? Why?
>
> Or is this kind of double delimiter (?&) considered valid and
> harmless?


well even the good one is bad
http://sample.php/?parm1=xxx&parm2=yyy&parm3=zzz
should be
http://www.somedomain.com/sample.php...=yyy&parm3=zzz

(note no / before the ? and a domain before the file name)



Reply With Quote
  #3 (permalink)  
Old 05-07-2008
Jerry Stuckle
 
Posts: n/a
Default Re: multiple successive URL parameter delimiters?

Greg N. wrote:
> I've got a few php pages that I invoke like this:
>
> http://sample.php/?parm1=xxx&parm2=yyy&parm3=zzz
>
> Sometimes though, I end up with this:
>
> http://sample.php/?&parm2=yyy
> ^^
> Although this seems to work as far as I could test it, it is maybe not
> as clean as it should be.
>
> I could add some more code to clean it up. My question is, do I have
> to? Why?
>


Only if you want it to work correctly. This is not according to the
specs, so it's up to every browser on how to interpret it.

> Or is this kind of double delimiter (?&) considered valid and harmless?
>


No, it is not valid. And you should not have to add code to "clean it
up". You shouldn't be generating it in the first place.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #4 (permalink)  
Old 05-07-2008
Michael Fesser
 
Posts: n/a
Default Re: multiple successive URL parameter delimiters?

..oO(Jerry Stuckle)

>Greg N. wrote:
>> I've got a few php pages that I invoke like this:
>>
>> http://sample.php/?parm1=xxx&parm2=yyy&parm3=zzz
>>
>> Sometimes though, I end up with this:
>>
>> http://sample.php/?&parm2=yyy
>> ^^
>> Although this seems to work as far as I could test it, it is maybe not
>> as clean as it should be.
>>
>> I could add some more code to clean it up. My question is, do I have
>> to? Why?
>>

>
>Only if you want it to work correctly. This is not according to the
>specs


Which spec?

>so it's up to every browser on how to interpret it.


The query string is interpreted by the server, the browser has nothing
to do with that.

>> Or is this kind of double delimiter (?&) considered valid and harmless?
>>

>
>No, it is not valid. And you should not have to add code to "clean it
>up". You shouldn't be generating it in the first place.


It's not forbidden by the RFCs. The "?" correctly delimits the query
from the path, and the query itself is just a string. AFAIK the meaning
of the "&" inside of the query is not even defined in any RFC, it's just
common sense to use it as a separator between the parameters.

Micha
Reply With Quote
  #5 (permalink)  
Old 05-07-2008
Jerry Stuckle
 
Posts: n/a
Default Re: multiple successive URL parameter delimiters?

Michael Fesser wrote:
> .oO(Jerry Stuckle)
>
>> Greg N. wrote:
>>> I've got a few php pages that I invoke like this:
>>>
>>> http://sample.php/?parm1=xxx&parm2=yyy&parm3=zzz
>>>
>>> Sometimes though, I end up with this:
>>>
>>> http://sample.php/?&parm2=yyy
>>> ^^
>>> Although this seems to work as far as I could test it, it is maybe not
>>> as clean as it should be.
>>>
>>> I could add some more code to clean it up. My question is, do I have
>>> to? Why?
>>>

>> Only if you want it to work correctly. This is not according to the
>> specs

>
> Which spec?
>
>> so it's up to every browser on how to interpret it.

>
> The query string is interpreted by the server, the browser has nothing
> to do with that.
>
>>> Or is this kind of double delimiter (?&) considered valid and harmless?
>>>

>> No, it is not valid. And you should not have to add code to "clean it
>> up". You shouldn't be generating it in the first place.

>
> It's not forbidden by the RFCs. The "?" correctly delimits the query
> from the path, and the query itself is just a string. AFAIK the meaning
> of the "&" inside of the query is not even defined in any RFC, it's just
> common sense to use it as a separator between the parameters.
>
> Micha
>


I'd have to look up the RFC's, but it's too late tonight.

But basically, '?' is defined as the separator between the URI and the
query string. '&' is defined as the separator between query parameters.
It is invalid immediately following the '?' because there is no
parameter preceding it.

It may work in the current release the op is using, but I wouldn't
guarantee it to work in all releases.

But you're right - it isn't interpreted by the browser - my mistake.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:59 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0