Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error with doctrine/dbal 4.x #806

Closed
ddebin opened this issue Feb 5, 2024 · 18 comments · Fixed by #811
Closed

Fatal error with doctrine/dbal 4.x #806

ddebin opened this issue Feb 5, 2024 · 18 comments · Fixed by #811
Assignees

Comments

@ddebin
Copy link

ddebin commented Feb 5, 2024

How do you use Sentry?

Sentry SaaS (sentry.io)

SDK version

3.6.0

Steps to reproduce

Install "sentry/sentry-symfony": "^4.0" along "doctrine/dbal": "^4.0"

Expected result

composer install works with no error

Actual result

composer install (more specifically composer hook script cache:clear) crash with

!!  
!!  Fatal error: Declaration of Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingStatementForV3::bindValue($param, $value, $type = Doctrine\DBAL\ParameterType::STRING): bool must be compatible with Doctrine\DBAL\Driver\Statement::bindValue(string|int $param, mixed $value, Doctrine\DBAL\ParameterType $type): void in /Users/ddebin/Dropbox (Personal)/Dev/VM/com.refurb-tracker.symfony4/vendor/sentry/sentry-symfony/src/Tracing/Doctrine/DBAL/TracingStatementForV3.php on line 20
!!  PHP Fatal error:  Declaration of Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingStatementForV3::bindValue($param, $value, $type = Doctrine\DBAL\ParameterType::STRING): bool must be compatible with Doctrine\DBAL\Driver\Statement::bindValue(string|int $param, mixed $value, Doctrine\DBAL\ParameterType $type): void in /Users/ddebin/Dropbox (Personal)/Dev/VM/com.refurb-tracker.symfony4/vendor/sentry/sentry-symfony/src/Tracing/Doctrine/DBAL/TracingStatementForV3.php on line 20
@ddebin
Copy link
Author

ddebin commented Feb 5, 2024

@Jean85
Copy link
Collaborator

Jean85 commented Feb 5, 2024

Are you using DBAL 3 or 4?

@ddebin ddebin changed the title Fatal error with doctrine/orm 3.x Fatal error with doctrine/orm 3.x (& doctrine/dbal 4.x) Feb 5, 2024
@ddebin
Copy link
Author

ddebin commented Feb 5, 2024

Are you using DBAL 3 or 4?

DBAL 4.x, it's more of a problem with doctrine/dbal 4

@ddebin ddebin changed the title Fatal error with doctrine/orm 3.x (& doctrine/dbal 4.x) Fatal error with doctrine/dbal 4.x Feb 5, 2024
@Jean85
Copy link
Collaborator

Jean85 commented Feb 5, 2024

Return type switched from bool to void, I don't think we can make the interface cross compatible...

bindValue($param, $value, $type = Doctrine\DBAL\ParameterType::STRING): bool
bindValue(string|int $param, mixed $value, Doctrine\DBAL\ParameterType $type): void

We need to create another one, and this is probably not even the only BC that we need to handle.

@ddebin
Copy link
Author

ddebin commented Feb 5, 2024

Related to #579

@cleptric
Copy link
Member

cleptric commented Feb 7, 2024

We'll add support for DBAL v4; I can't give you a timeline at this point.

@tacman
Copy link

tacman commented Feb 10, 2024

When creating a new symfony project with --webapp, composer.json adds "doctrine/orm:^3.0" to the requires section. I wish instead it were "^2.1||^3.0", and let composer figure out which version to use based on what the dependencies support.

That would help in this case, as well as for API Platform api-platform/core#6150

@ste93cry
Copy link
Collaborator

ste93cry commented Feb 10, 2024

Unfortunately, since Doctrine is an optional dependency of this package, we don't require it in composer.json besides for development purposes, hence we have no way to prevent the installation of an unsupported version. This is one of the reasons for which I strongly believe that:

  • All tracing features should not be enabled by default (and this is a lost battle...)
  • We should move the tracing integrations into separate packages, so that we can declare for real the dependencies they really supports in the composer.json

@alexislefebvre
Copy link

@ste93cry What about declaring a conflict with the unsupported version, until it is supported?

@Jean85
Copy link
Collaborator

Jean85 commented Feb 12, 2024

@ste93cry What about declaring a conflict with the unsupported version, until it is supported?

That would prevent users to use the whole bundle if they use DBAL 4, which is an issue only if you enable tracing.

@ddebin
Copy link
Author

ddebin commented Feb 12, 2024

Could anyone point out how to disable tracing ? 🙂

@ste93cry
Copy link
Collaborator

You can disable tracing as a whole using:

sentry:
  tracing:
    enabled: false

or you can disable tracing specifically for DBAL using:

sentry:
  tracing:
    dbal:
      enabled: false

@msphn
Copy link

msphn commented Feb 15, 2024

Until resolved I solved that by going with orm 3.* but constraining dbal.

"doctrine/dbal": "3.*",
"doctrine/orm": "^3.0.0",

@ddebin
Copy link
Author

ddebin commented Feb 18, 2024

@ste93cry What about declaring a conflict with the unsupported version, until it is supported?

That would prevent users to use the whole bundle if they use DBAL 4, which is an issue only if you enable tracing.

@Jean85 Can't use the whole bundle with DBAL 4, even with tracing disabled.

@BenMorel
Copy link

Can't use the whole bundle with DBAL 4, even with tracing disabled.

Indeed, even with the whole bundle disabled, the application still fails with:

Fatal error: Declaration of Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingStatementForV3::bindValue($param, $value, $type = Doctrine\DBAL\ParameterType::STRING): bool must be compatible with Doctrine\DBAL\Driver\Statement::bindValue(string|int $param, mixed $value, Doctrine\DBAL\ParameterType $type): void in /app/vendor/sentry/sentry-symfony/src/Tracing/Doctrine/DBAL/TracingStatementForV3.php on line 20

@ste93cry
Copy link
Collaborator

I believe that at this point, a conflict is the only viable solution until support for the newer version is worked on @Jean85

@cleptric
Copy link
Member

It is being worked on.

@cleptric
Copy link
Member

cleptric commented Feb 26, 2024

8h2jr6

Support for doctrine/dbal v4.0 was added in 4.14.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

8 participants