Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hang of calendar/fwconsole process #6

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

Massi-X
Copy link
Contributor

@Massi-X Massi-X commented Feb 14, 2024

As long-windedly discussed on FreePBX forum the last updates (16.0.23 and up) caused hanging of the fwconsole process and the inability to view the calendar inside the admin UI. This was in particular true only for a specific type of events that contains the following (omitted non relevant values):

[DTSTART] => DateTime Object
    (
        [date] => 2022-12-02 08:30:00.000000
        [timezone_type] => 3
        [timezone] => America/New_York
    )
[DTEND] => DateTime Object
    (
        [date] => 2022-12-02 14:00:00.000000
        [timezone_type] => 3
        [timezone] => America/New_York
    )
[RRULE] => Array
    (
        [FREQ] => MONTHLY
        [INTERVAL] => 1
        [UNTIL] => DateTime Object
            (
                [date] => 2022-12-04 00:00:00.000000
                [timezone_type] => 2
                [timezone] => Z
            )

        [BYMONTHDAY] => 2
    )

The UNTIL rule was causing the IcalParser library to fail and return an error that was not correctly handled by the code. Now a check is added for the return value and also to be sure that the returned value is greater than the start time of the event.

Inside the same PR I removed a goto statement in Base.php and fixed the return value of fastHandler() when no cache is available.

Fixes an infinite loop caused by some events formatted in a specific way.
Now we check if the returned value for recurrence is valid (!==false) and also if it is greater than the start time of the event.
See also https://community.freepbx.org/t/calendar-module-update-16-0-28/94279
- goto is really hated , this commit switch it to a nicer function call 😇
- getCache() using reference instead of duplicate call
- fastHandler() correctly build cache or return false in case of errors
@kguptasangoma kguptasangoma merged commit a4c3300 into FreePBX:release/16.0 Feb 22, 2024
1 check passed
@Massi-X
Copy link
Contributor Author

Massi-X commented Apr 16, 2024

Hi I think the module should now be ready to publish? Me and ashcortech did extensively test it and it works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants