Skip to content

Commit

Permalink
Fix unconsistent behavior with "get" and "is"
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfx authored and fabpot committed Nov 22, 2016
1 parent ed6e897 commit 8fb35d5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Twig/Template.php
Expand Up @@ -604,6 +604,9 @@ protected function getAttribute($object, $item, array $arguments = array(), $typ
} else {
$methods = get_class_methods($object);
}
// sort values to have consistent behavior, so that "get" methods win precedence over "is" methods
sort($methods);

This comment has been minimized.

Copy link
@gregsparrow

gregsparrow Nov 23, 2016

I have an issue because of this. My entity have two methods, getExpired() and isExpired() and when in twig view I use object.expired|date isExpired() is triggered and date displaed as 1970....

This comment has been minimized.

Copy link
@stof

stof Nov 23, 2016

Member

no, you have an issue because this is not there in the latest stable relase

This comment has been minimized.

Copy link
@gregsparrow

gregsparrow Nov 23, 2016

it is not in 1.28.1 ? Before I updated to this version it was all right

This comment has been minimized.

Copy link
@stof

stof Nov 23, 2016

Member

Well, the regression is part of Twig 1.28, and this commit fixing it will be part of the upcoming Twig 1.28.2 (not yet released.

Btw, the github interface shows where this commit is. And for now, there is no tags listed here:
github_tags

This comment has been minimized.

Copy link
@fabpot

fabpot Nov 23, 2016

Contributor

I've just releases 1.28.2 which includes the fix.


$cache = array();

foreach ($methods as $method) {
Expand Down

0 comments on commit 8fb35d5

Please sign in to comment.