mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: template parser erroring on strings partially matching true/false/null
This commit is contained in:
parent
d6e8229352
commit
3a6c48cddb
@ -418,11 +418,11 @@ class SSTemplateParser extends Parser implements TemplateParser
|
|||||||
|
|
||||||
# Null
|
# Null
|
||||||
|
|
||||||
Null: / null /i
|
Null: / (null)\b /i
|
||||||
|
|
||||||
# Booleans
|
# Booleans
|
||||||
|
|
||||||
Boolean: / (true|false) /i
|
Boolean: / (true|false)\b /i
|
||||||
|
|
||||||
# Integers and floats
|
# Integers and floats
|
||||||
|
|
||||||
|
@ -1217,11 +1217,11 @@ class SSTemplateParser extends Parser implements TemplateParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Null: / null /i */
|
/* Null: / (null)\b /i */
|
||||||
protected $match_Null_typestack = array('Null');
|
protected $match_Null_typestack = array('Null');
|
||||||
function match_Null ($stack = array()) {
|
function match_Null ($stack = array()) {
|
||||||
$matchrule = "Null"; $result = $this->construct($matchrule, $matchrule, null);
|
$matchrule = "Null"; $result = $this->construct($matchrule, $matchrule, null);
|
||||||
if (( $subres = $this->rx( '/ null /i' ) ) !== FALSE) {
|
if (( $subres = $this->rx( '/ (null)\b /i' ) ) !== FALSE) {
|
||||||
$result["text"] .= $subres;
|
$result["text"] .= $subres;
|
||||||
return $this->finalise($result);
|
return $this->finalise($result);
|
||||||
}
|
}
|
||||||
@ -1229,11 +1229,11 @@ class SSTemplateParser extends Parser implements TemplateParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Boolean: / (true|false) /i */
|
/* Boolean: / (true|false)\b /i */
|
||||||
protected $match_Boolean_typestack = array('Boolean');
|
protected $match_Boolean_typestack = array('Boolean');
|
||||||
function match_Boolean ($stack = array()) {
|
function match_Boolean ($stack = array()) {
|
||||||
$matchrule = "Boolean"; $result = $this->construct($matchrule, $matchrule, null);
|
$matchrule = "Boolean"; $result = $this->construct($matchrule, $matchrule, null);
|
||||||
if (( $subres = $this->rx( '/ (true|false) /i' ) ) !== FALSE) {
|
if (( $subres = $this->rx( '/ (true|false)\b /i' ) ) !== FALSE) {
|
||||||
$result["text"] .= $subres;
|
$result["text"] .= $subres;
|
||||||
return $this->finalise($result);
|
return $this->finalise($result);
|
||||||
}
|
}
|
||||||
|
@ -724,9 +724,12 @@ after'
|
|||||||
['boolean:1', 'TRUE'],
|
['boolean:1', 'TRUE'],
|
||||||
['boolean:', 'false'],
|
['boolean:', 'false'],
|
||||||
['boolean:', 'FALSE'],
|
['boolean:', 'FALSE'],
|
||||||
// Strings which loosely look like booleans
|
// Strings which may look like booleans/null to the parser
|
||||||
['string:truthy', 'truthy'],
|
['string:nullish', 'nullish'],
|
||||||
['string:falsy', 'falsy'],
|
['string:notnull', 'notnull'],
|
||||||
|
['string:truethy', 'truethy'],
|
||||||
|
['string:untrue', 'untrue'],
|
||||||
|
['string:falsey', 'falsey'],
|
||||||
// Integers
|
// Integers
|
||||||
['integer:0', '0'],
|
['integer:0', '0'],
|
||||||
['integer:1', '1'],
|
['integer:1', '1'],
|
||||||
|
Loading…
Reference in New Issue
Block a user