Skip to content

Commit 37383a6

Browse files
committed
Fix bug added when refactoring, document some new methods.
1 parent 2f4d154 commit 37383a6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ext/spl/spl_observer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ static spl_SplObjectStorageElement *spl_object_storage_create_element(zend_objec
145145
return pelement;
146146
} /* }}} */
147147

148+
/* A faster version of spl_object_storage_attach used when neither SplObjectStorage->getHash nor SplObjectStorage->offsetSet is overridden. */
148149
static spl_SplObjectStorageElement *spl_object_storage_attach_handle(spl_SplObjectStorage *intern, zend_object *obj, zval *inf) /* {{{ */
149150
{
150151
uint32_t handle = obj->handle;
@@ -179,6 +180,7 @@ spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *int
179180
if (EXPECTED(!(intern->flags & SOS_OVERRIDDEN_WRITE_DIMENSION))) {
180181
return spl_object_storage_attach_handle(intern, obj, inf);
181182
}
183+
/* getHash or offsetSet is overridden. */
182184

183185
spl_SplObjectStorageElement *pelement, element;
184186
zend_hash_key key;
@@ -198,7 +200,7 @@ spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *int
198200
}
199201
spl_object_storage_free_hash(intern, &key);
200202
/* Call the old value's destructor last, in case it moves the entry */
201-
zval_ptr_dtor(&pelement->inf);
203+
zval_ptr_dtor(&zv_inf);
202204
return pelement;
203205
}
204206

0 commit comments

Comments
 (0)