Page MenuHomePhabricator

Admin Score choosing Wikidata returns with fatal error
Closed, ResolvedPublic

Description

I recently spotted that Admin Score return with the following fatal error (non-admin, admin): Warning: [MessagesFunctions::parse] Problems when parsing the message. For Information see below!. Fatal error: [MessagesFunctions::plural] Invalid number argument to {{PLURAL: ...}} in /var/www/vendor/krinkle/intuition/language/MessagesFunctions.php on line 123.

Furthermore, a little grammar mistake: the warning should end with ! or ., not both of them.

Event Timeline

Bencemac renamed this task from Admin Score returns with error on Wikidata to Admin Score choosing Wikidata returns with fatal error.Jun 13 2018, 6:33 PM
Matthewrbowker triaged this task as Low priority.
Matthewrbowker moved this task from Backlog to Working on the XTools board.
Matthewrbowker subscribed.

Appears to be a intuition error parsing a language file. I shall dig.

Ok, so looking at the results we're pulling, for enwiki we're getting the following:

"source" => "edit-count"
"value" => "9666"

And for wikidata we're getting the following:

"source" => "edit-count"
"value" => "69256\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"

A whole bunch of extra binary control characters. That's why intuition was seeing the numbers as invalid. Now, the question is why does wikidata_p return control characters and enwiki_p not. I'm adding DBA because I'm not sure here, appears to be something at the database level.

Meanwhile, I'm going to add a real quick regular expression that will clean it up and make it usable again.

Whoa, I was the test subject for Wikidata? So cool! :) Anyway, thanks for your work!

Interesting... using var_dump, I see that selecting the user_editcount by itself is fine. No null characters in the result:

SELECT 'edit-count' AS source, user_editcount AS value FROM `wikidatawiki_p`.`user` WHERE user_name = 'Bencemac'

Result:

array:1 [▼
  0 => array:2 [▼
    "source" => "edit-count"
    "value" => "69355"
  ]
]

With a single UNION:

SELECT 'account-age' AS source, user_registration AS value FROM `wikidatawiki_p`.`user` WHERE user_name = 'Bencemac'
UNION
SELECT 'edit-count' AS source, user_editcount AS value FROM `wikidatawiki_p`.`user` WHERE user_name = 'Bencemac'
array:2 [▼
  0 => array:2 [▼
    "source" => "account-age"
    "value" => "20130623111019"
  ]
  1 => array:2 [▼
    "source" => "edit-count"
    "value" => "69355\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  ]
]

It looks okay in the MariaDB console, but maybe those null characters aren't being rendered or appear as spaces:

+-------------+----------------+
| source      | value          |
+-------------+----------------+
| account-age | 20130623111019 |
| edit-count  | 69355          |
+-------------+----------------+
Matthewrbowker raised the priority of this task from Low to Medium.Jun 25 2018, 5:24 AM
Matthewrbowker moved this task from Inbox to Working on the User-Matthewrbowker board.

@Marostegui Is that an acknowledgement that the problem is fixed or that you won't be looking at this obvious issue?

OK, fair. I read that comment the exact opposite way. I'll do some more digging on my end, per discussion on https://github.com/x-tools/xtools/pull/202, it appears to show up in only adminscore, but I will continue to dig here and make sure XTools doesn't wind up confused in the future.

I don't think it is a DB issue as per T197165#4310004

I'm not claiming it isn't a db problem, I just noticed all looks OK in the console.

BUT... I did more tests, tried the same query in my Ruby app. Same issue :(

[2] pry(Console)> @mb.repl_query("SELECT 'account-age' AS source, user_registration AS value FROM `wikidatawiki_p`.`user` WHERE user_name = 'Bencemac' UNION SELECT 'edit-count' AS source, user_editcount AS value FROM `wikidatawiki_p`.`user` WHERE user_name = 'Bencemac'").to_a
=> [{"source"=>"account-age", "value"=>"20130623111019"}, {"source"=>"edit-count", "value"=>"69362\x00\x00\x00\x00\x00\x00\x00\x00\x00"}]

That convinces me it's not an issue with PHP, Doctrine, or something in XTools.

Vvjjkkii renamed this task from Admin Score choosing Wikidata returns with fatal error to i2aaaaaaaa.Jul 1 2018, 1:04 AM
Vvjjkkii removed Matthewrbowker as the assignee of this task.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Matthewrbowker renamed this task from i2aaaaaaaa to Admin Score choosing Wikidata returns with fatal error.Jul 1 2018, 1:48 AM
Matthewrbowker claimed this task.
Matthewrbowker lowered the priority of this task from High to Medium.
Matthewrbowker updated the task description. (Show Details)
MusikAnimal moved this task from Working to Complete on the XTools board.