Last modified: 2014-11-12 17:38:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T69596, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 67596 - PHP Fatal error: Cannot use object of type stdClass as array in MobileFrontend.hooks.php on line 304
PHP Fatal error: Cannot use object of type stdClass as array in MobileFronte...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Special pages (Other open bugs)
1.24rc
All All
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 70618 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-07 14:47 UTC by Sam Reed (reedy)
Modified: 2014-11-12 17:38 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Sam Reed (reedy) 2014-07-07 14:47:38 UTC
[2014-07-07 14:37:40] Fatal error: Cannot use object of type stdClass as array at /usr/local/apache/common-local/php-1.24wmf11/extensions/MobileFrontend/includes/MobileFrontend.hooks.php on line 304
Server: mw1060
Method: GET
URL: http://ta.wikipedia.org/w/index.php?title=%E0%AE%9A%E0%AE%BF%E0%AE%B1%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AF%81:History/%E0%AE%B5%E0%AE%B0%E0%AE%B2%E0%AE%BE%E0%AE%B1%E0%AF%8D%E0%AE%B1%E0%AF%81_%E0%AE%AE%E0%AF%8A%E0%AE%B4%E0%AE%BF%E0%AE%AF%E0%AE%BF%E0%AE%AF%E0%AE%B2%E0%AF%8D&mobileaction=toggle_view_mobile
Backtrace:
#0 /usr/local/apache/common-local/php-1.24wmf11/extensions/MobileFrontend/includes/MobileFrontend.hooks.php(304): MobileFrontendHooks::onSpecialPage_initList()
#1 [internal function]: MobileFrontendHooks::onSpecialPage_initList(Object(stdClass))
#2 /usr/local/apache/common-local/php-1.24wmf11/includes/Hooks.php(206): call_user_func_array('MobileFrontendH...', Array)
#3 /usr/local/apache/common-local/php-1.24wmf11/includes/GlobalFunctions.php(4038): Hooks::run('SpecialPage_ini...', Array, NULL)
#4 /usr/local/apache/common-local/php-1.24wmf11/includes/specialpage/SpecialPageFactory.php(218): wfRunHooks('SpecialPage_ini...', Array)
#5 /usr/local/apache/common-local/php-1.24wmf11/includes/specialpage/SpecialPageFactory.php(243): SpecialPageFactory::getList()
#6 /usr/local/apache/common-local/php-1.24wmf11/includes/specialpage/SpecialPageFactory.php(280): SpecialPageFactory::getAliasList()
#7 /usr/local/apache/common-local/php-1.24wmf11/includes/Title.php(1047): SpecialPageFactory::resolveAlias('History/???????...')
#8 /usr/local/apache/common-local/php-1.24wmf11/includes/Wiki.php(191): Title->isSpecial('Badtitle')
#9 /usr/local/apache/common-local/php-1.24wmf11/includes/Wiki.php(603): MediaWiki->performRequest()
#10 /usr/local/apache/common-local/php-1.24wmf11/includes/Wiki.php(452): MediaWiki->main()
#11 /usr/local/apache/common-local/php-1.24wmf11/index.php(46): MediaWiki->run()
#12 /usr/local/apache/common-local/w/index.php(3): require('/usr/local/apac...')
#13 {main}
Comment 1 Bingle 2014-07-07 17:20:44 UTC
Prioritization and scheduling of this bug is tracked on Trello card https://trello.com/c/wCCP87du
Comment 2 Max Semenik 2014-07-07 17:25:08 UTC
That's caused by core's SpecialPageFactory::getList() providing wrong parameters to SpecialPage_initList hook: it sends an stdClass instead of array.
Comment 3 Max Semenik 2014-09-09 18:23:10 UTC
*** Bug 70618 has been marked as a duplicate of this bug. ***
Comment 4 Ryan Kaldari 2014-09-09 18:48:54 UTC
Yeah, it looks like the special page list is cast to an object, even though the function documentation says it returns an array. It looks like this was added back in 2011 to get around PHP's lack of anonymous function support. Now that we require PHP 5.3, which has anonymous function support, this object cast is no longer necessary.

I have no idea why this would have become a problem recently though.
Comment 5 Ryan Kaldari 2014-09-09 19:10:47 UTC
Actually, I read the code comment backwards ( 'func()[$key]' not 'func[$key]()' ). It doesn't have anything to do with anonymous function support, but calling array values from function results immediately is also supported in PHP 5.3, so either way it isn't needed anymore.
Comment 6 Ryan Kaldari 2014-09-09 19:25:51 UTC
So if we change the code in MobileFrontend from...

$list['Watchlist'] = 'SpecialMobileWatchlist';

...to...

$list->Watchlist = 'SpecialMobileWatchlist';

...it should fix the error, but the code has been like that forever, so I'm still mystified as to how this ever worked in the first place. Perhaps MaxSem will have more insight on this.
Comment 7 Ryan Kaldari 2014-09-09 19:49:54 UTC
Actually, scratch that, I didn't notice the "if ( !is_object( self::$list ) ) {" outside the hook.

It looks like the hook is only ever called when the list is an array, before it is cast to an object, so I have no idea why it would be throwing that error.
Comment 8 Sam Reed (reedy) 2014-09-10 17:57:45 UTC
So after some APC issues on a few servers causing problems for Wikidata, the number of these skyrocketed (again)...
Comment 9 Gerrit Notification Bot 2014-09-10 19:00:19 UTC
Change 159526 had a related patch set uploaded by Reedy:
Don't cast SpecialPageFactory::$list to an object

https://gerrit.wikimedia.org/r/159526
Comment 10 Gerrit Notification Bot 2014-09-10 20:22:44 UTC
Change 159526 merged by jenkins-bot:
Don't cast SpecialPageFactory::$list to an object

https://gerrit.wikimedia.org/r/159526
Comment 11 Gerrit Notification Bot 2014-09-10 20:31:21 UTC
Change 159542 had a related patch set uploaded by Reedy:
Don't cast SpecialPageFactory::$list to an object

https://gerrit.wikimedia.org/r/159542
Comment 12 Gerrit Notification Bot 2014-09-10 20:31:36 UTC
Change 159543 had a related patch set uploaded by Reedy:
Don't cast SpecialPageFactory::$list to an object

https://gerrit.wikimedia.org/r/159543
Comment 13 Gerrit Notification Bot 2014-09-10 23:02:59 UTC
Change 159542 merged by MaxSem:
Don't cast SpecialPageFactory::$list to an object

https://gerrit.wikimedia.org/r/159542
Comment 14 Gerrit Notification Bot 2014-09-10 23:13:30 UTC
Change 159543 merged by jenkins-bot:
Don't cast SpecialPageFactory::$list to an object

https://gerrit.wikimedia.org/r/159543
Comment 15 Andre Klapper 2014-11-12 15:15:55 UTC
All patches mentioned in this report were merged - is there more work left to do here (if yes: please reset the bug report status to NEW or ASSIGNED), or can you close this ticket as RESOLVED FIXED?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links