com php-src: Change "foreach" statement behavior (this is just a PoC yet): Zend/tests/bug40509.phpt Zend/tests/bug40705.phpt Zend/zend_c ompile.c Zend/zend_compile.h Zend/zend_hash.h Z end/zend_opcode.c Zend/zend_types.h Zend/zend_vm _def.h Zend/zend_vm_execute.h Zend/zend_vm_op codes.c Zend/zend_vm_opcodes.h ext/opcache/Optimize r/block_pass.c ext/opcache/Optimizer/nop_removal.c ext/opcache/Optimizer/optimize_temp_vars_5.c ext/op cache/Optimizer/pass1

[email protected] (Rasmus Lerdorf)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    4638f7b91407c48710007af82a68da0007c820f2
Author:    Dmitry Stogov <[email protected]>         Wed, 28 Jan 2015 07:43:28 +0300
Parents:   638d0cb7531525201e00577d5a77f1da3f84811e
Branches:  dstogov-foreach

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=4638f7b91407c48710007af82a68da0007c820f2

Log:
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)

Changed paths:
  M  Zend/tests/bug40509.phpt
  M  Zend/tests/bug40705.phpt
  M  Zend/zend_compile.c
  M  Zend/zend_compile.h
  M  Zend/zend_hash.h
  M  Zend/zend_opcode.c
  M  Zend/zend_types.h
  M  Zend/zend_vm_def.h
  M  Zend/zend_vm_execute.h
  M  Zend/zend_vm_opcodes.c
  M  Zend/zend_vm_opcodes.h
  M  ext/opcache/Optimizer/block_pass.c
  M  ext/opcache/Optimizer/nop_removal.c
  M  ext/opcache/Optimizer/optimize_temp_vars_5.c
  M  ext/opcache/Optimizer/pass1_5.c
  M  ext/opcache/Optimizer/pass3.c
  M  ext/opcache/Optimizer/zend_optimizer.c
  M  ext/opcache/zend_persist.c
  M  tests/lang/bug23624.phpt
  M  tests/lang/foreachLoop.001.phpt
  M  tests/lang/foreachLoop.009.phpt
  M  tests/lang/foreachLoop.011.phpt
  M  tests/lang/foreachLoop.014.phpt
  M  tests/lang/foreachLoopObjects.006.phpt
diff_4638f7b91407c48710007af82a68da0007c820f2.txt (text/plain, 102.5 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.