diff options
author | Nikita Popov <nikic@php.net> | 2012-07-22 14:33:25 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2012-07-22 14:33:25 +0200 |
commit | de80e3ce4b5b7a9ec0cfdd0778e77027a7ebfcc2 (patch) | |
tree | d1880620be82ccf28c464577aa3dd023ebb751a6 /tests | |
parent | 80748631aa1c4193cbc68f8854d82e7a57817fe2 (diff) | |
download | php-git-de80e3ce4b5b7a9ec0cfdd0778e77027a7ebfcc2.tar.gz |
Remove reference restrictions from foreach
foreach only allowed variables to be traversed by reference. This never
really made sense because
a) Expressions like array(&$a, &$b) can be meaningfully iterated by-ref
b) Function calls can return by-ref (so they can also be meaningfully
iterated)
c) Iterators could at least in theory also be iterated by-ref (not
sure if any iterator makes use of this)
With by-ref generators the restriction makes even less sense, so I removed
it altogether.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lang/foreachLoop.008.phpt | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/tests/lang/foreachLoop.008.phpt b/tests/lang/foreachLoop.008.phpt deleted file mode 100644 index 787f43b883..0000000000 --- a/tests/lang/foreachLoop.008.phpt +++ /dev/null @@ -1,10 +0,0 @@ ---TEST--
-Foreach loop tests - error case: reference to constant array, with key.
---FILE--
-<?php
-foreach (array(1,2) as $k=>&$v) {
- var_dump($v);
-}
-?>
---EXPECTF--
-Fatal error: Cannot create references to elements of a temporary array expression in %s on line 2
|