Warning: Illegal offset type in isset or empty in UnitOfWork #5362

Closed
opened 2026-01-22 15:05:30 +01:00 by admin · 4 comments
Owner

Originally created by @astalker on GitHub (Dec 23, 2016).

Originally assigned to: @Ocramius on GitHub.

I'm experiencing the following error Warning: Illegal offset type in isset or empty from UnitOfWork.php. I believe this was introduced in v2.5.5 and is still apparent in v2.5.6

Thrown from the following line 3469 in v2.5.5 (3486 in v2.5.6).

        if (! isset($this->identityMap[$entityName])) {
            return;
        }

This is caused when passing an entityName to the clear method such as
$em->clear($entity);

Please let me know if further details are required.

Originally created by @astalker on GitHub (Dec 23, 2016). Originally assigned to: @Ocramius on GitHub. I'm experiencing the following error `Warning: Illegal offset type in isset or empty` from UnitOfWork.php. I believe this was introduced in v2.5.5 and is still apparent in v2.5.6 Thrown from the following line 3469 in v2.5.5 (3486 in v2.5.6). ``` if (! isset($this->identityMap[$entityName])) { return; } ``` This is caused when passing an entityName to the clear method such as `$em->clear($entity);` Please let me know if further details are required.
admin added the BugDuplicate labels 2026-01-22 15:05:30 +01:00
admin closed this issue 2026-01-22 15:05:32 +01:00
Author
Owner

@Ocramius commented on GitHub (Dec 23, 2016):

$entity must be a string.

This is a duplicate of https://github.com/doctrine/doctrine2/pull/6017

@Ocramius commented on GitHub (Dec 23, 2016): `$entity` must be a string. This is a duplicate of https://github.com/doctrine/doctrine2/pull/6017
Author
Owner

@astalker commented on GitHub (Dec 23, 2016):

Cool, I had a look through but wasn't sure if it was exactly the same issue or not.

@astalker commented on GitHub (Dec 23, 2016): Cool, I had a look through but wasn't sure if it was exactly the same issue or not.
Author
Owner

@astalker commented on GitHub (Dec 23, 2016):

@Ocramius I've looked at the changes in #6017 and it still causes an issue for us as it enforces the existing behaviour with another error. Essentially the behaviour change in 2.5.5 is still present.

I understand we are passing in the wrong thing essentially but its not an insignificant task for us to go through and make all the changes as a result of a bug fix release. For now I've updated our dependencies to use 2.5.4. We will of course make the correct changes going forward.

Its not a big deal in this case as we caught it in time but I think it important to highlight with a bit of feedback. A minor behaviour change to enforce correct behaviour can have much larger knock on effects when included as a bug fix release rather than a minor or major release with BC implications highlighted.

The work is appreciated of course - cheers and Merry Christmas!

@astalker commented on GitHub (Dec 23, 2016): @Ocramius I've looked at the changes in #6017 and it still causes an issue for us as it enforces the existing behaviour with another error. Essentially the behaviour change in 2.5.5 is still present. I understand we are passing in the wrong thing essentially but its not an insignificant task for us to go through and make all the changes as a result of a bug fix release. For now I've updated our dependencies to use 2.5.4. We will of course make the correct changes going forward. Its not a big deal in this case as we caught it in time but I think it important to highlight with a bit of feedback. A minor behaviour change to enforce correct behaviour can have much larger knock on effects when included as a bug fix release rather than a minor or major release with BC implications highlighted. The work is appreciated of course - cheers and Merry Christmas!
Author
Owner

@Ocramius commented on GitHub (Dec 23, 2016):

There is no behaviour change: it is documented as accepting an optional
string parameter, and an object was given. This is not something that needs
any action on doctrine's side.

On 23 Dec 2016 16:15, "Alasdair Stalker" notifications@github.com wrote:

@Ocramius https://github.com/Ocramius I've looked at the changes in
#6017 https://github.com/doctrine/doctrine2/pull/6017 and it still
causes an issue for us as it enforces the existing behaviour with another
error. Essentially the behaviour change in 2.5.5 is still present.

I understand we are passing in the wrong thing essentially but its not an
insignificant task for us to go through and make all the changes as a
result of a bug fix release. For now I've updated our dependencies to use
2.5.4. We will of course make the correct changes going forward.

Its not a big deal in this case as we caught it in time but I think it
important to highlight with a bit of feedback. A minor behaviour change to
enforce correct behaviour can have much larger knock on effects when
included as a bug fix release rather than a minor or major release with BC
implications highlighted.

The work is appreciated of course - cheers and Merry Christmas!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/6193#issuecomment-269001564,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakMyPL6y0F23h-Re5eW742a9RawWzks5rK-GKgaJpZM4LUwnG
.

@Ocramius commented on GitHub (Dec 23, 2016): There is no behaviour change: it is documented as accepting an optional string parameter, and an object was given. This is not something that needs any action on doctrine's side. On 23 Dec 2016 16:15, "Alasdair Stalker" <notifications@github.com> wrote: > @Ocramius <https://github.com/Ocramius> I've looked at the changes in > #6017 <https://github.com/doctrine/doctrine2/pull/6017> and it still > causes an issue for us as it enforces the existing behaviour with another > error. Essentially the behaviour change in 2.5.5 is still present. > > I understand we are passing in the wrong thing essentially but its not an > insignificant task for us to go through and make all the changes as a > result of a bug fix release. For now I've updated our dependencies to use > 2.5.4. We will of course make the correct changes going forward. > > Its not a big deal in this case as we caught it in time but I think it > important to highlight with a bit of feedback. A minor behaviour change to > enforce correct behaviour can have much larger knock on effects when > included as a bug fix release rather than a minor or major release with BC > implications highlighted. > > The work is appreciated of course - cheers and Merry Christmas! > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/6193#issuecomment-269001564>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAJakMyPL6y0F23h-Re5eW742a9RawWzks5rK-GKgaJpZM4LUwnG> > . >
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5362