User: Fix loading of user_token
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 28 Jan 2016 18:46:22 +0000 (13:46 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Thu, 28 Jan 2016 18:51:45 +0000 (13:51 -0500)
commit76d790623cc09dfbf51cbf45877f5f81af773303
tree7e5748fb0bc56b4e7731a91db6578db38e8e54eb
parent43e4b9e7c78ccedbe23489a220cfa8dc2ac5cf04
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
includes/user/User.php