Problem with isset() in a template file

Bug #1486262 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Low
Robert Lyon
1.10
Fix Released
Low
Unassigned
1.9
Fix Released
Low
Unassigned
15.04
Fix Released
Low
Unassigned
15.10
Fix Released
Undecided
Unassigned

Bug Description

Getting this error

PHP Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in /var/lib/sitedata/.../htdocs/theme/raw/artefact/internal/blocktype/textbox/templates/content.tpl.d17.php on line 14

So will fix up the relating template to not use isset() as it doesn't need to

Robert Lyon (robertl-9)
Changed in mahara:
importance: Undecided → High
status: New → In Progress
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/5145

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/5146

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "1.10_STABLE" branch: https://reviews.mahara.org/5147

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "1.9_STABLE" branch: https://reviews.mahara.org/5148

Robert Lyon (robertl-9)
summary: - Problem with isset() in a tempate file
+ Problem with isset() in a template file
Revision history for this message
Aaron Wells (u-aaronw) wrote :

The error is caused by this problem: http://php.net/manual/en/function.isset.php

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

Hah, whoops, that's not a very specific link. I meant to post this: http://php.net/manual/en/function.isset.php#refsect1-function.isset-notes

Down in the "Notes" section:

"Warning: isset() only works with variables as passing anything else will result in a parse error. For checking if constants are set use the defined() function."

It's a little strange that this particular line of code is causing it. The line (in a Dwoo file) is:

{if isset($attachments)}

I guess Dwoo must be parsing that template in such a way that $attachments is replaced by an expression rather than a variable. Hm, actually I think that things starting with "$" in Dwoo are not strictly PHP variables, but are placeholders for Dwoo assignments, so it probably is not a surprise that compiles into an expression instead of a variable.

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

Turns out this is a low priority thing as one can clear their dataroot/dwoo/compile/ directory and the problem will go away

Changed in mahara:
importance: High → Low
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/5146
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/49d14141489a5faf99cfe4488e354450528d2a39
Submitter: Jono Mingard (<email address hidden>)
Branch: 15.04_STABLE

commit 49d14141489a5faf99cfe4488e354450528d2a39
Author: Robert Lyon <email address hidden>
Date: Wed Aug 19 09:40:52 2015 +1200

Bug 1486262: Removing the isset() option from Note content.tpl

behatnotneeded

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

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/5145
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/a41c9941536f50c163dc7ce4c688039595f48f95
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit a41c9941536f50c163dc7ce4c688039595f48f95
Author: Robert Lyon <email address hidden>
Date: Wed Aug 19 09:40:52 2015 +1200

Bug 1486262: Removing the isset() option from Note content.tpl

behatnotneeded

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

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/5148
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/2a460394182856d32593eb542eecac30d1b8d896
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.9_STABLE

commit 2a460394182856d32593eb542eecac30d1b8d896
Author: Robert Lyon <email address hidden>
Date: Wed Aug 19 09:54:18 2015 +1200

Bug 1486262: Removing the isset() option from Note content.tpl

behatnotneeded

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

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/5147
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/0c9343324a97797db589c1022a33755ca466b624
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit 0c9343324a97797db589c1022a33755ca466b624
Author: Robert Lyon <email address hidden>
Date: Wed Aug 19 09:54:18 2015 +1200

Bug 1486262: Removing the isset() option from Note content.tpl

behatnotneeded

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

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
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.