diff options
author | Nikita Popov <nikic@php.net> | 2014-10-09 19:15:07 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2014-10-09 20:48:27 +0200 |
commit | df79b9b27af70afe502979c84a981d36ed9d86a8 (patch) | |
tree | 4a642d706985c960bbfeea70f195aeefe8eb4631 /Zend/zend_API.c | |
parent | c061c8294514fb8eae7b96f77839312244a50048 (diff) | |
download | php-git-df79b9b27af70afe502979c84a981d36ed9d86a8.tar.gz |
Update get_class_name semantics
* get_class_name is now only used for displaying the class name
in debugging functions like var_dump, print_r, etc. It is no
longer used in get_class() etc.
* As it is no longer used in get_parent_class() the parent
argument is now gone. This also fixes incorrect parent classes
being reported in COM.
* get_class_name is now always required (previously some places
made it optional and some required it) and is also required
to return a non-NULL value.
* Remove zend_get_object_classname. This also fixes a number of
potential leaks due to incorrect usage of this function.
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index cf4ac5effd..dd60dcb5fb 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -196,21 +196,6 @@ ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */ } /* }}} */ -/* returns 1 if you need to copy result, 0 if it's already a copy */ -ZEND_API zend_string *zend_get_object_classname(const zend_object *object TSRMLS_DC) /* {{{ */ -{ - zend_string *ret; - - if (object->handlers->get_class_name != NULL) { - ret = object->handlers->get_class_name(object, 0 TSRMLS_CC); - if (ret) { - return ret; - } - } - return object->ce->name; -} -/* }}} */ - static int parse_arg_object_to_string(zval *arg, char **p, size_t *pl, int type TSRMLS_DC) /* {{{ */ { if (Z_OBJ_HANDLER_P(arg, cast_object)) { @@ -3814,8 +3799,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const EG(scope) = scope; if (!Z_OBJ_HT_P(object)->write_property) { - zend_string *class_name = zend_get_object_classname(Z_OBJ_P(object) TSRMLS_CC); - zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, class_name->val); + zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, Z_OBJCE_P(object)->name->val); } ZVAL_STRINGL(&property, name, name_length); Z_OBJ_HT_P(object)->write_property(object, &property, value, NULL TSRMLS_CC); @@ -3994,8 +3978,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c EG(scope) = scope; if (!Z_OBJ_HT_P(object)->read_property) { - zend_string *class_name = zend_get_object_classname(Z_OBJ_P(object) TSRMLS_CC); - zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, class_name->val); + zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, Z_OBJCE_P(object)->name->val); } ZVAL_STRINGL(&property, name, name_length); |