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

PHP Fatal error: Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: Invalid platform version "5.5.5-10.1.25-MariaDB #2819

Closed
stfast opened this issue Aug 21, 2017 · 15 comments

Comments

@stfast
Copy link

stfast commented Aug 21, 2017

Reporting also here:

nextcloud/server#6193

After upgrade from NextCloud 11 to NextCloud 12 I got this messages and NextCloud Stops working:

error_log-owncloud:[Mon Aug 21 01:15:59.802107 2017] [:error] [pid 47351] [client 172.16.101.54:63176] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: Invalid platform version "5.5.5-10.1.25-MariaDB" specified. The platform version has to be specified in the format: "<major_version>.<minor_version>.<patch_version>". in .../nextcloud-12.0.2/lib/private/DB/Connection.php:61\nStack trace:\n#0 :q
(429): OC\DB\Connection->connect()\n#1 .../nextcloud-12.0.2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()\n#2 .../nextcloud-12.0.2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()\n#3 .../nextcloud-12.0.2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()\n#4 .../n in .../nextcloud-12.0.2/lib/private/DB/Connection.php on line 61
nextcloud/server#6193

Server configuration

Operating system:
Fedora 26

Web server:

Apache httpd 2.4.20

Database:

10.1.25-MariaDB MariaDB Server

PHP version:

PHP 7.0.7

Nextcloud version: (see Nextcloud admin page)

12.+

**Updated from an older Nextcloud/ownCloud or fresh install:

Update from OwnCloud 9.1.0 to NextCloud 10, NextCloud 11 and still working

@MorrisJobke
Copy link
Contributor

@doctrine maintainers:

Nextcloud 11: Doctrine 2.5.5 (https://github.com/nextcloud/3rdparty/blob/stable11/composer.json#L11)
Nextcloud 12+: Doctrine 2.5.9 (https://github.com/nextcloud/3rdparty/blob/stable12/composer.json#L11)

Is this a problem how the version number is reported by mariaDB here?

Update from OwnCloud 9.1.0 to NextCloud 10, NextCloud 11 and still working

This one looks weird, because we didn't changed that much in version numbers in Doctrine.

@stfast Did you recently updated the mariaDB server?

@morozov
Copy link
Member

morozov commented Aug 21, 2017

Could you try reproducing the issue in isolation? The example below works fine for me on v2.5.9:

<?php

$driver = new \Doctrine\DBAL\Driver\Mysqli\Driver();
$platform = $driver->createDatabasePlatformForVersion('5.5.5-10.1.25-MariaDB');
var_dump($platform);

/*
class Doctrine\DBAL\Platforms\MySqlPlatform#2 (4) {
  protected $doctrineTypeMapping =>
  NULL
  protected $doctrineTypeComments =>
  NULL
  protected $_eventManager =>
  NULL
  protected $_keywords =>
  NULL
}
*/

@mikeSimonson
Copy link
Contributor

If you could make a test so that we could reproduce the bug that would be helpfull.

@stfast
Copy link
Author

stfast commented Aug 28, 2017

Will do that ASAP with our developer. I can reproduce it with fresh install of OwnCloud 9.x on any Fedora 2+ and I get same error during installation. Last year I think I had the same issue and I am sure I overcame this error with adding a version "5.5.5-10.1.23-MariaDB" in one of "versions" file, which I could not find it any more. Is there a file where DBAL is checking supported "versisons".

@stfast
Copy link
Author

stfast commented Aug 28, 2017

I get same results:

[root@vx1 dbal]# php test.php
object(Doctrine\DBAL\Platforms\MySqlPlatform)#3 (4) {
["doctrineTypeMapping":protected]=>
NULL
["doctrineTypeComments":protected]=>
NULL
["_eventManager":protected]=>
NULL
["_keywords":protected]=>
NULL
}

@mikeSimonson
Copy link
Contributor

@stfast That's the correct result (aka the connection is working fine and you could thus not reproduce the error).

@belgattitude
Copy link
Contributor

See #2825 , I've implemented a fix for that too.

belgattitude added a commit to belgattitude/dbal that referenced this issue Aug 29, 2017
@stfast
Copy link
Author

stfast commented Aug 29, 2017

I've cloned latest dbal version and now I am getting new type of error:

[Tue Aug 29 15:38:54.393757 2017] [:error] [pid 30288] [client 172.16.103.21:42650] PHP Fatal error: Uncaught TypeError: Return value of Doctrine\DBAL\DriverManager::_checkParams() must be an instance of Doctrine\DBAL\void, none returned in /owncloud/nextcloud-12.0.2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php:213\nStack trace:\n#0 /owncloud/nextcloud-12.0.2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(153): Doctrine\DBAL\DriverManager::_checkParams(Array)\n#1 /owncloud/nextcloud-12.0.2/lib/private/DB/ConnectionFactory.php(149): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))\n#2 /owncloud/nextcloud-12.0.2/lib/private/Server.php(579): OC\DB\ConnectionFactory->getConnection('mysql', Array)\n#3 /owncloud/nextcloud-12.0.2/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))\n#4 /owncloud/nextcloud-12.0.2/lib/private/AppFramework in /owncloud/nextcloud-12.0.2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 213

@Ocramius
Copy link
Member

@stfast if you run a composer install it will tell you that your PHP version is not supported.

You need PHP 7.1.

@stfast
Copy link
Author

stfast commented Aug 29, 2017 via email

@belgattitude
Copy link
Contributor

@stfast, #2825, has not been merged yet. pull the pr or use the composer trick explained in the comment. Let me know.

@stfast
Copy link
Author

stfast commented Aug 30, 2017 via email

@belgattitude
Copy link
Contributor

@stfast, yes github rate limiting is reached. If you are in a hurry, you can follow the link displayed in the composer error message. Basically it just allows your machine to make more requests. Then relaunch composer update.

Of course the best is to wait for pr merge. I don't know when, but feel free to ask the question in #2825.

belgattitude added a commit to belgattitude/dbal that referenced this issue Sep 12, 2017
@lcobucci lcobucci self-assigned this Nov 19, 2017
@lcobucci lcobucci added this to the 2.7.0 milestone Nov 19, 2017
@stfast
Copy link
Author

stfast commented Mar 1, 2018

Since I opened this bug, I found there is no issue at all if you disable pcre.jit in php.ini:

cat php.ini
...
pcre.jit=0
...

And this error dissapears:

[Thu Mar 01 18:48:16.056472 2018] [php7:error] [pid 9432] [client 10.192.96.14:42479] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: Invalid platform version "5.5.5-10.2.12-MariaDB" specified. The platform version has to be specified in the format: "<major_version>.<minor_version>.<patch_version>". in /WWW/Production/owncloud/nextcloud-12.0.5/lib/private/DB/Connection.php:64\nStack trace:\n#0 /WWW/Production/owncloud/nextcloud-12.0.5/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()\n#1 /WWW/Production/owncloud/nextcloud-12.0.5/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()\n#2 /WWW/Production/owncloud/nextcloud-12.0.5/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()\n#3 /WWW/Production/owncloud/nextcloud-12.0.5/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()\n#4 /WWW/Production/owncloud/n in /WWW/Production/owncloud/nextcloud-12.0.5/lib/private/DB/Connection.php on line 64

@github-actions
Copy link

github-actions bot commented Aug 2, 2022

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 Aug 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants