diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-05-28 18:30:04 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-05-28 18:30:04 +0300 |
commit | 9af07b6ed5cd9a25d5f4e8ebeeff96cf49b3481b (patch) | |
tree | 94f7722a8c2f47a311baeda631e4dcd0b4e9f0bd | |
parent | c27dda709c7b20b1018b0a1d2ff21c3e7aa5f8b5 (diff) | |
parent | 74be58938c8839062bbc3803547ec96010e3e411 (diff) | |
download | php-git-9af07b6ed5cd9a25d5f4e8ebeeff96cf49b3481b.tar.gz |
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src:
Translate correct C++ version with suitable compiler
Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT)
-rw-r--r-- | Zend/tests/bug76383.phpt | 13 | ||||
-rw-r--r-- | ext/standard/array.c | 2 | ||||
-rw-r--r-- | win32/build/confutils.js | 4 |
3 files changed, 18 insertions, 1 deletions
diff --git a/Zend/tests/bug76383.phpt b/Zend/tests/bug76383.phpt new file mode 100644 index 0000000000..ae26ba8acd --- /dev/null +++ b/Zend/tests/bug76383.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #76383: array_map on $GLOBALS returns IS_INDIRECT +--FILE-- +<?php + +$a = 1; +array_map(function($x) use (&$lastval) { $lastval = $x; }, $GLOBALS); +var_dump(gettype($lastval), $lastval); // will contain $a + +?> +--EXPECT-- +string(7) "integer" +int(1) diff --git a/ext/standard/array.c b/ext/standard/array.c index 55d338faad..363abfc771 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -6140,7 +6140,7 @@ PHP_FUNCTION(array_map) array_init_size(return_value, maxlen); zend_hash_real_init(Z_ARRVAL_P(return_value), HT_FLAGS(Z_ARRVAL(arrays[0])) & HASH_FLAG_PACKED); - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(arrays[0]), num_key, str_key, zv) { + ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL(arrays[0]), num_key, str_key, zv) { fci.retval = &result; fci.param_count = 1; fci.params = &arg; diff --git a/win32/build/confutils.js b/win32/build/confutils.js index cde74a2357..0dd34c9a24 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -3231,6 +3231,10 @@ function toolset_setup_common_cflags() } } + if (VCVERS >= 1914) { + /* This is only in effect for CXX sources, __cplusplus is not defined in C sources. */ + ADD_FLAG("CFLAGS", "/Zc:__cplusplus"); + } } else if (CLANG_TOOLSET) { if (X64) { ADD_FLAG('CFLAGS', '-m64'); |