mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Use zend_string when storing incomplete class name
No need to copy the string here...
This commit is contained in:
@@ -142,12 +142,11 @@ PHPAPI zend_string *php_lookup_class_name(zend_object *object)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_store_class_name */
|
||||
PHPAPI void php_store_class_name(zval *object, const char *name, size_t len)
|
||||
PHPAPI void php_store_class_name(zval *object, zend_string *name)
|
||||
{
|
||||
zval val;
|
||||
|
||||
|
||||
ZVAL_STRINGL(&val, name, len);
|
||||
ZVAL_STR_COPY(&val, name);
|
||||
zend_hash_str_update(Z_OBJPROP_P(object), MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1, &val);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -51,7 +51,7 @@ extern "C" {
|
||||
|
||||
PHPAPI void php_register_incomplete_class(void);
|
||||
PHPAPI zend_string *php_lookup_class_name(zend_object *object);
|
||||
PHPAPI void php_store_class_name(zval *object, const char *name, size_t len);
|
||||
PHPAPI void php_store_class_name(zval *object, zend_string *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
||||
@@ -1013,7 +1013,7 @@ use_double:
|
||||
}
|
||||
|
||||
object ":" uiv ":" ["] {
|
||||
size_t len, len2, len3, maxlen;
|
||||
size_t len, len3, maxlen;
|
||||
zend_long elements;
|
||||
char *str;
|
||||
zend_string *class_name;
|
||||
@@ -1031,7 +1031,7 @@ object ":" uiv ":" ["] {
|
||||
custom_object = 1;
|
||||
}
|
||||
|
||||
len2 = len = parse_uiv(start + 2);
|
||||
len = parse_uiv(start + 2);
|
||||
maxlen = max - YYCURSOR;
|
||||
if (maxlen < len || len == 0) {
|
||||
*p = start + 2;
|
||||
@@ -1143,7 +1143,7 @@ object ":" uiv ":" ["] {
|
||||
ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
|
||||
|
||||
if (ret && incomplete_class) {
|
||||
php_store_class_name(rval, ZSTR_VAL(class_name), len2);
|
||||
php_store_class_name(rval, class_name);
|
||||
}
|
||||
zend_string_release_ex(class_name, 0);
|
||||
return ret;
|
||||
@@ -1181,7 +1181,7 @@ object ":" uiv ":" ["] {
|
||||
}
|
||||
|
||||
if (incomplete_class) {
|
||||
php_store_class_name(rval, ZSTR_VAL(class_name), len2);
|
||||
php_store_class_name(rval, class_name);
|
||||
}
|
||||
zend_string_release_ex(class_name, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user