Hi
I am getting a PHP warning if the “Terms and Conditions” checkbox is not selected when making a booking. It is set to required.
The warning is “Warning: trim() expects parameter 1 to be string, array given in /home/pivotnetballcom/public_html/wp-includes/query.php on line 1609”.
The booking is not completed and you are returned to a blank booking form page.
Regards
Daniel
Daniel Cooksey
What version of WordPress are you using? Are you able to link to the form in question?
Stephen Harris
Daniel Cooksey
Hi Daniel,
The booking form uses the 'name'
query variable to store the bookee’s name. The values entered will populate $_POST['name']
. The error you see refers to this line: https://github.com/WordPress/WordPress/blob/4.6/wp-includes/query.php#L1609 – WordPress is trying to trim the 'name'
query variable – which it expects to be string, but isn’t.
My guess is that it’s an array, and that $_POST['name']
, populated by the booking form, is being passed to a WP_Query
instance. This doesn’t happen by default, so you presumably have a plug-in that’s causing this.
If you can identify that plug-in then it maybe possible to workaround the issue. I suspect it’s a bug in another plugin, because I can’t see a reason why you would want to blindly pass $_POST
to WP_Query
instance.
It doesn’t seem that the terms and conditions element has any bearing on the bug. I suspect, if the booking is successful then the user is redirect to PayPal before the bug is reached – and not checking the terms and conditions was just one way of preventing the booking from being successful.
Stephen Harris
Thanks, it seems to have something to do with the fact I have the booking form on a separate page.
I tried disabling plugins one at a time, no result.
Switching from the Sports theme I am using to 2016 fixed the problem
But , while using the Sports theme the error no longer appears if I disable the extra code to move the booking form to a separate page.
I followed the instructions in this post to use a separate booking page –
https://wp-event-organiser.com/forums/topic/separate-booking-page/.
I made one change though. In event-meta-event-single.php<br />
[page-url]/?event_id[event-ID]
didn’t work so I changed it to [page-url]/?event_id=<php echo (get_the_ID))?>
So the Sports theme obviously has something to do with it but do you think there is a workaround to get the booking form on a separate page without causing the error?
Daniel Cooksey
Can you provide a link to the theme’s source code? If not, could you get in touch via this contact form and I’ll have you e-mail it over.
Stephen Harris