Page MenuHomePhabricator

Type mismatches in MW 1.26.2 under HHVM 3.12
Closed, DeclinedPublic

Description

The HHVM error log, after upgrade to 3.12, is full of warnings about array to string or scalar to array conversion:

Warning: Cannot use a scalar value as an array in /var/www/wiki/w/includes/jobqueue/JobQueueGroup.php on line 30
Notice: Array to string conversion in /var/www/wiki/w/extensions/Scribunto/engines/LuaSandbox/Engine.php on line 3
Notice: Array to string conversion in /var/www/wiki/w/includes/libs/objectcache/APCBagOStuff.php on line 96
Notice: Array to string conversion in /var/www/wiki/w/includes/Sanitizer.php on line 1044

There are additional type mismatch warnings in stacktraces after frequent segmentation faults (which dodn't make it into the log) like:

AbstractContent->getParserOutput(Традиция:Идеи/Традиция, 399847, Object of class ParserOptions could not be converted to string) called at [/var/www/wiki/w/includes/poolcounter/PoolWorkArticleView.php:140]
MediaWiki->performAction(Object of class Article could not be converted to string, Традиция:Идеи/Традиция) called at [/var/www/wiki/w/includes/MediaWiki.php:287]

See a related HHVM bug: https://github.com/facebook/hhvm/issues/6825.

Event Timeline

alex-mashin raised the priority of this task from to Needs Triage.
alex-mashin updated the task description. (Show Details)
alex-mashin added a subscriber: alex-mashin.
JEumerus added a subscriber: JEumerus.

Tentatively associating this project so that the task isn't orphaned.

Without the specific version of MediaWiki being used, these line numbers are less than helpful. But,

Notice: Array to string conversion in /var/www/wiki/w/extensions/Scribunto/engines/LuaSandbox/Engine.php on line 3

Line 3 in that file is

class Scribunto_LuaSandboxEngine extends Scribunto_LuaEngine {

There's nothing that could possibly be an array to string conversion going on there. And there has never been anything other than the class line at line 3 of that file.

AbstractContent->getParserOutput(Традиция:Идеи/Традиция, 399847, Object of class ParserOptions could not be converted to string) called at [/var/www/wiki/w/includes/poolcounter/PoolWorkArticleView.php:140]
MediaWiki->performAction(Object of class Article could not be converted to string, Традиция:Идеи/Традиция) called at [/var/www/wiki/w/includes/MediaWiki.php:287]

These seem to be the logging engine uselessly whining, not things actually trying to be converted into a string. AbstractContent::getParserOutput() is specifically typehinted to take a ParserOptions, and MediaWiki::preformAction() is specifically typehinted to take a Page (which Article implements).

Without the specific version of MediaWiki being used, these line numbers are less than helpful.

1.26.2 as is written in the task title.

These seem to be the logging engine uselessly whining,

So, is this an HHVM bug? Broken type hinting?

1.26.2 as is written in the task title.

Sorry, I missed that. Now that I know which version to look at,

Warning: Cannot use a scalar value as an array in /var/www/wiki/w/includes/jobqueue/JobQueueGroup.php on line 30

JobQueueGroup.php line 30 is class JobQueueGroup {, no variables or using anything as an array there.

Notice: Array to string conversion in /var/www/wiki/w/includes/libs/objectcache/APCBagOStuff.php on line 96

This line is apc_store( $key . self::KEY_SUFFIX, $value, $exptime );. I suppose it's possible something is passing in an array for $key, but we'd need to see the backtrace.

Notice: Array to string conversion in /var/www/wiki/w/includes/Sanitizer.php on line 1044

This line is $encValue = htmlspecialchars( $text, ENT_QUOTES );. Again, it's possible something is passing in an array for $text, but we'd need to see the backtrace.

These seem to be the logging engine uselessly whining,

So, is this an HHVM bug? Broken type hinting?

It's HHVM trying to print the parameter values in the backtrace, but those (correct) parameters can't be stringified so it puts something like "Object of class Article could not be converted to string" in the logging output. There's nothing wrong here besides it being a somewhat misleading message that HHVM is outputting.

(Almost) the same the bug: T123536

This is for HHVM 3.9, though - so the situation only got worse?

MaxSem added a subscriber: MaxSem.

Is it still observable in modern MW/HHVM versions?

Krinkle removed projects: TestMe, MediaWiki-General, HHVM.
Krinkle added a subscriber: Krinkle.

Not seen any of these in WMF Logstash in the past 30 days and task seems to have no new information in a while. Please re-open if the error is seen with currently supported versions of MediaWiki, Scribunto, and PHP.