Fatal error trying to use an image in a forum topic

Bug #1540667 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Aaron Wells

Bug Description

I noticed this one while using 16.04dev.

To replicate:

1. Create a group
2. In the group, navigate to the default forum and post a topic
3. In the TinyMCE editor for the topic, use the image button.
4. The image button will pop up the TinyMCE image utility, with the Mahara uploader/selector. Use this to upload an image into your file storage and put the image into the TinyMCE text area.
5. Save the topic.

Expected result: The topic is saved, and you can see it with the image in place.
Actual result: Mahara loads a fatal error page with this error:

( ! ) Fatal error: Call to undefined function artefact_instance_from_id() in /home/aaronw/www/mahara/htdocs/lib/embeddedimage.php on line 59
Call Stack
# Time Memory Function Location
1 0.0006 326080 {main}( ) ../edittopic.php:0
2 0.0961 10553960 pieform( ) ../edittopic.php:173
3 0.0984 10858176 Pieform::process( ) ../mahara.php:4438
4 0.0984 10860696 Pieform->__construct( ) ../pieform.php:161
5 0.6325 11054376 call_user_func_array ( ) ../pieform.php:540
6 0.6325 11054720 addtopic_submit( ) ../pieform.php:540
7 0.6997 11082160 EmbeddedImage::prepare_embedded_images( ) ../edittopic.php:220

Revision history for this message
Aaron Wells (u-aaronw) wrote :

I ran a quick test and verified that this problem is *not* present in 15.10.

tags: added: embeddedimage forums regression
Revision history for this message
Aaron Wells (u-aaronw) wrote :

Git bisect traces the regression to this commit: https://reviews.mahara.org/#/c/5818/

There's nothing obvious in there that would cause a problem. My best guess is that the additional safe_require() call is paradoxically causing the lib/embeddedimage.php file to not get loaded, somehow.

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/5994

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

Reviewed: https://reviews.mahara.org/5994
Committed: https://git.mahara.org/mahara/mahara/commit/3f4b4b7f9cbda6c63090843605591285492bc4fe
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 3f4b4b7f9cbda6c63090843605591285492bc4fe
Author: Aaron Wells <email address hidden>
Date: Tue Feb 2 13:05:44 2016 +1300

Prevent crashes when embedding images

Bug 1540667: Prior to commit c432903, we were loading htdocs/artefact/internal/lib.php
on *every* page load, via the login auth method's code that checked for missing
internal artefact files. This call meant that we also loaded artefact/lib.php on
every page load.

Removing that for performance reasons, caused some calls to embeddedimages.php to fail,
when they were on pages that aren't otherwise requiring artefact/lib.php.

behatnotneeded: Can't use the image embedder from Behat

Change-Id: Ibcdbd17d289f2b4614c28ad522173286acc9bc27

no longer affects: mahara/16.04
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.