Hi,
Problem
I have Maps Marker Pro (aka Leaflet Maps Marker) plugin installed. XDebug throws up this error on the wp-admin pages for the plugin:
Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /app/public/wp-includes/Requests/Transport/cURL.php on line 508
The full error is at the end of this topic.
I contacted MMP, and they assure me this error is not something they’ve come across and is environment-related. They suggested that possibly cURL was not installed, so I installed it via SSL terminal:
apt-get update apt-get install curl
phpinfo.php confirmed that it was enabled:
cURL support enabled cURL Information 7.38.0
However the error remained.
Solution
Eventually I came up with a crude-but-effective workaround, and did the unthinkable by modifying the offending core WP file at
/app/public/wp-includes/Requests/Transport/cURL.php on line 508
if (!is_array($data) && !is_object($data)) { // not array and not object $data=(array)$data; // make it an array }
Hopefully there’s a fix that doesn’t involve editing wp core files.
Will post it here if I find one.
– Simon
Full error
Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /app/public/wp-includes/Requests/Transport/cURL.php on line 508 Call Stack # Time Memory Function Location 1 0.0007 244224 {main}( ) .../admin.php:0 2 0.8198 9019256 do_action( ) .../admin.php:222 3 0.8198 9019968 WP_Hook->do_action( ) .../plugin.php:453 4 0.8198 9020064 WP_Hook->apply_filters( ) .../class-wp-hook.php:323 5 0.8198 9021216 call_user_func_array:{/app/public/wp-includes/class-wp-hook.php:298} ( ) .../class-wp-hook.php:298 6 0.8198 9021600 l4->lmm_list_markers( ) .../class-wp-hook.php:298 7 0.8284 9023584 include( '/app/public/wp-content/plugins/leaflet-maps-marker-pro/leaflet-list-markers.php' ) .../leaflet-core.php:2 8 0.8396 9190896 include( '/app/public/wp-content/plugins/leaflet-maps-marker-pro/inc/admin-header.php' ) .../leaflet-list-markers.php:88 9 0.8404 9196232 checkUrlExists( ) .../admin-header.php:187 10 0.8404 9196712 wp_remote_get( ) .../admin-header.php:171 11 0.8404 9196880 WP_Http->get( ) .../http.php:170 12 0.8404 9198208 WP_Http->request( ) .../class-http.php:593 13 0.8406 9207872 Requests::request( ) .../class-http.php:366 14 0.8624 9267272 Requests_Transport_cURL->request( ) .../class-requests.php:379 15 0.8624 9267488 Requests_Transport_cURL->setup_handle( ) .../cURL.php:133 16 0.8624 9268344 Requests_Transport_cURL::format_get( ) .../cURL.php:323 17 0.8624 9269424 http_build_query ( ) .../cURL.php:508