Can't setup Nextcloud on master... PHP 7.3 issue
Since today I can no longer setup a new Nextcloud in master.
I use PHP 7.3 and sqlite as a db back-end.
Whenever I try to complete the setup I get this error message in the web interface:
An exception occurred while executing 'INSERT INTO "oc_users" ("uid", "password", "uid_lower") VALUES(?, ?, ?)' with params ["admin", "2|$argon2i$v=19$m=1024,t=2,p=2$ZkRqWVp0Y2p6enAxY2VxMw$69F\/wSmhNG675DSqAJs\/RpNfGBcr8OGIom66J28ADoI", "admin"]: SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: oc_users.uid
As you can see, all three values are set (uid, password, uid_low), still I get this "not null constraint violation" for oc_users.uid.
In the nextcloud log I see this messages:
{"reqId":"vFawcK0aNWpSVtxxCov6","level":3,"time":"2018-10-16T12:10:51+00:00","remoteAddr":"127.0.0.1","user":"--","app":"PHP","method":"POST","url":"\/server3\/index.php","message":"PDOStatement::bindValue() expects parameter 3 to be int, unknown given at \/home\/schiesbn\/Repos\/nextcloud\/server3\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php#67","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"15.0.0.1"}
Does somone saw something similar already? Any idea?
GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/2209 (can't install fresh nextcloud), https://github.com/nextcloud/server/issues/9274 (I can't change my nextcloud logo !), https://github.com/nextcloud/server/issues/6726 (no nextcloud/data/ directory), https://github.com/nextcloud/server/issues/8776 (Nextcloud cannot login), and https://github.com/nextcloud/server/issues/10798 (No connection with Nextcloud).
Seems like switching back to php 7.2 solved the issue
Still weird as we now run 7.3 CI....
I can still reproduce the problem. Also on a existing installation. As soon as I switch from php 7.2 to php 7.3 I get a internal server error. On a Nextcloud which is already setup and works fine with PH P7.2 I get this errror message in the log file as soon as I switch the server to PHP 7.3:
{"reqId":"tQTzG8DsvEXzaaoiIKFx","level":3,"time":"2018-10-22T09:32:55+00:00","remoteAddr":"127.0.0.1","user":"--","app":"index","method":"GET","url":"\/server\/","message":{"Exception":"TypeError","Message":"Return value of OC\\Security\\Crypto::decrypt() must be of the type string, bool returned","Code":0,"Trace":[{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/Session\/CryptoSessionData.php","line":82,"function":"decrypt","class":"OC\\Security\\Crypto","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/Session\/CryptoSessionData.php","line":63,"function":"initializeSession","class":"OC\\Session\\CryptoSessionData","type":"->","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/Session\/CryptoWrapper.php","line":100,"function":"__construct","class":"OC\\Session\\CryptoSessionData","type":"->","args":[{"__class__":"OC\\Session\\Internal"},{"__class__":"OC\\Security\\Crypto"},"*** sensitive parameter replaced ***"]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/base.php","line":428,"function":"wrapSession","class":"OC\\Session\\CryptoWrapper","type":"->","args":[{"__class__":"OC\\Session\\Internal"}]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/base.php","line":656,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/base.php","line":1068,"function":"init","class":"OC","type":"::","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/index.php","line":40,"args":["\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/base.php"],"function":"require_once"}],"File":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/Security\/Crypto.php","Line":133,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"15.0.0.1"}
{"reqId":"K6pg9sTMMqY8ZiTekMY3","level":3,"time":"2018-10-22T09:32:55+00:00","remoteAddr":"127.0.0.1","user":"--","app":"index","method":"GET","url":"\/server\/index.php\/js\/core\/merged-template-prepend.js?v=be3cd47f-0","message":{"Exception":"TypeError","Message":"Return value of OC\\Security\\Crypto::decrypt() must be of the type string, bool returned","Code":0,"Trace":[{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/Session\/CryptoSessionData.php","line":82,"function":"decrypt","class":"OC\\Security\\Crypto","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/Session\/CryptoSessionData.php","line":63,"function":"initializeSession","class":"OC\\Session\\CryptoSessionData","type":"->","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/Session\/CryptoWrapper.php","line":100,"function":"__construct","class":"OC\\Session\\CryptoSessionData","type":"->","args":[{"__class__":"OC\\Session\\Internal"},{"__class__":"OC\\Security\\Crypto"},"*** sensitive parameter replaced ***"]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/base.php","line":428,"function":"wrapSession","class":"OC\\Session\\CryptoWrapper","type":"->","args":[{"__class__":"OC\\Session\\Internal"}]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/base.php","line":656,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/base.php","line":1068,"function":"init","class":"OC","type":"::","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/index.php","line":40,"args":["\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/base.php"],"function":"require_once"}],"File":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/Security\/Crypto.php","Line":133,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"15.0.0.1"}
I just upgraded PHP to 7.3 on Debian and everything broke for NC. Other applications that require php-fpm work just fine on 7.3.
Not really looking forward to downgrading, but I'm going to have to.
@schiessle Looks like
https://github.com/nextcloud/3rdparty/blob/8633304ce214a7c0ff8e4fd72052a5ed7a444b6d/phpseclib/phpseclib/phpseclib/Crypt/Base.php#L1012-L1024 is wrong about the return type. When openssl (which should be the case since mcrypt is n/a for php7.3) openssl_decrypt() is used and returns false on failure (http://php.net/manual/en/function.openssl-decrypt.php).
Could you check openssl_error_string() for possible errors?
I just tested this on a clean 7.3 docker. And I can setup an instance just fine.
@schiessle could you set a breakpoint at the decrypt function and step trough it to see where this does :boom:
Because probably @danielkesselberg is correct. However I do not exactly see what it has to do with 7.3
Just wanted to collect the additional information but now it works here... Maybe this was fixed by one of the latest changes to the server or 3rdparty updates.
@grawlinson can you verify that it also works for you with the latest master?
I think my issues may be related to my setup (haven't found root cause yet), so I recommend closing this issue if it works for you.
The latest master seems to have broken my install. First it was this, now it's this:
$ sudo -u www-data php occ maintenance:repair
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Failed to load repair step for dav: Repair step 'OCA\DAV\Migration\FixBirthdayCalendarComponent' is unknown
Failed to load repair step for dav: Repair step 'OCA\DAV\Migration\CalDAVRemoveEmptyValue' is unknown
Failed to load repair step for dav: Repair step 'OCA\DAV\Migration\BuildCalendarSearchIndex' is unknown
Failed to load repair step for files_sharing: Repair step 'OCA\Files_Sharing\Migration\OwncloudGuestShareType' is unknown
Failed to load repair step for files_sharing: Repair step 'OCA\Files_Sharing\Migration\SetPasswordColumn' is unknown
Failed to load repair step for oauth2: Repair step 'OCA\OAuth2\Migration\SetTokenExpiration' is unknown
Failed to load repair step for twofactor_backupcodes: Repair step 'OCA\TwoFactorBackupCodes\Migration\CheckBackupCodes' is unknown
Strange, now the problem happens again here as well... let's debug this further. I just tried to setup a fresh nextcloud and run into the SQL error from the initial post again
I think there are two different issues, one is the db issue during initial setup and one is crypt issue when I move a existing system from php7.2 to php7.3
I started to look into the first one (the db issue): I use sqlite for testing, maybe this makes a difference as well.
The problems seams that we default to "null" as parameter type when no type is given: https://github.com/nextcloud/server/blob/master/lib/public/DB/QueryBuilder/IExpressionBuilder.php#L126
So at the end we are calling this method with null for $type which of course fails. https://github.com/nextcloud/3rdparty/blob/2146ef45734f855676965b65990d509192666264/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#L64
So now I know the problem, but I'm not sure what's the proper way to fix it.
Maybe @nickvergessen has a idea?
I installed:
$ php --version
PHP 7.3.0RC4 (cli) (built: Oct 25 2018 10:32:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.0RC4, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.0beta1, Copyright (c) 2002-2018, by Derick Rethans
And could install just fine via CLI:
Nextcloud was successfully installed
hm, this is getting more and more confusing. CLI install works here as well but I get reproducible the db error if I perform the installation in the browser, @nickvergessen could you try this as well?
But even with the succesfull CLI setup I can't login afterwards. Firefox shows the generic error page "The connection was reset", no error message in the Nextcloud log but I see segfaults in the apache log:
[Tue Nov 13 23:20:26.495968 2018] [core:notice] [pid 6290] AH00052: child pid 6370 exit signal Segmentation fault (11)
My findings: https://gist.github.com/nickvergessen/b070db9acee75dfbf25f160c8a4710b0
just as a quick update, meanwhile PHP 7.3 was released and updated in Debian. I run now "PHP 7.3.0-1" and still experience the same problem.
Was this ever figured out as a fix yet?
I was using php7.0 and all was working but some apps could not be installed saying needed at least 7.1.
I decided to go right to 7.3, because it says php 7.3 is supported by nextcloud on the requirements page.
Now at times I can login but loads a no data sent to chrome page, and randomly at times I see the actual blue page saying internal error nextcloud look at the server logs page...
Error: "crypt issue when I moved an existing system from php7.0 to php7.3"
{"reqId":"K36f0U7oAbHatIrmnELU","level":3,"time":"December 11, 2018 20:01:24","remoteAddr":"192.168.0.1","user":"--","app":"cron","method":"GET","url":"/cron.php","message":{"Exception":"TypeError","Message":"Return value of OC\Security\Crypto::decrypt() must be of the type string, bool returned","Code":0,"Trace":[{"file":"/home/user/public_html/example.com/html/lib/private/Session/CryptoSessionData.php","line":82,"function":"decrypt","class":"OC\Security\Crypto","type":"->","args":["*** sensitive parameters replaced "]},{"file":"/home/user/public_html/example.com/html/lib/private/Session/CryptoSessionData.php","line":63,"function":"initializeSession","class":"OC\Session\CryptoSessionData","type":"->","args":[]},{"file":"/home/user/public_html/example.com/html/lib/private/Session/CryptoWrapper.php","line":100,"function":"__construct","class":"OC\Session\CryptoSessionData","type":"->","args":[{"class":"OC\Session\Internal"},{"class":"OC\Security\Crypto"}," sensitive parameter replaced ***"]},{"file":"/home/user/public_html/example.com/html/lib/base.php","line":428,"function":"wrapSession","class":"OC\Session\CryptoWrapper","type":"->","args":[{"class":"OC\Session\Internal"}]},{"file":"/home/user/public_html/example.com/html/lib/base.php","line":656,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/home/user/public_html/example.com/html/lib/base.php","line":1068,"function":"init","class":"OC","type":"::","args":[]},{"file":"/home/user/public_html/example.com/html/cron.php","line":41,"args":["/home/user/public_html/example.com/html/lib/base.php"],"function":"require_once"}],"File":"/home/user/public_html/example.com/html/lib/private/Security/Crypto.php","Line":133,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36","version":"14.0.4.2"}
@cdmlb your issue is fixed in 15
Disabling Xdebug seems to solve the issue and I can setup Nextcloud 15. But today I found out that SAML is also broken on PHP7.3 (also if xdebug is disabled) but this seems to be a incompatibility of the 3rdparty lib:
{"reqId":"hTpfoMtR99ac2KHdxUMs","level":3,"time":"2018-12-18T14:49:50+00:00","remoteAddr":"127.0.0.1","user":"--","app":"PHP","method":"POST","url":"\/server\/index.php\/apps\/user_saml\/saml\/acs","message":"preg_replace(): Compilation failed: invalid range in character class at offset 8 at \/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/user_saml\/3rdparty\/vendor\/robrichards\/xmlseclibs\/src\/Utils\/XPath.php#42","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/71.0.3578.80 Safari\/537.36","version":"14.0.3.0"}
{"reqId":"hTpfoMtR99ac2KHdxUMs","level":3,"time":"2018-12-18T14:49:50+00:00","remoteAddr":"127.0.0.1","user":"--","app":"index","method":"POST","url":"\/server\/index.php\/apps\/user_saml\/saml\/acs","message":{"Exception":"Error","Message":"Call to a member function item() on bool","Code":0,"Trace":[{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/user_saml\/3rdparty\/vendor\/robrichards\/xmlseclibs\/src\/XMLSecurityDSig.php","line":591,"function":"processRefNode","class":"RobRichards\\XMLSecLibs\\XMLSecurityDSig","type":"->","args":[{"__class__":"DOMElement"}]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/user_saml\/3rdparty\/vendor\/onelogin\/php-saml\/src\/Saml2\/Utils.php","line":1412,"function":"validateReference","class":"RobRichards\\XMLSecLibs\\XMLSecurityDSig","type":"->","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/user_saml\/3rdparty\/vendor\/onelogin\/php-saml\/src\/Saml2\/Response.php","line":419,"function":"validateSign","class":"OneLogin\\Saml2\\Utils","type":"::","args":[{"__class__":"DOMDocument"},"-----BEGIN ***certificate rmoved***----END CERTIFICATE-----\n","","sha1","\/samlp:Response\/saml:Assertion\/ds:Signature",null]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/user_saml\/3rdparty\/vendor\/onelogin\/php-saml\/src\/Saml2\/Auth.php","line":226,"function":"isValid","class":"OneLogin\\Saml2\\Response","type":"->","args":["ONELOGIN_032b3d3d34e72e0b50899a412461a900c7358f80"]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/user_saml\/lib\/Controller\/SAMLController.php","line":253,"function":"processResponse","class":"OneLogin\\Saml2\\Auth","type":"->","args":["ONELOGIN_032b3d3d34e72e0b50899a412461a900c7358f80"]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"assertionConsumerService","class":"OCA\\User_SAML\\Controller\\SAMLController","type":"->","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\User_SAML\\Controller\\SAMLController"},"assertionConsumerService"]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\User_SAML\\Controller\\SAMLController"},"assertionConsumerService"]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\User_SAML\\Controller\\SAMLController","assertionConsumerService",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"user_saml.SAML.assertionConsumerService"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"user_saml.SAML.assertionConsumerService"}]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"user_saml.SAML.assertionConsumerService"}]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/lib\/base.php","line":987,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/apps\/user_saml\/saml\/acs"]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/user_saml\/3rdparty\/vendor\/robrichards\/xmlseclibs\/src\/XMLSecurityDSig.php","Line":501,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/71.0.3578.80 Safari\/537.36","version":"14.0.3.0"}