Skip to content

Commit

Permalink
minor twigphp#1401 [Twig][Tests][Fixtures][filters] Added empty strin…
Browse files Browse the repository at this point in the history
…g tests for "first" and "last" filters (ureimers)

This PR was squashed before being merged into the 1.15-dev branch (closes twigphp#1401).

Discussion
----------

[Twig][Tests][Fixtures][filters] Added empty string tests for "first" and "last" filters

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT

This was already fixed with with 6003ae4 but to make sure there won't be any regression bugs in the future. This is an edge case but the first and the last element of an empty string are empty strings too.
Before the above mentioned PR this threw a notice `Uninitialized string offset: 0`.

Commits
-------

0db5c31 [Twig][Tests][Fixtures][filters] Added empty string tests for "first" and "last" filters
  • Loading branch information
fabpot committed May 15, 2014
2 parents 6af8182 + 0db5c31 commit 55253c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/Twig/Tests/Fixtures/filters/first.test
Expand Up @@ -6,6 +6,7 @@
{{ '1234'|first }}
{{ arr|first }}
{{ 'Ä€é'|first }}
{{ ''|first }}
--DATA--
return array('arr' => new ArrayObject(array(1, 2, 3, 4)))
--EXPECT--
Expand Down
1 change: 1 addition & 0 deletions test/Twig/Tests/Fixtures/filters/last.test
Expand Up @@ -6,6 +6,7 @@
{{ '1234'|last }}
{{ arr|last }}
{{ 'Ä€é'|last }}
{{ ''|last }}
--DATA--
return array('arr' => new ArrayObject(array(1, 2, 3, 4)))
--EXPECT--
Expand Down

0 comments on commit 55253c3

Please sign in to comment.