Topic on Project:Support desk

Exception encountered, of type "Error" [b0e71d8cb299650e8368cc76] /mediawiki/index.php?title=Special:Html2Wiki&action=submit Error from line 4617 of /usr/share/mediawiki/languages/Language.php: Using $this when not in object context

11
Summary by PlavorSeol

Seems to be answered - no more comment - therefore mark this as resolved.

P.R.S.D.T.D. (talkcontribs)

I am encountering this exception when trying to use the Html2Wiki extension to import a plaintext html file. I have the rest of the Backtrace here:

Backtrace:

#0 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(814): Language::formatSize(integer)

#1 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(857): SpecialHtml2Wiki->formatValue(integer)

#2 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(964): SpecialHtml2Wiki->addFileToResults()

#3 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(655): SpecialHtml2Wiki->processFile()

#4 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(519): SpecialHtml2Wiki->doUpload()

#5 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(220): SpecialHtml2Wiki->doImport()

#6 /usr/share/mediawiki/includes/specialpage/SpecialPage.php(479): SpecialHtml2Wiki->execute(NULL)

#7 /usr/share/mediawiki/includes/specialpage/SpecialPageFactory.php(577): SpecialPage->run(NULL)

#8 /usr/share/mediawiki/includes/MediaWiki.php(282): SpecialPageFactory::executePath(Title, RequestContext)

#9 /usr/share/mediawiki/includes/MediaWiki.php(735): MediaWiki->performRequest()

#10 /usr/share/mediawiki/includes/MediaWiki.php(509): MediaWiki->main()

#11 /usr/share/mediawiki/index.php(43): MediaWiki->run()

#12 {main}

What can I do to resolve this issue?

星耀晨曦 (talkcontribs)

Please ensure that Html2Wiki extension version matches MW core version.

P.R.S.D.T.D. (talkcontribs)

I upgraded everything to 1.31, same error different line:

[e51f192c19e9217fef6b5ed5] /mediawiki/index.php?title=Special:Html2Wiki&action=submit Error from line 4829 of /var/lib/mediawiki/languages/Language.php: Using $this when not in object context

Backtrace:

#0 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(814): Language::formatSize(integer)

#1 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(857): SpecialHtml2Wiki->formatValue(integer)

#2 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(964): SpecialHtml2Wiki->addFileToResults()

#3 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(655): SpecialHtml2Wiki->processFile()

#4 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(519): SpecialHtml2Wiki->doUpload()

#5 /var/lib/mediawiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php(220): SpecialHtml2Wiki->doImport()

#6 /var/lib/mediawiki/includes/specialpage/SpecialPage.php(522): SpecialHtml2Wiki->execute(NULL)

#7 /var/lib/mediawiki/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL)

#8 /var/lib/mediawiki/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)

#9 /var/lib/mediawiki/includes/MediaWiki.php(861): MediaWiki->performRequest()

#10 /var/lib/mediawiki/includes/MediaWiki.php(524): MediaWiki->main()

#11 /var/lib/mediawiki/index.php(42): MediaWiki->run()

#12 {main}

P.R.S.D.T.D. (talkcontribs)

Is there some other element I am missing?

Ciencia Al Poder (talkcontribs)

Did you also upgraded Html2Wiki as well? If you've also done that, the extension may not be compatible yet with the latest MediaWiki version.

P.R.S.D.T.D. (talkcontribs)

Mediawiki is on 1.31, HTML2wiki has a package for 1.31 which I have installed as well. These together are producing this error. I have updated all dependencies and packages to the best of my abilities in an attempt to resolve this error but have come up empty.

P.R.S.D.T.D. (talkcontribs)

If anyone has any more insight into this issue that would be awesome.

Ciencia Al Poder (talkcontribs)

Try to post on the talk page of the Html2Wiki extension, and/or open a bug about this.

P.R.S.D.T.D. (talkcontribs)

Where might I find a link to their talk page?

AhmadF.Cheema (talkcontribs)
Kifit (talkcontribs)

Same error here with MediaWiki 1.31 and Html2Wiki up to date.

I managed getting rid of it by editing line 814 in /path_to_my_wiki/extensions/Html2Wiki/specials/SpecialHtml2Wiki.php

I commented out the faulty line and replaced it as bellow :

//        return htmlspecialchars( $this->getLanguage()->formatSize( Language::formatSize( $value ) ) );
  return htmlspecialchars( $this->getLanguage()->formatSize( $value ) );

Html2Wiki is now working fine.

Just for the record, as mentioned in the error message, the "formatsize" function is defined into /path_to_my_wiki/languages/Language.php from line 4828 to 4830 :

function formatSize( $size ) {
          return $this->formatComputingNumbers( $size, 1024, "size-$1bytes" );
  }

Hope this helps.