﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
9044	http_build_query: third arg not added until PHP v. 5.1.2	mediafetish		"In wp-includes/compat.php:
{{{
// Added in PHP 5.0

if (!function_exists('http_build_query')) {
	function http_build_query($data, $prefix=null, $sep=null) {
		return _http_build_query($data, $prefix, $sep);
	}
}
}}}
But according to: http://us2.php.net/http_build_query

The third argument wasn't added until PHP Version 5.1.2

This caused my install to fail when trying to use the automatic plugin upgrade function. In research, I found several occurrences of others fighting with this error:
{{{
Warning: http_build_query() expects at most 2 parameters, 3 given in /stor/ezines/htdocs/wp-includes/http.php on line 248
}}}
Line 248 has:
{{{
$r['body'] = http_build_query($r['body'], null, '&');
}}}
I believe this should call _http_build_query:
{{{
$r['body'] = _http_build_query($r['body'], null, '&');
}}}
Which fixed my installation.

I'm not sure if this is accurate but I also believe that the logic in compat.php to test for the function http_build_query should also test for php version... something like:

{{{
if (!function_exists('http_build_query') || version_compare(PHP_VERSION, '5.1.2') === -1 ) {
	if(function_exists('http_build_query')) {
		override_function('http_build_query', 
							'$data, $prefix=null, $sep=null',
							'return _http_build_query($data, $prefix, $sep);');
	}else{
		function http_build_query($data, $prefix=null, $sep=null) {
			return _http_build_query($data, $prefix, $sep);
		}
	}
}
}}}
But that requires APD functions to override the native function so I don't know if that's the best approach or if it's even necessary since http.php was the only file I could find that called http_build_query directly. I'll leave that up to the gurus I guess ;)"	defect (bug)	closed	normal	2.8	HTTP	2.7	blocker	fixed	has-patch	
