Page MenuHomePhorge

Fix NULL pointer exception in some circumstances from Calendar's homepage
ClosedPublic

Authored by valerio.bozzolan on Nov 28 2022, 15:02.
Referenced Files
F2147867: D25060.diff
Thu, Apr 18, 23:24
Unknown Object (File)
Wed, Apr 10, 00:43
Unknown Object (File)
Sun, Apr 7, 09:25
Unknown Object (File)
Mon, Apr 1, 00:48
Unknown Object (File)
Mon, Apr 1, 00:48
Unknown Object (File)
Mon, Apr 1, 00:48
Unknown Object (File)
Mon, Apr 1, 00:48
Unknown Object (File)
Mon, Apr 1, 00:48

Details

Summary

After importing specific weird events, for example from Google Calendar (bleah), it can happen that the Calendar's homepage becomes broken.

This was the Exception error shown to video:

"Call to a member function getEventsBetween() on null"

It was happening since this method can return NULL:

PhabricatorCalendarEventQuery#newRecurrenceSet()

This changeset verifies this condition from the Calendar's homepage.

Closes T15136

Test Plan

I tried in my server. I've executed the syntax lint. On my local machine I was not able to run "arc diff" since it tries to connect to root@localhost for some reasons.

Diff Detail

Repository
rP Phorge
Branch
D25060 (branched from master)
Lint
Lint Passed
Unit
Tests Skipped
Build Status
Buildable 99
Build 99: arc lint + arc unit

Event Timeline

src/applications/calendar/query/PhabricatorCalendarEventQuery.php
234

Basically I've just indented the $recurrences = $set->getEventsBetween() under an if($set).

valerio.bozzolan retitled this revision from Fix NULL pointer exception from Calendar's homepage to Fix NULL pointer exception in some circumstances from Calendar's homepage.Nov 28 2022, 20:25
valerio.bozzolan edited the summary of this revision. (Show Details)
valerio.bozzolan added a project: Calendar.

This looks good to me. It seems like I may have actually ran into this before and just didn't manage to upstream the fix from Wikimedia's fork.

This revision is now accepted and ready to land.Nov 30 2022, 18:13
$ arc land

Exception: You do not have permission to push to this repository.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I also tried executing yes | arc land but nothing.

I also tried the GNU version of yes that huge efficiency - https://codegolf.stackexchange.com/a/199534 but nothing.

I also tried to re-implement yes using a low-level approach, but nothing:

yesyes

As workaround it seems I need to become a Blessed Committers until I find a definitive solution to land.

0 added inline comments.
src/applications/calendar/query/PhabricatorCalendarEventQuery.php
228

The rest of the codebase uses array() instead of [], but that might just be for compatibility with old PHP.

add support for PHP versions that should be nuked

Hi @Matthew I think I cannot run arc land since I'm not in Blessed Committers

Hi @Matthew I think I cannot run arc land since I'm not in Blessed Committers

That is correct, I am working on getting this landed. Please stop pinging me, it will land soon.