Problem with artefactchooser and dwoo template

Bug #1513611 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Robert Lyon
15.10
Fix Released
High
Robert Lyon

Bug Description

A couple of people have reported this problem, on of which is here:

https://mahara.org/interaction/forum/topic.php?id=7426&offset=0&limit=10#post29848

The error they get is: PHP Parse error: syntax error, unexpected '(' in /path/to/dwoo/compile/raw/var/www/mahara-15.10.0/htdocs/theme/raw/templates/form/artefactchooser.tpl.d17.php on line 39

The line looks to be syntax correct and works fine on my machine (Ubuntu 14.04, firefox, PHP 5.5.9)

But we could try and fix this issue by removing the empty() function from the template htdocs/theme/raw/templates/form/artefactchooser.tpl and place it in the htdocs/lib/form/elements/artefactchooser.php file instead to see if that makes a 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/5665

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

Here's the compiled PHP code that the user reports (I added some line breaks for visibility)

<?php
if (
    empty(
        (
            is_string($tmp = $this->scope["artefacts"]
        ) ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)
    )
) {

So I think it's that problem we've bumped into before, where PHP versions prior to 5.5 don't support passing expressions to empty().

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

Affects 15.10, but not 15.04 or earlier (which had !$artefacts instead of empty($artefacts)).

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

Reviewed: https://reviews.mahara.org/5665
Committed: https://git.mahara.org/mahara/mahara/commit/6353a366818070114126e845a309a1b86a209164
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 6353a366818070114126e845a309a1b86a209164
Author: Robert Lyon <email address hidden>
Date: Fri Nov 6 09:34:37 2015 +1300

Bug 1513611: Artefactchooser template is broken for some systems

I can't replicate but believe it's due to the .tpl file compiling
to a call to empty() with an expression as the parameter (which
is not supported by PHP prior to 5.5)

behatnotneeded: covered by existing tests

Change-Id: Ic44b89070de169790dbc5ab6d32a12484925c7e3
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 "15.10_STABLE" branch: https://reviews.mahara.org/5671

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

Since we've encountered a couple of problems with PHP 5.4 compatibility and the empty() method, I've filed a bug to check for it as part of our minaccept scirpt: Bug 1514275

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

Reviewed: https://reviews.mahara.org/5671
Committed: https://git.mahara.org/mahara/mahara/commit/f15b4e7d1866cdb84f0ee85a7b699fae3e120aa3
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.10_STABLE

commit f15b4e7d1866cdb84f0ee85a7b699fae3e120aa3
Author: Robert Lyon <email address hidden>
Date: Fri Nov 6 09:34:37 2015 +1300

Bug 1513611: Artefactchooser template is broken for some systems

I can't replicate but believe it's due to the .tpl file compiling
to a call to empty() with an expression as the parameter (which
is not supported by PHP prior to 5.5)

behatnotneeded: covered by existing tests

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

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.