• AndyHenderson

    (@andyhenderson)


    We are calculating occurrences in our UI and using eo_update_event to update them in the Event Organiser database. I hate to raise an issue because I’ve used EO to support several charity sites with great success.

    However, we just got the following error:

    [24-Apr-2025 14:45:30 UTC] PHP Fatal error: Uncaught ValueError: array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements in /homepages/0/d894882115/htdocs/clickandbuilds/HaylingU3A/wp-content/plugins/event-organiser/includes/event.php:381
    Stack trace:
    #0 /homepages/0/d894882115/htdocs/clickandbuilds/HaylingU3A/wp-content/plugins/event-organiser/includes/event.php(381): array_combine()

    Looking at the code I see the following at lines 368 – 370:

      $update   = array_uintersect( $occurrences, $current_occurrences, ‘_eventorganiser_compare_dates’ );

      $update_2 = array_uintersect( $current_occurrences, $update, ‘_eventorganiser_compare_dates’ );

      $keys     = array_keys( $update_2 );

    I’m struggling to understand the use of $update_2 but I think it might be trying to de-duplicate the occurrences. We try to avoid that in our UI but I’m not going to claim our code is perfect.

    The fatal occurs because $keys doesn’t match $update. However, shouldn’t the array_combine at 381 be using $update_2 and not $update? Similarly, shouldn’t the foreach at 383 be using $update_2 and not $update? – otherwise what’s the purpose of $update_2 since it’s not referenced anywhere in the code.

    Thanks again for the plug-in,

    Andy

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Coding error in event.php – I think’ is closed to new replies.