Anomie has uploaded a new change for review. https://gerrit.wikimedia.org/r/267067
Change subject: User: Fix loading of user_token ...................................................................... User: Fix loading of user_token Similar to T124414, we should always load user_token from the row even if user_email is unset. Also, I notice that maintenance/tables.sql defines the column as "binary(32)", which is going to append ASCII NUL bytes to the default empty-string. And before that it was "char(32)", which will append spaces. So trim both of those off when reading the field so the following check for === '' actually works. The latter doesn't seem to affect *most* WMF wikis, since they have the column defined as "varbinary(32)" for some reason. But there are a few with "binary(32)", I have no idea why. Change-Id: I50a813bb530639275628d9560c79a773676aa36d --- M includes/user/User.php 1 file changed, 12 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/67/267067/1 diff --git a/includes/user/User.php b/includes/user/User.php index a268117..7c29242 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1261,12 +1261,20 @@ $all = false; } - if ( isset( $row->user_email ) ) { - $this->mEmail = $row->user_email; - $this->mToken = $row->user_token; - if ( $this->mToken == '' ) { + if ( isset( $row->user_token ) ) { + // The definition for the column is binary(32), so trim the NULs + // that appends. The previous definition was char(32), so trim + // spaces too. + $this->mToken = rtrim( $row->user_token, " \0" ); + if ( $this->mToken === '' ) { $this->mToken = null; } + } else { + $all = false; + } + + if ( isset( $row->user_email ) ) { + $this->mEmail = $row->user_email; $this->mEmailAuthenticated = wfTimestampOrNull( TS_MW, $row->user_email_authenticated ); $this->mEmailToken = $row->user_email_token; $this->mEmailTokenExpires = wfTimestampOrNull( TS_MW, $row->user_email_token_expires ); -- To view, visit https://gerrit.wikimedia.org/r/267067 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I50a813bb530639275628d9560c79a773676aa36d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie <bjor...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits