← Back to team overview

mahara-contributors team mailing list archive

[Bug 1960399] A patch has been submitted for review

 

Patch for "21.10_DEV" branch: https://reviews.mahara.org/12493

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/1960399

Title:
  Embedly export format incorrect (stdClass vs array)

Status in Mahara:
  Fix Committed
Status in Mahara 20.10 series:
  Confirmed
Status in Mahara 21.04 series:
  Confirmed
Status in Mahara 21.10 series:
  Confirmed
Status in Mahara 22.04 series:
  Fix Committed

Bug description:
  When you export a page that has external embedly content (example below), and then import it, the block's $configdata['embed'] element is saved as a stdClass instead of an array.
  This then throws an exception when being displayed/processed e.g. /blocktype/externalvideo/lib.php:202

  1. The data is not being exported correctly (I'm new to Mahara, so don't know where that happens)
  2. The data isn't being correctly handled in line 202.

  As a work-around we could cast the embed element as an array
  202: $configdata['embed'] = (array)$configdata['embed'];

  To reproduce:
  1. Create a page
  2. Add "External media" content type
  3. Paste in the following: <a class="embedly-card" href="https://issuu.com/penndesign/docs/pm9_layout_pro02_singlelow/20";></a>
  4. Save
  5. Check the database that this has been saved as an array. SELECT * FROM block_instance WHERE configdata LIKE '%embedly%'; If you know the id you can search for that. The result should be something like:
  146 | externalvideo | Penn design embedly-card | a:8:{s:7:"videoid";s:98:"<a class="embedly-card" href="http://issuu.com/penndesign/docs/pm9_layout_pro02_singlelow/20";></a>";s:5:"width";s:1:"0";s:6:"height";s:1:"0";s:4:"tags";N;s:11:"retractable";i:0;s:15:"retractedonload";i:0;s:4:"html";s:98:"<a class="embedly-card" href="http://issuu.com/penndesign/docs/pm9_layout_pro02_singlelow/20";></a>";s:5:"embed";a:4:{s:7:"service";s:7:"embedly";s:4:"type";s:4:"link";s:3:"url";s:62:"http://issuu.com/penndesign/docs/pm9_layout_pro02_singlelow/20";s:5:"title";s:0:"";}}                                                   
    |   40 |   0 |      0 |     0

  where "embed";a:4

  6. Now export this page (Manage -> Export -> Just some of my pages) and select the page you just created.
  7. Now import the exported page
  8. View imported page. You will get the following error.
  [WAR] ad (lib/errors.php:530) [Error]: Cannot use object of type stdClass as array at /mahara/htdocs/blocktype/externalvideo/lib.php:202

  Mahara: 21.10
  Using Mahara docker in local dev with default set up for 21.10

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1960399/+subscriptions



References