[NSFW] unserialize() expects parameter 1 to be string
-
After the update, I got this error:
Warning: unserialize() expects parameter 1 to be string, array given in /wp-content/plugins/bus-ticket-booking-with-seat-reservation/public/template-hooks/layout/bus-search-page.php on line 55
The problem perhaps is with the Buffer Time calculation code in bus-search-page.php:
// Buffer Time Calculation $bus_bp_array = get_post_meta($id, 'wbtm_bus_bp_stops', true); $bus_bp_array = unserialize($bus_bp_array); $bp_time = $wbtmmain->wbtm_get_bus_start_time($start, $bus_bp_array); $is_buffer = $wbtmmain->wbtm_buffer_time_check($bp_time, date('Y-m-d', strtotime($j_date))); // Buffer Time Calculation END
I fixed it as follows:
// Buffer Time Calculation $bus_bp_array = get_post_meta($id, 'wbtm_bus_bp_stops', true); $bus_bp_array = unserialize(serialize($bus_bp_array)); $bp_time = $wbtmmain->wbtm_get_bus_start_time($start, $bus_bp_array); $is_buffer = $wbtmmain->wbtm_buffer_time_check($bp_time, date('Y-m-d', strtotime($j_date))); // Buffer Time Calculation END
Since the output is anyway coming as an array, there is no need to unserialise it. Plugin author may pls fix this. Others may use the above code in the interim.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘[NSFW] unserialize() expects parameter 1 to be string’ is closed to new replies.