DamienHarper / auditor

auditor, the missing audit log library
MIT License
164 stars 53 forks source link

DoctrineSubscriber throw deprecation when Driver is wrapped with another class #184

Closed oleg-andreyev closed 6 months ago

oleg-andreyev commented 1 year ago
Q A
auditor version 2.4.7
PHP version 8.1
Database MySQL

Summary

I have both Auditor and Sentry packages. Sentry also has a middleware that wraps connection with a special class. Depending on priority of this middlewares DoctrineSubscriber may trigger a deprecation because $driver is not a DHDriver, but actually it's wrapped.

Current behavior

trigger deprecation when it's actually should not

How to reproduce

Install both damienharper/auditor-bundle and sentry/sentry-symfony

Expected behavior

correct detection of DHDriver

oleg-andreyev commented 1 year ago

related also to https://github.com/DamienHarper/auditor/issues/185

DamienHarper commented 11 months ago

@oleg-andreyev is this issue still relevant?

oleg-andreyev commented 11 months ago

@DamienHarper Relevant for 2.x

DamienHarper commented 11 months ago

@oleg-andreyev could you please share a way (code sample) so I can reproduce the issue?

oleg-andreyev commented 11 months ago

image

image

you'll need

# composer.json

"sentry/sentry-symfony": "^4.6",
"damienharper/auditor-bundle": "^5.0",
# sentry.yaml
sentry:
    dsn: '%env(SENTRY_DSN)%'
    options:
        traces_sample_rate: 0.25
        # Set a sampling rate for profiling - this is relative to traces_sample_rate
        profiles_sample_rate: 1.0
        before_send: 'sentry.callback.before_send'
    register_error_listener: false # Disables the ErrorListener to avoid duplicated log in sentry

monolog:
    handlers:
        sentry:
            type: sentry
            level: !php/const Monolog\Logger::ERROR
            hub_id: Sentry\State\HubInterface

basically any wrapper will break it because current assumption that DHDriver is the last one.

DamienHarper commented 11 months ago

@oleg-andreyev thanks

craigh commented 9 months ago

@DamienHarper any progress here? We are experiencing this problem in our project also (Sym6.4+sentry/sentry-symfony@4.13.2)

@oleg-andreyev were you able to resolve somehow?

oleg-andreyev commented 9 months ago

@craigh planning to work on solution

oleg-andreyev commented 9 months ago

@craigh @DamienHarper added my PR https://github.com/DamienHarper/auditor/pull/195

DamienHarper commented 8 months ago

Thanks @oleg-andreyev for the PR, much appreciated. It's currently merged into 2.x. I'll release it soon.

oleg-andreyev commented 6 months ago

Closed as merged