diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2015-06-17 12:50:16 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2015-06-17 12:50:16 +0300 |
| commit | 4a6e1345e2dfd1d1edfd18b783bc9000598a4d92 (patch) | |
| tree | 05b52f5393e38d86e1a738696a63143289c8f25d /Zend/zend_builtin_functions.c | |
| parent | e011e6fdf4a7b65d4cf92dcad57f1e4fe4b25b80 (diff) | |
| download | php-git-4a6e1345e2dfd1d1edfd18b783bc9000598a4d92.tar.gz | |
Use COW to prevent unnecessary duplication of dynamic propertyes of stdClass (and other classes without predefined properties).
Diffstat (limited to 'Zend/zend_builtin_functions.c')
| -rw-r--r-- | Zend/zend_builtin_functions.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 8989e93fa6..8ea758adcc 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1151,6 +1151,12 @@ ZEND_FUNCTION(get_object_vars) if (!zobj->ce->default_properties_count && properties == zobj->properties) { /* fast copy */ + if (EXPECTED(zobj->handlers == &std_object_handlers)) { + if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) { + GC_REFCOUNT(properties)++; + } + RETURN_ARR(properties); + } RETURN_ARR(zend_array_dup(properties)); } else { array_init_size(return_value, zend_hash_num_elements(properties)); |
