Facebook PHP SDK Throwing an Uncatchable OAuthException

前端 未结 1 1051
無奈伤痛
無奈伤痛 2021-01-13 00:38

I\'m attempting to post an open graph action to the Facebook Graph API but receiving an OAuth Exception (#3501) User is already associated to the
1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-13 01:32

    So, something that's not outline above is that I'm utilizing PHP namespaces. This is a big gotchta since namespaces are relatively new to php, it's super easily overlooked I feel. Regardless, it's a pretty silly oversight/error.

    If you're in a defined namespace (that is, not the root (\) namespace) you don't have direct access to the Exception class. Instead of php throwing a warning about not knowing what that class is, it just ignores the fact that it doesn't know what it is - and doesn't catch the exception.

    Solution 1:

    import the exception class:

    Solution 2:

    provide the full path to the exception class:

    0 讨论(0)
提交回复
热议问题