[wp-hackers] Minor WP::build_query_string() refactor

Adam Maccabee Trachtenberg adam at trachtenberg.com
Fri May 18 20:41:00 GMT 2007

Here is a minor patch to make the WP::build_query_string() method
slightly more clear, efficient, and correct. (As best I can tell.)


I didn't see any specific tests for this method, but I get the same
results with my version using the following sample test data:

$wp = new wp;
$wp->query_vars = array('a' => 'a', 'b' => array(), 'c' => '', 'd' => 'd d');

The only difference is WP will no longer generate consecutive "&"
characters when presented with a non-scalar value. I think this is
better behavior than before, and should not break anything.

Please let me know if there is a specific reason for the various hoop
jumping in the method (I did not do a full review to check inputs and
outputs), or if there is a preferred method of submitting patches
beyond sending them to this list.


PS: This is against 2.2.

adam at trachtenberg.com | http://www.trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!

More information about the wp-hackers mailing list