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 /i
|
||||
Null: / (null)\b /i
|
||||
|
||||
# Booleans
|
||||
|
||||
Boolean: / (true|false) /i
|
||||
Boolean: / (true|false)\b /i
|
||||
|
||||
# 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');
|
||||
function match_Null ($stack = array()) {
|
||||
$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;
|
||||
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');
|
||||
function match_Boolean ($stack = array()) {
|
||||
$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;
|
||||
return $this->finalise($result);
|
||||
}
|
||||
|
@ -724,9 +724,12 @@ after'
|
||||
['boolean:1', 'TRUE'],
|
||||
['boolean:', 'false'],
|
||||
['boolean:', 'FALSE'],
|
||||
// Strings which loosely look like booleans
|
||||
['string:truthy', 'truthy'],
|
||||
['string:falsy', 'falsy'],
|
||||
// Strings which may look like booleans/null to the parser
|
||||
['string:nullish', 'nullish'],
|
||||
['string:notnull', 'notnull'],
|
||||
['string:truethy', 'truethy'],
|
||||
['string:untrue', 'untrue'],
|
||||
['string:falsey', 'falsey'],
|
||||
// Integers
|
||||
['integer:0', '0'],
|
||||
['integer:1', '1'],
|
||||
|
Loading…
Reference in New Issue
Block a user