mirror of
https://github.com/moodle/moodle.git
synced 2025-05-02 14:28:30 +02:00
Merge branch 'MDL-75473-master' of https://github.com/davewoloszyn/moodle
This commit is contained in:
commit
052c705b08
lib
@ -19,4 +19,10 @@ been already applied upstream for the release being used, can be removed
|
||||
from the list. If still not available upstream, they will need to be re-applied.
|
||||
|
||||
1) If the relevant pull request has not been accepted yet, apply the following commit, so we are able to disable unnecessary rendering:
|
||||
https://github.com/bobthecow/mustache.php/pull/402/commits/db771014c7e346438f68077813ebdda3fdae12df#
|
||||
https://github.com/bobthecow/mustache.php/pull/402/commits/db771014c7e346438f68077813ebdda3fdae12df#
|
||||
This can be achieved by:
|
||||
a) Download the patch from
|
||||
https://github.com/bobthecow/mustache.php/pull/402/commits/db771014c7e346438f68077813ebdda3fdae12df.patch
|
||||
b) In terminal, navigate to lib/mustache/src/Mustache
|
||||
c) Run the following: patch --directory . < ~/path/to/patch.patch
|
||||
d) We do not need the unit test, so run rm DisableLambdaRenderingTest.php
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
class Mustache_Engine
|
||||
{
|
||||
const VERSION = '2.14.1';
|
||||
const VERSION = '2.14.2';
|
||||
const SPEC_VERSION = '1.2.2';
|
||||
|
||||
const PRAGMA_FILTERS = 'FILTERS';
|
||||
|
@ -215,6 +215,10 @@ class Mustache_Tokenizer
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->state !== self::IN_TEXT) {
|
||||
$this->throwUnclosedTagException();
|
||||
}
|
||||
|
||||
$this->flushBuffer();
|
||||
|
||||
// Restore the user's encoding...
|
||||
@ -279,6 +283,10 @@ class Mustache_Tokenizer
|
||||
$close = '=' . $this->ctag;
|
||||
$closeIndex = strpos($text, $close, $index);
|
||||
|
||||
if ($closeIndex === false) {
|
||||
$this->throwUnclosedTagException();
|
||||
}
|
||||
|
||||
$token = array(
|
||||
self::TYPE => self::T_DELIM_CHANGE,
|
||||
self::LINE => $this->line,
|
||||
@ -333,6 +341,10 @@ class Mustache_Tokenizer
|
||||
private function addPragma($text, $index)
|
||||
{
|
||||
$end = strpos($text, $this->ctag, $index);
|
||||
if ($end === false) {
|
||||
$this->throwUnclosedTagException();
|
||||
}
|
||||
|
||||
$pragma = trim(substr($text, $index + 2, $end - $index - 2));
|
||||
|
||||
// Pragmas are hoisted to the front of the template.
|
||||
@ -344,4 +356,23 @@ class Mustache_Tokenizer
|
||||
|
||||
return $end + $this->ctagLen - 1;
|
||||
}
|
||||
|
||||
private function throwUnclosedTagException()
|
||||
{
|
||||
$name = trim($this->buffer);
|
||||
if ($name !== '') {
|
||||
$msg = sprintf('Unclosed tag: %s on line %d', $name, $this->line);
|
||||
} else {
|
||||
$msg = sprintf('Unclosed tag on line %d', $this->line);
|
||||
}
|
||||
|
||||
throw new Mustache_Exception_SyntaxException($msg, array(
|
||||
self::TYPE => $this->tagType,
|
||||
self::NAME => $name,
|
||||
self::OTAG => $this->otag,
|
||||
self::CTAG => $this->ctag,
|
||||
self::LINE => $this->line,
|
||||
self::INDEX => $this->seenTag - $this->otagLen,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ All rights reserved.</copyright>
|
||||
<location>mustache</location>
|
||||
<name>Mustache</name>
|
||||
<description>PHP library for displaying mustache templates.</description>
|
||||
<version>2.14.1</version>
|
||||
<version>2.14.2</version>
|
||||
<license>MIT</license>
|
||||
<repository>https://github.com/bobthecow/mustache.php</repository>
|
||||
<copyrights>
|
||||
|
Loading…
x
Reference in New Issue
Block a user