Blocktype rendering error when artefact is not found
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Mahara |
Low
|
Robert Lyon | ||
| 15.10 |
Low
|
Unassigned |
Bug Description
Mahara 15.10:
version = 2015092910
release = 15.10.0
If an artefact is not found while rending a block instance, the try/catch catches the error - which is good.
But, further down the page when it sets pieformcss => $css (on line 916):
return array('html' => $smarty-
the variable $css has not been declared - giving this error:
[Tue Nov 10 11:47:20 2015] [error] [client 192.168.124.138] [WAR] 63 (blocktype/
[Tue Nov 10 11:47:20 2015] [error] [client 192.168.124.138] Call stack (most recent first):, referer: http://
[Tue Nov 10 11:47:20 2015] [error] [client 192.168.124.138] * log_message(
[Tue Nov 10 11:47:20 2015] [error] [client 192.168.124.138] * error(8, "Undefined variable: css", "/var/www/
[Tue Nov 10 11:47:20 2015] [error] [client 192.168.124.138] * BlockInstance-
[Tue Nov 10 11:47:20 2015] [error] [client 192.168.124.138] * View->build_
[Tue Nov 10 11:47:20 2015] [error] [client 192.168.124.138] * View->build_
[Tue Nov 10 11:47:20 2015] [error] [client 192.168.124.138] * View->build_
[Tue Nov 10 11:47:20 2015] [error] [client 192.168.124.138] , referer: http://
So, before calling the static methods (on lines 822+), we should instantiate the $css variable first.
So when it does fail, $css has already been defined.
Aaron Wells (u-aaronw) wrote : | #1 |
Ghada El-Zoghbi (ghada-z) wrote : | #2 |
Hi Aaron,
We're upgrading a Mahara site from 1.10 to 15.10.
In 1.10, we are getting this:
Nov 10 12:25:28 TQIDEB001 mahara-site-acttqi: [Tue Nov 10 12:25:28 2015] [error] [client 203.29.131.142] [DBG] 43 (blocktype/
Nov 10 12:25:28 TQIDEB001 mahara-site-acttqi: [Tue Nov 10 12:25:28 2015] [error] [client 203.29.131.142] [DBG] 43 (blocktype/
The page was originally copied from institution pages/collection.
The institution pages and collection were then deleted.
I think that's probably when it started to happen but I'm not 100% sure.
I hope this helps.
Thanks,
Ghada
Aaron Wells (u-aaronw) wrote : | #3 |
Hm, that could be it. I think when you copy a page, in some cases it continues to point to the original artefacts instead of giving you a copy. (Specifically, some of the blog blocks can do this.) If that's the case, then perhaps there's a bug in the institution page delete code that fails to clean up those links.
So, probably best to fix it on both sides. Correct the code that is failing to delete the link, and change the BlockInstance rendering methods to be more robust against missing artefacts.
By the way, is that an actual error that crashes the page and makes it impossible to edit the block? Or is it just a warning message in the logs?
Cheers,
Aaron
Ghada El-Zoghbi (ghada-z) wrote : | #4 |
Hi Aaron,
It's a warning in the log files (in 1.10).
But, because we've got debugging on while upgrading (15.10), we just noticed it now.
You can still edit the page.
Ghada
Aaron Wells (u-aaronw) wrote : | #5 |
Okay, since it's just a warning I'll mark this bug "Low" priority.
Cheers,
Aaron
Kristina Hoeppner (kris-hoeppner) wrote : | #6 |
There's a patch that might solve this: https:/
Kristina Hoeppner (kris-hoeppner) wrote : | #7 |
I haven't been able to replicate the issue yet and thus can't really test whether the patch works or not.
Reviewed: https:/
Committed: https:/
Submitter: Aaron Wells (<email address hidden>)
Branch: master
commit f600592d3ba07ab
Author: Robert Lyon <email address hidden>
Date: Tue Feb 9 10:21:10 2016 +1300
Bug #1514641: Avoid undefined variable 'css' in block render
To avoid lines in error log
Behatnotneeded
Change-Id: I7024d0c1aa764d
Signed-off-by: Robert Lyon <email address hidden>
Patch for "16.04_STABLE" branch: https:/
Reviewed: https:/
Committed: https:/
Submitter: Aaron Wells (<email address hidden>)
Branch: 16.04_STABLE
commit 865fa5b1a686600
Author: Robert Lyon <email address hidden>
Date: Tue Feb 9 10:21:10 2016 +1300
Bug #1514641: Avoid undefined variable 'css' in block render
To avoid lines in error log
Behatnotneeded
Change-Id: I7024d0c1aa764d
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit f600592d3ba07ab
Patch for "15.10_STABLE" branch: https:/
Reviewed: https:/
Committed: https:/
Submitter: Aaron Wells (<email address hidden>)
Branch: 15.10_STABLE
commit fe149db7ac63877
Author: Robert Lyon <email address hidden>
Date: Tue Feb 9 10:21:10 2016 +1300
Bug #1514641: Avoid undefined variable 'css' in block render
To avoid lines in error log
Behatnotneeded
Change-Id: I7024d0c1aa764d
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit f600592d3ba07ab
(cherry picked from commit 865fa5b1a686600
no longer affects: | mahara/16.04 |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
Hi Ghada,
Do you have any instructions on how to replicate this error? I tried putting an image in an image block and then deleting the image, but it seems like that particular use case successfully unsets the block instance so this error doesn't happen.
Cheers,
Aaron