[wp-hackers] wp_enqueue_script() and URLs with 2+ parameters

Mike Schinkel mikeschinkel at newclarity.net
Fri Feb 27 21:04:32 GMT 2009


Interestingly I just clicked on the link in my email client for this and it worked:

   http://mikeschinkel.com/url-encoding-issue.php?foo=1&bar=2

If that happens to you acut & paste the exact URL into your browser to see how "bar" doesn't get a value.

-Mike Schinkel
http://mikeschinkel.com/

----- Original Message -----
From: "Mike Schinkel" <mikeschinkel at newclarity.net>
To: wp-hackers at lists.automattic.com
Sent: Friday, February 27, 2009 3:39:23 PM GMT -05:00 US/Canada Eastern
Subject: Re: [wp-hackers] wp_enqueue_script() and URLs with 2+ parameters

"Matt Martz" <mdmartz at sivel.net> wrote:
> So I'm not sure I understand what the problem with having 
> the & replaced with &#038; is.

The problem is that &#038; is not a valid parameter separator for a URL, in PHP or the RFC that defines URLs.  Here is a test file that demonstrates:

<?php
   header('Content-Type:text/plain');
   echo "\nFoo=" . $_GET['foo'];
   echo "\nBar=" . $_GET['bar'];
?>

You can test it to see the results currently here:

   http://mikeschinkel.com/url-encoding-issue.php?foo=1&#038;bar=2
   http://mikeschinkel.com/url-encoding-issue.php?foo=1&bar=2

The following example provides two files (one HTML, one PHP that returns Javascript) illustrates the problem more closely for my use-case:

   http://mikeschinkel.pastebin.com/f24b7cc23

"Glenn Ansley" <glenn at glennansley.com> wrote:
> I think this is a fairly limited use and may not be necessary 
> for core. 

While I've learned that discussions of something being in core are somewhat, ahem,  volatile I would argue once that this is a problem even if an uncommon case because it doesn't allow valid URLs and this goes against the RFC standard for URLs. But that's all I'll say on this subject that lest I be accused of causing trouble on the list again.

-Mike Schinkel
http://mikeschinkel.com/

_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list