diff options
author | Stanley Sufficool <ssufficool@php.net> | 2014-10-20 21:33:32 -0700 |
---|---|---|
committer | Stanley Sufficool <ssufficool@php.net> | 2014-10-20 21:33:32 -0700 |
commit | 8defcb855ab01d9c8ab4759cb793d80149b55a8c (patch) | |
tree | ed51eb30a2cbc92b102557498fb3e4113da1bb07 /ext/spl/spl_functions.c | |
parent | 9c7dbb0487f5991fde03873ea8f5e66d6688415f (diff) | |
parent | baddb1c73a170ef1d2c31bd54cddbc6e1ab596b9 (diff) | |
download | php-git-8defcb855ab01d9c8ab4759cb793d80149b55a8c.tar.gz |
Merge branch 'master' of https://git.php.net/push/php-src
* 'master' of https://git.php.net/push/php-src: (6215 commits)
Extra comma
Moved proxy object support in ASSIGN_ADD (and family) from VM to slow paths of corresponding operators
Simplification
zend_get_property_info_quick() cleanup and optimization
initialize lineno before calling compile file file in phar
Use ADDREF instead of DUP, it must be enough.
Removed old irrelevant comment
fixed compilation error
Fix bug #68262: Broken reference across cloned objects
export functions needed for phpdbg
Fixed compilation
Optimized property access handlers. Removed EG(std_property_info).
Fixed bug #68199 (PDO::pgsqlGetNotify doesn't support NOTIFY payloads)
Don't make difference between undefined and unaccessible properies when call __get() and family
Don't make useless CSE
array_pop/array_shift optimization
check for zlib headers as well as lib for mysqlnd
a realpath cache key can be int or float, catching this
News entry for new curl constants
News entry for new curl constants
...
Diffstat (limited to 'ext/spl/spl_functions.c')
-rw-r--r-- | ext/spl/spl_functions.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c index 7f17d5ef23..f409927271 100644 --- a/ext/spl/spl_functions.c +++ b/ext/spl/spl_functions.c @@ -1,8 +1,8 @@ /* +----------------------------------------------------------------------+ - | PHP Version 5 | + | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -58,7 +58,7 @@ PHPAPI void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * zend_class_entry ce; INIT_CLASS_ENTRY_EX(ce, class_name, strlen(class_name), function_list); - *ppce = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC); + *ppce = zend_register_internal_class_ex(&ce, parent_ce TSRMLS_CC); /* entries changed by initialize */ if (obj_ctor) { @@ -77,16 +77,15 @@ void spl_register_property( zend_class_entry * class_entry, char *prop_name, int /* }}} */ /* {{{ spl_add_class_name */ -void spl_add_class_name(zval *list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC) +void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_flags TSRMLS_DC) { if (!allow || (allow > 0 && pce->ce_flags & ce_flags) || (allow < 0 && !(pce->ce_flags & ce_flags))) { - size_t len = pce->name_length; zval *tmp; - if (zend_hash_find(Z_ARRVAL_P(list), pce->name, len+1, (void*)&tmp) == FAILURE) { - MAKE_STD_ZVAL(tmp); - ZVAL_STRINGL(tmp, pce->name, pce->name_length, 1); - zend_hash_add(Z_ARRVAL_P(list), pce->name, len+1, &tmp, sizeof(zval *), NULL); + if ((tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name)) == NULL) { + zval t; + ZVAL_STR_COPY(&t, pce->name); + zend_hash_add(Z_ARRVAL_P(list), pce->name, &t); } } } @@ -95,7 +94,7 @@ void spl_add_class_name(zval *list, zend_class_entry * pce, int allow, int ce_fl /* {{{ spl_add_interfaces */ void spl_add_interfaces(zval *list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC) { - zend_uint num_interfaces; + uint32_t num_interfaces; for (num_interfaces = 0; num_interfaces < pce->num_interfaces; num_interfaces++) { spl_add_class_name(list, pce->interfaces[num_interfaces], allow, ce_flags TSRMLS_CC); @@ -106,7 +105,7 @@ void spl_add_interfaces(zval *list, zend_class_entry * pce, int allow, int ce_fl /* {{{ spl_add_traits */ void spl_add_traits(zval *list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC) { - zend_uint num_traits; + uint32_t num_traits; for (num_traits = 0; num_traits < pce->num_traits; num_traits++) { spl_add_class_name(list, pce->traits[num_traits], allow, ce_flags TSRMLS_CC); @@ -133,13 +132,9 @@ int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int c } /* }}} */ -char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len, int *name_len TSRMLS_DC) /* {{{ */ +zend_string * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len TSRMLS_DC) /* {{{ */ { - char *rv; - - zend_mangle_property_name(&rv, name_len, ce->name, ce->name_length, prop_name, prop_len, 0); - - return rv; + return zend_mangle_property_name(ce->name->val, ce->name->len, prop_name, prop_len, 0); } /* }}} */ |