Skip to content

Instantly share code, notes, and snippets.

@beporter
Last active August 29, 2015 14:01
Show Gist options
  • Save beporter/49b9b4054c1700c3fcfc to your computer and use it in GitHub Desktop.
Save beporter/49b9b4054c1700c3fcfc to your computer and use it in GitHub Desktop.
Attempting to call PHP's `EmptyIterator->current()`
$ php -r '$i = new EmptyIterator(); echo $i->current();'
PHP Fatal error: Uncaught exception 'BadMethodCallException' with message
'Accessing the value of an EmptyIterator' in Command line code:1
Stack trace:
#0 Command line code(1): EmptyIterator->current()
#1 {main}
thrown in Command line code on line 1
Fatal error: Uncaught exception 'BadMethodCallException' with message
'Accessing the value of an EmptyIterator' in Command line code on line 1
BadMethodCallException: Accessing the value of an EmptyIterator in
Command line code on line 1
Call Stack:
0.0001 218888 1. {main}() Command line code:0
0.0001 219688 2. EmptyIterator->current() Command line code:1
@beporter
Copy link
Author

Shows what happens if you try to use PHP's EmptyIterator. Linked to from this StackOverflow question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment