[wp-hackers] Need help upgrading CG-Related plugin to 1.3...

David Chait davebytes at comcast.net
Tue Oct 26 03:26:15 UTC 2004


Okay, so I just found the following code at the top of wp-settings.php:

// Append the query string if it exists and isn't null
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}

Now, the problem is that F***S UP the $_SERVER['REQUEST_URI'] completely for 
something like:
 http:...mysite?p=1
which after the above code becomes
 http:...mysite?p=1?p=1

FIRST, seems overly nasty to be rewriting PHP globals behind the back of 
other code, no?
SECOND, that certainly looks like a 'bug' to me -- two ?'s aren't 'legal' 
URI syntax, are they?  And I can't imagine this being an 'intended result', 
unless there's something really tricky being done.
And, of course, third, it just plain breaks my code!  I can't redirect 
properly to the current page  What is this to enable, that didn't work in 
1.0?  Was the 1.2 code erroneous in that it didn't apply the query string if 
the URI was already set properly by the server/php?  (Since my code seemed 
to be working just fine under 1.2...)

I can think of hacks around this, but I shouldn't be hacking things.  I'm 
also guessing there's a lot more people using nice URIs these days (which 
I'll eventually switch over to!), and thus nasty query string issues like 
this might be missed or something?

Trying to lock-down last test release before gold on the PowerPack, and this 
is hampering things...  Thanks all!

-d

----- Original Message ----- 
From: "David Chait" <davebytes at comcast.net>
To: <hackers at wordpress.org>
Sent: Sunday, October 24, 2004 1:54 AM
Subject: [wp-hackers] Need help upgrading CG-Related plugin to 1.3...


> CG-Related lets you set explicit relations between posts.  I use mini 
> forms/buttons for 'inline' administrative control, so you can set the 
> links just by navigating the site normally -- just that extra 'buttons' 
> appear when needed, where needed.
>
> I've gotten over the hump of $p not necessarily being around, but now I'm 
> running into some weirdness with refreshing the page.
>
> When I want to start adding 'relations' to a given post, there's a form 
> button that gets pressed.  The result of that press is supposed to be a 
> POST from the form, with the form action set to 
> htmlspecialchars($_SERVER["REQUEST_URI"]).  This always worked before...
>
> Now, under 1.3 (well, and running under PHP5 in cases...), when I start 
> with a URI like:
> http://mysite/blog/index.php?p=1
> ... and I click my 'start' button, the resulting page I'm sent to is:
> http://mysite/blog/index.php?p=1?p=1
> ... which drives my code batty!
>
> I have other cases on CG where I've seen this 'multiple concatenation' 
> thing occur -- in fact, one of the search engines seems to have a longer 
> and longer query string each time it hits my site.  But that's old code, 
> and another story... ;)
>
> What exactly SHOULD I be doing to have a form properly post a re-load of 
> the current page, so that I can grab new info from a POST (and from a 
> cookie) so that I properly show/hide buttons or otherwise 'react' to their 
> having been clicked?
> 





More information about the hackers mailing list