White screen when copying collection / page

Bug #1569552 reported by Darren James Harkness
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Robert Lyon
16.04
Fix Released
Medium
Robert Lyon
16.10
Fix Released
Medium
Unassigned

Bug Description

When attempting to copy a collection or page on 16.04RC1, a white screen appears and the following error is reported to the logs:

[12-Apr-2016 13:22:03] PHP Fatal error: Call to undefined function
artefact_get_descendants() in /home/darren/public_html/m1604/blocktype/lib.php
on line 1548
[12-Apr-2016 13:22:03] PHP Stack trace:
[12-Apr-2016 13:22:03] PHP 1. {main}()
/home/darren/public_html/m1604/view/choosetemplate.php:0
[12-Apr-2016 13:22:03] PHP 2. pieform()
/home/darren/public_html/m1604/view/choosetemplate.php:30
[12-Apr-2016 13:22:03] PHP 3. Pieform::process()
/home/darren/public_html/m1604/lib/mahara.php:4493
[12-Apr-2016 13:22:03] PHP 4. Pieform->__construct()
/home/darren/public_html/m1604/lib/pieforms/pieform.php:161
[12-Apr-2016 13:22:03] PHP 5. call_user_func_array()
/home/darren/public_html/m1604/lib/pieforms/pieform.php:540
[12-Apr-2016 13:22:03] PHP 6. createview_submit()
/home/darren/public_html/m1604/lib/pieforms/pieform.php:540
[12-Apr-2016 13:22:03] PHP 7. Collection::create_from_template()
/home/darren/public_html/m1604/lib/view.php:6436
[12-Apr-2016 13:22:03] PHP 8. View::create_from_template()
/home/darren/public_html/m1604/lib/collection.php:292
[12-Apr-2016 13:22:03] PHP 9. View->copy_contents()
/home/darren/public_html/m1604/lib/view.php:400
[12-Apr-2016 13:22:03] PHP 10. BlockInstance->copy()
/home/darren/public_html/m1604/lib/view.php:5445

This appears to be due to the artefact_get_descendants() function not being available to the BlockInstance::copy() function in blocktype/lib.php:1548

Adding require_once(get_config('docroot') . 'artefact/lib.php'); appears to clear the issue up.

Diff attached.

Revision history for this message
Darren James Harkness (darren-athabascau) wrote :
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Robert, can you please take a look? I can't replicate it neither with regular URLs nor clean URLs.

Darren: Do you have any more testing information?

Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
status: New → Incomplete
milestone: none → 16.04.0
Revision history for this message
Darren James Harkness (darren-athabascau) wrote :

This is on an RHEL6 server, PHP 5.3.3, database upgraded from Mahara 1.10.1.

I've attached a diff of my devel installation, just in case there's something in there mucking up the works. There shouldn't be anything causing the issue, though, since it's local language file changes, a couple of social plugins, and a theme.

Revision history for this message
Darren James Harkness (darren-athabascau) wrote :

I first found this when I was attempting to copy a collection at the institution level. But could replicate it within group collections and individual pages and collections as well.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Darren, you mentioned you have some social plugins. Are there any blocks on the pages? What plugins are these? Have they been fully upgraded to 15.10/16.04 architecture?

Revision history for this message
Darren James Harkness (darren-athabascau) wrote :

The plugins are: Facebooklike, twittertweet, linkedinshare, and linkedinprofile. I'll try removing these plugins tomorrow and see if it makes any difference.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/6332

Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi Darren,

Can you let me know what types of blocks are on the pages of the collection that you are trying to copy?

The code around that artefact_get_descendants() line deals with the copying of journal/blog blocks that are set to full copy.

I am also unable to replicate but have added a patch that should solve the issue for those having it. It does the same as your patch except it calls the artefact/lib.php only if we need to call artefact_get_descendents()
https://reviews.mahara.org/#/c/6332/

Can you please test to see if this fix works for you?

Cheers

Robert

Revision history for this message
Darren James Harkness (darren-athabascau) wrote :

Tried with a variety of collections/pages that primarily consist of text/note blocks.

Here's an example of one collection that causes the white screen:

https://portfolio.elab.athabascau.ca/view/view.php?id=7315

As you can see, nothing special in that collection aside from the twittertweet and facebooklike blocks.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Thanks for sharing that collection, Darren. Were it possible that you send me a Leap2A export of the collection (<email address hidden>)? I still can't replicate the problem. I thought that the navigation block might be the issue as that references other pages in the collection, but that works fine for me.

Being able to work with your collection might shed some light on things more quickly.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Darren,

Thanks for the Leap2A files. I can copy your 16.04 collection without problems, but when I copy the 1.10 one on 16.04 I also get a white screen. That will hopefully help Robert to dig deeper.

Cheers
Kristina

Revision history for this message
Robert Lyon (robertl-9) wrote :

Ok, from what I've found this copy issue only exists if you copy a page/collection from another user using either the
 Portfolio -> Page 'Copy a page' button or Portfolio -> Collection 'Copy a collection' button that takes you to the 'Copy a page or collection' page and you click the copy button there for an item.

If you copy a page/collection via the copy link on the page itself it works fine.

The fix here https://reviews.mahara.org/#/c/6332/ fixes the issue.

To test:

1) Create a page and add a 'note' block to it
2) Share the page with registered users and allow copying from advanced options
3) Log in as another user - go to the page and click 'copy' - the page copies fine
4) Go to Portfolio -> Pages and click 'Copy a page' then click the copy button next to the page owned by the other user - page fails to copy.

With patch in place both ways should copy as expected

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6332
Committed: https://git.mahara.org/mahara/mahara/commit/c8252bcc5cc6cf5052a12ebbfe45fb79af125155
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit c8252bcc5cc6cf5052a12ebbfe45fb79af125155
Author: Robert Lyon <email address hidden>
Date: Wed Apr 13 16:51:16 2016 +1200

Bug 1569552: Require artefact lib when copying blocks

When the block needs to copy child artefacts. Another instance where
we don't include all the plugins on page load anymore.

behatnotneeded

Change-Id: I231325e0f17091da68fbd7a88d7882342f5a5d68
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "16.04_STABLE" branch: https://reviews.mahara.org/6405

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6405
Committed: https://git.mahara.org/mahara/mahara/commit/e1763ca4ae48769ebdceb5eb28a1930b3c22d578
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.04_STABLE

commit e1763ca4ae48769ebdceb5eb28a1930b3c22d578
Author: Robert Lyon <email address hidden>
Date: Wed Apr 13 16:51:16 2016 +1200

Bug 1569552: Require artefact lib when copying blocks

When the block needs to copy child artefacts. Another instance where
we don't include all the plugins on page load anymore.

behatnotneeded

Change-Id: I231325e0f17091da68fbd7a88d7882342f5a5d68
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit c8252bcc5cc6cf5052a12ebbfe45fb79af125155)

Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.