mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 12:26:30 +00:00
fixed previous commit
This commit is contained in:
@@ -443,8 +443,8 @@ function twig_in_filter($value, $compare)
|
||||
if (is_array($compare)) {
|
||||
return in_array($value, $compare);
|
||||
} elseif (is_string($compare)) {
|
||||
if (!$compare) {
|
||||
return empty($value);
|
||||
if (!strlen((string) $value)) {
|
||||
return empty($compare);
|
||||
}
|
||||
return false !== strpos($compare, (string) $value);
|
||||
} elseif (is_object($compare) && $compare instanceof Traversable) {
|
||||
|
||||
@@ -12,12 +12,27 @@ TRUE
|
||||
{% else %}
|
||||
TRUE
|
||||
{% endif %}
|
||||
{% if '' not in foo %}
|
||||
{% if 'a' in bar %}
|
||||
TRUE
|
||||
{% endif %}
|
||||
{% if 'c' not in bar %}
|
||||
TRUE
|
||||
{% endif %}
|
||||
{% if '' not in bar %}
|
||||
TRUE
|
||||
{% endif %}
|
||||
{% if '' in '' %}
|
||||
TRUE
|
||||
{% endif %}
|
||||
{% if '0' not in '' %}
|
||||
TRUE
|
||||
{% endif %}
|
||||
{% if 'a' not in '0' %}
|
||||
TRUE
|
||||
{% endif %}
|
||||
{% if '0' in '0' %}
|
||||
TRUE
|
||||
{% endif %}
|
||||
--DATA--
|
||||
return array('bar' => 'bar', 'foo' => array('bar' => 'bar'))
|
||||
--EXPECT--
|
||||
@@ -26,3 +41,8 @@ TRUE
|
||||
TRUE
|
||||
TRUE
|
||||
TRUE
|
||||
TRUE
|
||||
TRUE
|
||||
TRUE
|
||||
TRUE
|
||||
TRUE
|
||||
|
||||
Reference in New Issue
Block a user