• Resolved niclasl

    (@niclasl)


    Hello guys!

    First of all, thank you for an awesome plugin!
    Please keep up the good work!

    Secondly, I’m on WordPress 4.9.7 with BA version 1.5.6.
    My site locale is d.m.Y, H:i, Norwegian Bokmål.

    When adding the shortcode [bookingactivities_list] to a static page Apache gives me a 500 error.

    I traced the error to function-bookings-system.php. I couldn’t understand all the magic sourcery going on here so I just made it work as easy as I could. But maybe this is something for you guys to look into when you have time?

    Starting on line 1570 I made some changes (commented out the original):

    	foreach( $formatted_events as $event ) {
    		
    		// Format the event duration
    		$event[ 'duration' ] = '';
    		if( $event[ 'start' ] && $event[ 'end' ] ) {
    			
    			//$event_start = bookacti_format_datetime( $event[ 'start' ], $datetime_format );
    			//$event_end = bookacti_format_datetime( $event[ 'end' ], $datetime_format );
    			$event_start = $event[ 'start' ];
    			$event_end = $event[ 'end' ];
    			
    			// Format differently if the event start and end on the same day
    			$start_and_end_same_day	= substr( $event_start, 0, 10 ) === substr( $event_end, 0, 10 );
    			if( $start_and_end_same_day ) {
    				
    				$event_end = substr($event_end, 11,18 );
    				//$event_end = date_i18n( $time_format, strtotime( $event_end ) );
    				//$event_end = ! mb_check_encoding( $event_end, 'UTF-8' ) ? utf8_encode( $event_end ) : $event_end;
    				
    			}
    			
    			$class		= $start_and_end_same_day ? 'bookacti-booking-event-end-same-day' : '';
    			$separator	= $start_and_end_same_day ? $date_time_separator : $dates_separator;
    			
    			// Place an arrow between start and end
    			$event[ 'duration' ] = '<span class="bookacti-booking-event-start" >' . $event_start . '</span>'
    								. '<span class="bookacti-booking-event-date-separator ' . $class . '" >' . $separator . '</span>'
    								. '<span class="bookacti-booking-event-end ' . $class . '" >' . $event_end . '</span>';
    			
    		}
    

    Best regards
    Niclas Lindgren

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Booking Activities Team

    (@bookingactivities)

    Hello Niclas,

    Thank you very much for your token of appreciation!

    It appears that the problem comes from either “date_i18n()” or “utf8_encode()“.

    I am glad you could patch it for now. Unfortunatly, this is not the only place where this code is used so you may have other issues. Your patch will also be removed each time you update Booking Activities. So we need to find the error source and fix it for good.

    First of all, try to deactivate all your plugins except Booking Activities and activate Twenty Seventeen theme instead of yours. Then, try again. If it works, the error comes from a conflict.

    Then, trigger the error 500 page, note the date and time when the error appears, and send me the PHP error log file and the date and time at [email protected]. It will (hopefully) allow me to backtrack the error.

    Regards,
    Yoan Cutillas

    Thread Starter niclasl

    (@niclasl)

    Many thanks for your swift reply Yoan!

    I’m afraid I wont have time to do it this week, but I enabled php logging and just got the exception in the browser, does that help you a bit on the way maybe?

    Here is the error message for the bookingactivities_list:
    Fatal error: Uncaught Error: Call to undefined function mb_check_encoding() in /home/dragogxd/public_html/wp-content/plugins/booking-activities/functions/functions-global.php:939 Stack trace: #0 /home/dragogxd/public_html/wp-content/plugins/booking-activities/functions/functions-booking-system.php(1574): bookacti_format_datetime('mandag, juli 30...', 'l, F jS, Y g:i ...') #1 /home/dragogxd/public_html/wp-content/plugins/booking-activities/functions/functions-bookings.php(1221): bookacti_get_formatted_booking_events_list(Array) #2 /home/dragogxd/public_html/wp-content/plugins/booking-activities/controller/controller-shortcodes.php(153): bookacti_get_booking_list_rows(Array, Array, 2) #3 /home/dragogxd/public_html/wp-includes/shortcodes.php(319): bookacti_shortcode_bookings_list(Array, '', 'bookingactiviti...') #4 [internal function]: do_shortcode_tag(Array) #5 /home/dragogxd/public_html/wp-includes/shortcodes.php(197): preg_replace_callback('/\\[(\\[?)(bookin...', 'do_shortcode_ta...', '<p><!--[boo...') #6 /home/dragog in /home/dragogxd/public_html/wp-content/plugins/booking-activities/functions/functions-global.php on line 939

    Also the Booking Forms view doesn’t work, here is the error message for that:
    Fatal error: Uncaught Error: Call to undefined function mb_check_encoding() in /home/dragogxd/public_html/wp-content/plugins/booking-activities/functions/functions-global.php:939 Stack trace: #0 /home/dragogxd/public_html/wp-content/plugins/booking-activities/class/class-forms-list.php(296): bookacti_format_datetime('juli 29, 2018', 'F d, Y') #1 /home/dragogxd/public_html/wp-content/plugins/booking-activities/class/class-forms-list.php(183): Forms_List_Table->get_form_list_items() #2 /home/dragogxd/public_html/wp-content/plugins/booking-activities/view/view-form-list.php(43): Forms_List_Table->prepare_items(Array) #3 /home/dragogxd/public_html/wp-content/plugins/booking-activities/booking-activities.php(431): include_once('/home/dragogxd/...') #4 /home/dragogxd/public_html/wp-includes/class-wp-hook.php(286): bookacti_forms_page('') #5 /home/dragogxd/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array) #6 /home/dragogxd/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #7 /home in /home/dragogxd/public_html/wp-content/plugins/booking-activities/functions/functions-global.php on line 939

    Plugin Author Booking Activities Team

    (@bookingactivities)

    Hello Niclas,

    Thank you for your investigation!

    This is probably because your web host has not activated the “mbstring” PHP extension.
    Can you ask your web host to activate it?

    Regards,
    Yoan Cutillas

    Thread Starter niclasl

    (@niclasl)

    Thank you Yoan,

    I enabled mbstring in my webhotel and now it works exactely as expected.

    So the problem was entirely locally and related to missing php module.

    Many thanks for your help/support!

    Brgds
    Niclas

    Plugin Author Booking Activities Team

    (@bookingactivities)

    You are welcome. I am glad that everything works properly now!

    Regards,
    Yoan Cutillas

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[bookingactivities_list] apache 500 / php error’ is closed to new replies.