Page MenuHomeDevCentral

Fix PhabricatorStory::getRepositoryPHID null exception
ClosedPublic

Authored by dereckson on Aug 20 2016, 20:29.
Tags
None
Referenced Files
F2841666: D622.id1543.diff
Mon, Apr 22, 23:45
Unknown Object (File)
Sun, Apr 21, 22:31
Unknown Object (File)
Fri, Apr 19, 07:00
Unknown Object (File)
Thu, Apr 18, 03:14
Unknown Object (File)
Sun, Apr 14, 22:16
Unknown Object (File)
Sun, Apr 14, 14:24
Unknown Object (File)
Fri, Apr 12, 21:50
Unknown Object (File)
Tue, Apr 9, 13:10
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.