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

Can't setup Nextcloud on master... PHP 7.3 issue #11868

Closed
schiessle opened this issue Oct 16, 2018 · 26 comments
Closed

Can't setup Nextcloud on master... PHP 7.3 issue #11868

schiessle opened this issue Oct 16, 2018 · 26 comments
Labels

Comments

@schiessle
Copy link
Member

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?

@schiessle schiessle added the bug label Oct 16, 2018
@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #2209 (can't install fresh nextcloud), #9274 (I can't change my nextcloud logo !), #6726 (no nextcloud/data/ directory), #8776 (Nextcloud cannot login), and #10798 (No connection with Nextcloud).

@schiessle
Copy link
Member Author

Seems like switching back to php 7.2 solved the issue

@rullzer
Copy link
Member

rullzer commented Oct 18, 2018

Still weird as we now run 7.3 CI....

@schiessle
Copy link
Member Author

schiessle commented Oct 22, 2018

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"}

@schiessle schiessle changed the title Can't setup Nextcloud on master Can't setup Nextcloud on master... PHP 7.3 issue Oct 22, 2018
@grawlinson
Copy link

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.

@kesselb
Copy link
Contributor

kesselb commented Oct 26, 2018

@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?

@rullzer
Copy link
Member

rullzer commented Oct 28, 2018

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 💥

Because probably @danielkesselberg is correct. However I do not exactly see what it has to do with 7.3

@schiessle
Copy link
Member Author

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.

@schiessle
Copy link
Member Author

@grawlinson can you verify that it also works for you with the latest master?

@schiessle schiessle reopened this Nov 1, 2018
@grawlinson
Copy link

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.

@grawlinson
Copy link

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

@schiessle
Copy link
Member Author

schiessle commented Nov 12, 2018

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

@schiessle
Copy link
Member Author

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?

@nickvergessen
Copy link
Member

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

@schiessle
Copy link
Member Author

schiessle commented Nov 13, 2018

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)

rullzer added a commit that referenced this issue Nov 14, 2018
For #11868

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@nickvergessen
Copy link
Member

backportbot-nextcloud bot pushed a commit that referenced this issue Nov 19, 2018
For #11868

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@schiessle
Copy link
Member Author

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.

@cdmlb
Copy link

cdmlb commented Dec 11, 2018

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"}

@nickvergessen
Copy link
Member

@cdmlb your issue is fixed in 15

@schiessle
Copy link
Member Author

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"}

@Schmuuu
Copy link

Schmuuu commented Dec 18, 2018

Just to avoid some misunderstanding on my side: this means users should better stay on PHP 7.2 for now and should not upgrade to PHP 7.3?
Some recommendation would be relaxing :)

@cdmlb
Copy link

cdmlb commented Dec 18, 2018

@Schmuuu php v7.3 is working properly with nextcloud v15, it's just some apps can't be installed until they are updated to support passed 7.1 or 7.2, and the warnings are for now just warnings because they changed stuff in php v7.3 when it comes to continue and break in a switch out of a loop. It works for now until it's not a warning anymore but an actual error causing an exception. I'm sure all will be updated to v7.3 before that happens, we hope.

@cdmlb
Copy link

cdmlb commented Dec 18, 2018

@schiessle if it's not one thing it's another, after moving back to linux, I just find to many things become dependent so deeply and some things get updated to new versions, but depend on things that are not updated, causing you to have all php v7.3 but still parts of v7.2 installed just to run other things lol oh wells that is the opensource world, people quit projects, others pick them up, or branch off lol.

@cdmlb
Copy link

cdmlb commented Dec 18, 2018

@nickvergessen my issue got fixed once I formatted my drive and reinstalled everything from the start using phpv7.3 with nextcloud 15 that had only came out 3 days after I broke my linux/nextcloud install of nextcloud 14 lol.

sudo apt remove php* just to see how well linux can handle things today is not a good idea considering it tells you after you don't need these dependencies anymore do you want to autoremove yes, and btw you still need them for lots of other things that the system did not account for lolol you learn that the hard way and sometimes instead of wasting hours and days trying to fix a broken system, you just format and start over and done in a few hours, you learn more from mistakes lmfao. You also learn to make drive image backups too lolol.

@grawlinson
Copy link

grawlinson commented Dec 18, 2018 via email

@rullzer
Copy link
Member

rullzer commented Mar 5, 2019

Nextcloud works fine now with 7.3

@rullzer rullzer closed this as completed Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants