Skip to content

spl_object_id() expects parameter 1 to be object, string given in PHP 7.4 and version AuditBundle 1.12 #623

@DenyPt96

Description

@DenyPt96

Environment

Sonata packages

show

Direct dependencies required in composer.json:
sonata-project/entity-audit-bundle 1.12.0 1.12.0 Audit for Doctrine Entities

Symfony packages

show

$ composer show --latest 'symfony/*'
# Put the result here.

PHP version

php -v
PHP 7.4.33 (cli) (built: Apr 11 2024 22:13:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
    with Xdebug v3.1.6, Copyright (c) 2002-2022, by Derick Rethans

Subject

Auditing entity which uses foreign key as primary key throws exception when entity manager flushes.

Minimal repository with the bug

Steps to reproduce

When entity manager flushes and exception is thrown: spl_object_id() expects parameter 1 to be object, string given
Screenshot from 2024-05-03 11-20-59

Table product:
Screenshot from 2024-05-03 11-45-08
Screenshot from 2024-05-03 11-45-20

Table product_company
Screenshot from 2024-05-03 11-42-35

Expected results

Actual results

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions