Patch for "master" branch: https://reviews.mahara.org/11353
-- You received this bug notification because you are a member of Mahara Contributors, which is subscribed to Mahara. Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it! https://bugs.launchpad.net/bugs/1897981 Title: Leap2A import shows Countable error Status in Mahara: Confirmed Status in Mahara 20.10 series: Confirmed Status in Mahara 21.04 series: In Progress Bug description: Using QA Mahara with the following settings on Windows: PHP 7.4 Postgres 10.9 Skins enabled Individual themes enabled Pre-populated data Maroon theme Chrome Steps taken: 1. Log in as a regular person 2. Import a leap2a file Expected: You see: Your portfolio was imported successfully Actual The portfolio imports, but there is the following error, which was a PHP 7.2 change to count()(see screenshot): [WAR] f7 (import/leap/lib.php:1774) count(): Parameter must be an array or an object that implements Countable Call stack (most recent first): log_message("count(): Parameter must be an array or an object t...", 8, true, true, "/var/www/mahara/htdocs/import/leap/lib.php", 1774) at /var/www/mahara/htdocs/lib/errors.php:521 error(2, "count(): Parameter must be an array or an object t...", "/var/www/mahara/htdocs/import/leap/lib.php", 1774, array(size 3)) at /var/www/mahara/htdocs/import/leap/lib.php:1774 PluginImportLeap->_fixref("portfolio:artefact110") at /var/www/mahara/htdocs/import/leap/lib.php:1721 PluginImportLeap->fix_artefact_reference("<div> <p><img width="640" alt="md_5ac44dbd9de98.pn...") at /var/www/mahara/htdocs/import/leap/lib.php:1663 PluginImportLeap->fix_artefact_references(object(stdClass)) at /var/www/mahara/htdocs/import/leap/lib.php:344 PluginImportLeap->do_import_from_requests() at /var/www/mahara/htdocs/import/index.php:314 do_import() at /var/www/mahara/htdocs/import/index.php:71 [DBG] f7 (import/leap/lib.php:1774) Warning: fixref was expecting one artefact to have been imported by entry portfolio:artefact110 but seems to have gotten 0 This needs some investigation to see what the $artefact variable contains at the time count is called on it: $artefacts = $this->get_artefactids_imported_by_entryid($hrefsrc); if (is_null($artefacts) || count($artefacts) != 1) { // This can happen if a Leap2A xml file is uploaded that refers to // files that (naturally) weren't uploaded with it. log_debug("Warning: fixref was expecting one artefact to have been imported by entry {$hrefsrc} but seems to have gotten " . count($artefacts)); return $hrefsrc; It looks like it probably contains a number, which won't work with PHP 7.2 and later, it needs to be an array or object from memory. For more info see: https://www.php.net/manual/en/function.count.php Note: have not tested on 20.04 to see if this is a regression. To manage notifications about this bug go to: https://bugs.launchpad.net/mahara/+bug/1897981/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~mahara-contributors Post to : [email protected] Unsubscribe : https://launchpad.net/~mahara-contributors More help : https://help.launchpad.net/ListHelp

