1

We are using Moxiemanager with TinyMCE. But after upgrading on PHP8 we are facing error. We are getting the following error -

Server returned an invalid response
Fatal error: During inheritance of IteratorAggregate: Uncaught MOXMAN_Exception: Return type of MOXMAN_Vfs_FileList::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/Vfs/FileList.php:38 Stack trace: #0 /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/Vfs/FileList.php(13): MOXMAN_Exception::throwRuntimeError() #1 /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/AutoLoader.php(77): require('/sites/ssc.lara...') #2 /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/Vfs/Local/File.php(277): MOXMAN_AutoLoader::autoload() #3 /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/Commands/ListFilesCommand.php(148): MOXMAN_Vfs_Local_File->listFilesFiltered() #4 /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/CommandCollection.php(39): MOXMAN_Commands_ListFilesCommand->execute() #5 /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/CorePlugin.php(69): MOXMAN_CommandCollection->execute() #6 /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/Handlers/JsonRpcHandler.php(74): MOXMAN_CorePlugin->execute() #7 /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/CorePlugin.php(82): MOXMAN_Handlers_JsonRpcHandler->processRequest() #8 /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/api.php(18): MOXMAN_CorePlugin->processRequest() #9 {main} in /sites/ssc.lara/ssc/public/assets/libs/tinymce/plugins/moxiemanager/classes/Vfs/FileList.php on line 13
Ok

It seems to be some issue with PHP's Iterator implementation. Can anyone help?

Sougata Bose
  • 31,517
  • 8
  • 49
  • 87

3 Answers3

1

at tinymce\plugins\moxiemanager\classes\Util\NameValueCollection.php

change

public function getIterator() {
    return new ArrayIterator($this->items);
}

to

public function getIterator(): \Traversable {
    return new \ArrayIterator($this->items);
}

and at tinymce/plugins/moxiemanager/classes/Vfs/FileList.php

change

public function getIterator() {
    return new ArrayIterator($this->getFiles());
}

to

public function getIterator(): \Traversable {
    return new \ArrayIterator($this->items);
}

After these changes my Moxiemanager works fine (ver 2.1.8-28, php 8.1.8)

0

MoxieManager is does not support PHP 8 at this time. Moxie's developers are working on including PHP 8 support, and hope to have that release available later in Q1 2022.

Source: I work at Tiny

Tiny Lincoln
  • 1,037
  • 5
  • 7
0

For php8.1, at tinymce/plugins/moxiemanage/classes/util/PDO.php I had to add

#[\ReturnTypeWillChange]

to prepare and exec function in PDO.php. It works on php8.1.

helvete
  • 2,455
  • 13
  • 33
  • 37
tokstar
  • 1
  • 1