Page MenuHomePhabricator

Fix an exception in Tokens if a bad object was given a token
ClosedPublic

Authored by epriestley on Dec 28 2015, 9:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 12, 2:09 AM
Unknown Object (File)
Sun, Dec 8, 2:40 PM
Unknown Object (File)
Tue, Dec 3, 12:48 PM
Unknown Object (File)
Thu, Nov 28, 1:06 AM
Unknown Object (File)
Wed, Nov 27, 2:34 AM
Unknown Object (File)
Sat, Nov 23, 11:37 PM
Unknown Object (File)
Sat, Nov 23, 10:06 PM
Unknown Object (File)
Oct 28 2024, 11:32 PM
Subscribers
None

Details

Summary

Fixes T10057. Root issue is:

  • In the past, you could give tokens to objects of type X (here, Ponder answers).
  • Now, you can't.
  • If you try to load a token on an object of type X, we do a bad call to attach it and fatal.

Instead, make sure objects implement the proper interface before we attach them, and just pretend the token does not exist otherwise.

Test Plan

Faked the exception in T10057, applied patch, got clean tokens page.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Fix an exception in Tokens if a bad object was given a token.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
src/applications/tokens/query/PhabricatorTokenGivenQuery.php
73

This new instanceof check is the actual fix, everything else is just cleaning this up a bit.

chad edited edge metadata.
This revision is now accepted and ready to land.Dec 28 2015, 9:18 PM
This revision was automatically updated to reflect the committed changes.