Page MenuHomeDevCentral

Fix PhabricatorStory::getRepositoryPHID null exception
ClosedPublic

Authored by dereckson on Aug 20 2016, 20:29.
Tags
None
Referenced Files
F3750874: D622.diff
Sun, Nov 17, 04:21
Unknown Object (File)
Thu, Nov 14, 18:28
Unknown Object (File)
Thu, Nov 14, 17:35
Unknown Object (File)
Thu, Nov 14, 14:40
Unknown Object (File)
Mon, Nov 11, 02:54
Unknown Object (File)
Sat, Nov 9, 12:03
Unknown Object (File)
Sat, Nov 9, 12:00
Unknown Object (File)
Sat, Nov 9, 11:57
Subscribers
None

Details

Summary

When Phabricator fires an notification about an object the Notifications
bot users can't see, PhabricatorStory::getRepositoryPHID API reply is [].

As the code tried to access it as an object, a null exception ensues.
The issue is similar to T916 / f1e56313d6e9.

Fixes T993.

Test Plan
<?php

namespace Nasqueron\Notifications\Tests;

use Nasqueron\Notifications\Analyzers\Phabricator\PhabricatorPayloadAnalyzer;
use Nasqueron\Notifications\Notifications\PhabricatorNotification;
use Nasqueron\Notifications\Phabricator\PhabricatorStory;

class T993Test extends TestCase {

    /**
     * Test T993 is solved.
     */
    public function testT993 () {
        $data = file_get_contents(__DIR__ . '/T993.payload.json');
        $payload = json_decode($data, true);
        $project = "Nasqueron";
        $instance = 'https://devcentral.nasqueron.org';

        $story = PhabricatorStory::loadFromArray($instance, $payload);
        $notification = new PhabricatorNotification($project, $story);
    }
    
}

Diff Detail

Repository
rNOTIF Notifications center
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dereckson retitled this revision from to Fix PhabricatorStory::getRepositoryPHID null exception.
dereckson updated this object.
dereckson edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.Aug 20 2016, 20:32
This revision was automatically updated to reflect the committed changes.