Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added CachingIterator::__toString() #175

Merged
merged 1 commit into from Feb 8, 2018

Conversation

@vlastavesely
Copy link
Contributor

commented Feb 8, 2018

When an iterator has been used in a template just as {$iterator} and not
as {$iterator->counter} (as documented), it has thrown a kind of confusing
error:

Fatal error: Method Latte\Runtime\CachingIterator::__toString() must not
throw an exception, caught BadMethodCallException: Latte\Runtime\CachingIterator
does not fetch string value (see CachingIterator::__construct) in PATH on line 0

This patch allows conversion to a string by returning the current counter.

  • bug fix? yes
  • BC break? no
added CachingIterator::__toString()
When an iterator has been used in a template just as `{$iterator}` and not
as `{$iterator->counter}` (as documented), it has thrown a kind of confusing
error:

  Fatal error: Method Latte\Runtime\CachingIterator::__toString() must not
  throw an exception, caught BadMethodCallException: Latte\Runtime\CachingIterator
  does not fetch string value (see CachingIterator::__construct) in *PATH* on line 0

This patch allows conversion to a string by returning the current counter.
@dg

This comment has been minimized.

Copy link
Member

commented Feb 8, 2018

Thanks

@dg dg merged commit da5dcda into nette:master Feb 8, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on master at 94.158%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.