Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add null check #14

Merged
merged 2 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions MediaWikiUserpageCustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ public function getFieldKey() {

public function getFieldName() {
$account = $this->getExternalAccount();
$uri = $account->getAccountURI();
if ( strpos( $uri, 'wikitide.org' ) !== false ) {
return pht( 'WikiTide User' );
if ( $account !== null ) {
$uri = $account->getAccountURI();
if ( strpos( $uri, 'wikitide.org' ) !== false ) {
return pht( 'WikiTide User' );
}
}

return pht( 'WikiForge User' );
Expand Down
4 changes: 2 additions & 2 deletions PhutilMediaWikiAuthAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private function getUserInfo() {
// We gen this so we can check for replay below:
$nonce = Filesystem::readRandomCharacters( 32 );

list( $body ) = $this->newOAuth1Future( $uri )
[ $body ] = $this->newOAuth1Future( $uri )
->setMethod( 'GET' )
->setNonce( $nonce )
->addHeader( 'User-Agent', __CLASS__ )
Expand Down Expand Up @@ -205,7 +205,7 @@ private function decodeAndVerifyJWT( $jwt, $nonce ) {

/** decode a JWT and verify the signature is valid */
private function decodeJWT( $jwt ) {
list( $headb64, $bodyb64, $sigb64 ) = explode( '.', $jwt );
[ $headb64, $bodyb64, $sigb64 ] = explode( '.', $jwt );

$header = json_decode( $this->urlsafeB64Decode( $headb64 ) );
$body = json_decode( $this->urlsafeB64Decode( $bodyb64 ) );
Expand Down