HomePhabricator

Set value consistently to null on finish

Description

Set value consistently to null on finish

"yield break" is setting the current() value of generator to null, but
end of generator execution, or thrown exception do not. Let's be
consistent and set the value to null everytime a generator is closed.

This also makes generators more consistent with Zend's behavior:

https://wiki.php.net/rfc/generators
"current: Returns whatever was passed to yield or null if nothing was
passed or the generator is already closed."

IIRC we had this behavior for end of generator execution a few months
ago.

Details

Provenance
janAuthored on
Sara GolemonCommitted on Nov 21 2012, 7:44 AM
Parents
rOSHDa4d00a35dcf4: Decref string keys after calling nvGetKey()
Branches
Unknown
Tags
Unknown
ChangeId
None