Skip to content

Collection tap changes wrong collection #24675

Closed
@Fuzzyma

Description

@Fuzzyma

The tap method of Collection seems broken. I only read the source but to me it seems like the callack gets passed a copy of the collection but NOT the copy is returned. So basically the callback acts on a Collection which will be GarbageCollected afterwards:

    public function tap(callable $callback)
    {
        $callback(new static($this->items));
        return $this;
    }

Source

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions