]> granicus.if.org Git - php/commit
Change "foreach" statement behavior (this is just a PoC yet)
authorDmitry Stogov <dmitry@zend.com>
Wed, 28 Jan 2015 04:43:28 +0000 (07:43 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 28 Jan 2015 04:43:28 +0000 (07:43 +0300)
commit4638f7b91407c48710007af82a68da0007c820f2
tree7f4f2504207970dcbea2f69b2fad5c9a5ec62743
parent638d0cb7531525201e00577d5a77f1da3f84811e
Change "foreach" statement behavior (this is just a PoC yet)

- "foreach by value" don't relay on internal array/object pointer and doesnt perform array duplication. It just locks it incrementing reference counter. If the original array is modified by some code, the copy on write is performed and "foreach" still work with the old copy.

- it makes no difference if array given to "foreach by value" is reference itself

- "foreach by reference" still use internal array/object pointer and should work similar to PHP-5. (This id not completely implemented)
24 files changed:
Zend/tests/bug40509.phpt
Zend/tests/bug40705.phpt
Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_hash.h
Zend/zend_opcode.c
Zend/zend_types.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
Zend/zend_vm_opcodes.c
Zend/zend_vm_opcodes.h
ext/opcache/Optimizer/block_pass.c
ext/opcache/Optimizer/nop_removal.c
ext/opcache/Optimizer/optimize_temp_vars_5.c
ext/opcache/Optimizer/pass1_5.c
ext/opcache/Optimizer/pass3.c
ext/opcache/Optimizer/zend_optimizer.c
ext/opcache/zend_persist.c
tests/lang/bug23624.phpt
tests/lang/foreachLoop.001.phpt
tests/lang/foreachLoop.009.phpt
tests/lang/foreachLoop.011.phpt
tests/lang/foreachLoop.014.phpt
tests/lang/foreachLoopObjects.006.phpt