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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't add doctrine/dbal as direct dependency #1846

Closed
kesselb opened this issue Jul 22, 2021 · 6 comments 路 Fixed by #1848
Closed

Don't add doctrine/dbal as direct dependency #1846

kesselb opened this issue Jul 22, 2021 · 6 comments 路 Fixed by #1848
Labels
Milestone

Comments

@kesselb
Copy link

kesselb commented Jul 22, 2021

Hi 馃憢

Thanks for your nice app 馃憤 I run into the following error today.

What is going wrong? What did you observe?

Polls 3.0.0 has doctrine/dbal 3.1 as direct dependency. As doctrine/dbal 3.0 is included in Nextcloud this might lead to conflicts. Please don't require doctrine/dbal in composer.json.

A possible workaround could be: nextcloud/news#636. It depends a bit on your use case. replace in composer.json is a bit hacky.

Example: A stack trace caused by another app showing the doctrine from polls/vendor is used.

{
  "Exception": "PDOException",
  "Message": "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'userid' cannot be null",
  "Code": "23000",
  "Trace": [
    {
      "file": "/var/www/nextcloud/apps/polls/vendor/doctrine/dbal/src/Driver/PDO/Statement.php",
      "line": 92,
      "function": "execute",
      "class": "PDOStatement",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
      "line": 1136,
      "function": "execute",
      "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
      "line": 257,
      "function": "executeStatement",
      "class": "Doctrine\\DBAL\\Connection",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
      "line": 213,
      "function": "executeStatement",
      "class": "OC\\DB\\Connection",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
      "line": 287,
      "function": "execute",
      "class": "Doctrine\\DBAL\\Query\\QueryBuilder",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
      "line": 340,
      "function": "execute",
      "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php",
      "line": 115,
      "function": "setValues",
      "class": "OC\\DB\\Connection",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/AllConfig.php",
      "line": 292,
      "function": "setValues",
      "class": "OC\\DB\\ConnectionAdapter",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/apps/ojsxc/lib/DbLock.php",
      "line": 49,
      "function": "setUserValue",
      "class": "OC\\AllConfig",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/apps/ojsxc/lib/Controller/HttpBindController.php",
      "line": 154,
      "function": "setLock",
      "class": "OCA\\OJSXC\\DbLock",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
      "line": 218,
      "function": "index",
      "class": "OCA\\OJSXC\\Controller\\HttpBindController",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
      "line": 127,
      "function": "executeController",
      "class": "OC\\AppFramework\\Http\\Dispatcher",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
      "line": 157,
      "function": "dispatch",
      "class": "OC\\AppFramework\\Http\\Dispatcher",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/Route/Router.php",
      "line": 302,
      "function": "main",
      "class": "OC\\AppFramework\\App",
      "type": "::"
    },
    {
      "file": "/var/www/nextcloud/lib/base.php",
      "line": 993,
      "function": "match",
      "class": "OC\\Route\\Router",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/index.php",
      "line": 37,
      "function": "handleRequest",
      "class": "OC",
      "type": "::"
    }
  ],
  "File": "/var/www/nextcloud/apps/polls/vendor/doctrine/dbal/src/Driver/PDO/Statement.php",
  "Line": 92
}

Information about your polls installation

Polls version: 3.0.0

Information about your Instance of Nextcloud

Nextcloud version: 21.0.3

@dartcafe
Copy link
Collaborator

dartcafe commented Jul 22, 2021

Doctrine is no runtime dependeny. It is just added because of the fact, that the exception implementation in NC21 is not complete and we have to directly catch the DBAL Exceptions. Without this dependency the tests fail.

Since DBAL is not shipped with the package, there is no conflict. DBAL will be dropped, once NC21 support is dropped.

@dartcafe
Copy link
Collaborator

Since DBAL is a dev dependency, composer should be called with the --no-dev option, if you are installing via git. In this case only runtime deps are installed.

@kesselb
Copy link
Author

kesselb commented Jul 22, 2021

polls/composer.json

Lines 42 to 45 in 0af2118

"require": {
"league/commonmark": "^1.6",
"doctrine/dbal": "^3.1"
}

I also see a vendor/doctrine/dbal in https://github.com/nextcloud/polls/releases/download/v3.0.0/polls.tar.gz

dartcafe added a commit that referenced this issue Jul 23, 2021
Signed-off-by: dartcafe <github@dartcafe.de>
@dartcafe
Copy link
Collaborator

The moment when you open the composer.json and see, that you talked absolute nonsense. 馃槈

@dartcafe dartcafe added the bug label Jul 23, 2021
@dartcafe dartcafe added this to the 3.1 milestone Jul 23, 2021
@kesselb
Copy link
Author

kesselb commented Jul 23, 2021

Thanks for taking care 馃憤

Copy link

github-actions bot commented Jun 2, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants