DDC-1189: PersistentCollection::clear() does not cause the collection to be initialized #1497

Closed
opened 2026-01-22 13:16:10 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 2, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user ccapndave:

If clear() is called on an uninitialized PersistentCollection it needs to set the collection to be initialized.

An example of where this can cause problems:

  • Call clear() on an uninitialized collection
  • Check if an entity is in that collection using contains($entity)

This can return a false positive if the entity was previously in the collection.

Originally created by @doctrinebot on GitHub (Jun 2, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user ccapndave: If clear() is called on an uninitialized PersistentCollection it needs to set the collection to be initialized. An example of where this can cause problems: - Call clear() on an uninitialized collection - Check if an entity is in that collection using contains($entity) This can return a false positive if the entity was previously in the collection.
admin added the Bug label 2026-01-22 13:16:10 +01:00
admin closed this issue 2026-01-22 13:16:11 +01:00
Author
Owner
@doctrinebot commented on GitHub (Jun 2, 2011): - is duplicated by [DDC-849: PersistentCollection::clear() doesn't clear the collection](http://www.doctrine-project.org/jira/browse/DDC-849) - relates to [DDC-956: PersistentCollection::clear does not clear the collection](http://www.doctrine-project.org/jira/browse/DDC-956)
Author
Owner

@doctrinebot commented on GitHub (Jun 19, 2011):

Comment created by @beberlei:

Fixed.

@doctrinebot commented on GitHub (Jun 19, 2011): Comment created by @beberlei: Fixed.
Author
Owner

@doctrinebot commented on GitHub (Jun 19, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jun 19, 2011): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1497