Skip to content

Commit 8c1ba86

Browse files
committed
Don't add a ref when resolving parent/self
Don't see any reason why we should do that?
1 parent e7171a8 commit 8c1ba86

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Zend/zend_inheritance.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static zend_string *_get_parent_class_name(zend_class_entry *ce)
196196
static zend_string *_resolve_parent_and_self(const zend_function *fe, zend_string *name)
197197
{ /* {{{ */
198198
zend_class_entry *ce = fe->common.scope;
199-
/* if there isn't a class then we shouldn't be resolving parent and self */
199+
/* If there isn't a class then we shouldn't be resolving parent and self. */
200200
ZEND_ASSERT(ce);
201201

202202
switch (zend_get_class_fetch_type(name)) {
@@ -212,18 +212,18 @@ static zend_string *_resolve_parent_and_self(const zend_function *fe, zend_strin
212212
break;
213213

214214
case ZEND_FETCH_CLASS_DEFAULT:
215-
/* already resolved */
215+
/* Already resolved. */
216216
break;
217217

218218
case ZEND_FETCH_CLASS_STATIC:
219-
/* This currently a syntax error */
219+
/* This is currently a syntax error. */
220220
ZEND_ASSERT(0);
221221
break;
222222

223223
EMPTY_SWITCH_DEFAULT_CASE();
224224
}
225225

226-
return zend_string_copy(name);
226+
return name;
227227
} /* }}} */
228228

229229
static zend_bool class_visible(zend_class_entry *ce) {
@@ -285,7 +285,6 @@ static inheritance_status _check_covariance(
285285
zend_string *proto_class_name =
286286
_resolve_parent_and_self(proto, ZEND_TYPE_NAME(proto_type));
287287
if (!proto_class_name) {
288-
zend_string_free(fe_class_name);
289288
return INHERITANCE_UNRESOLVED;
290289
}
291290

@@ -308,7 +307,6 @@ static inheritance_status _check_covariance(
308307
code = INHERITANCE_ERROR;
309308
}
310309
}
311-
zend_string_release(proto_class_name);
312310
} else if (proto_type_code == IS_ITERABLE) {
313311
zend_class_entry *fe_ce = lookup_class(fe_class_name);
314312
if (fe_ce) {
@@ -325,7 +323,6 @@ static inheritance_status _check_covariance(
325323
code = INHERITANCE_ERROR;
326324
}
327325

328-
zend_string_release(fe_class_name);
329326
return code;
330327
} else if (ZEND_TYPE_IS_CLASS(proto_type)) {
331328
return INHERITANCE_ERROR;

0 commit comments

Comments
 (0)