owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.38k stars 2.05k forks source link

Can't update to 9.1.1 | Fatal error: Can't use method return value in write context in /home/user/public_html/OwnCloud/updater/src/Console/Application.php on line 193 #26501

Closed MatthewC closed 7 years ago

MatthewC commented 8 years ago

Steps to reproduce

  1. Go into Admin Panel
  2. Click on Update

    Expected behaviour

OwnCloud should update to 9.1.1

Actual behaviour

I am getting the error " Fatal error: Can't use method return value in write context in /home/user/public_html/OwnCloud/updater/src/Console/Application.php on line 193"

Server configuration

Operating system: CentOS

Web server: Shared Server

Database: MySQL

PHP version: 5.4.45

ownCloud version: 9.1.0

Updated from an older ownCloud or fresh install: Updated from older version of OwnCloud

Where did you install ownCloud from: The Zip file for shared hosting

Signing status (ownCloud 9.0 and above):??

No errors have been found.

List of activated apps: Activity, Collaborative tags, Comments, Deleted files, Federation, First run wizard, Gallery, Mail Template Editor, Notifications, PDF Viewer, Provisioning API, Share iles, Update notification, Versions, Video player

The content of config/config.php:

<?php
$CONFIG = array (
  'instanceid' => 'oc2dfhupodnv',
  'passwordsalt' => '----',
  'secret' => '-----',
  'trusted_domains' => 
  array (
    0 => 'example.com',
  ),
  'datadirectory' => '/home/user/public_html/owncloud/data',
  'overwrite.cli.url' => 'https://example.com/owncloud',
  'dbtype' => 'mysql',
  'version' => '9.1.0.15',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'username',
  'dbpassword' => 'password',
  'logtimezone' => 'UTC',
  'installed' => true,
  'updater.secret' => '----',
);

Are you using external storage, if yes which one: No

Are you using encryption: Yes, if we're talking about a SSL Certificate, but no, if we're talking about actual files/data

Are you using an external user-backend, if yes which one: Yes, the OwnCloud Application

Client configuration

Browser: Chrome

Operating system: Windows 10

Logs

Web server error log

Error   PHP Invalid argument supplied for foreach() at /home/user/public_html/scloud/core/templates/login.php#23    2016-09-24T11:41:33+00:00
Error   PHP Undefined offset: 1 at /home/user/public_html/scloud/core/Controller/LoginController.php#117    2016-09-24T11:41:33+00:00

ownCloud log (data/owncloud.log)

{"reqId":"V8BWYWynhSUAAfuSML8AAAAO","remoteAddr":"2.139.51.166","app":"mysql.setup","message":"Specific user creation failed: An exception occurred while executing 'SELECT user FROM mysql.user WHERE user=?' with params [\"oc_Matthew\"]:\n\nSQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'ocadmin'@'localhost' for table 'user'","level":3,"time":"2016-08-26T14:46:57+00:00","method":"POST","url":"\/scloud\/index.php","user":"--"}
{"reqId":"V8BWYWynhSUAAfuSML8AAAAO","remoteAddr":"2.139.51.166","app":"mysql.setup","message":"Database creation failed: An exception occurred while executing 'GRANT ALL PRIVILEGES ON `owncloud` . * TO 'ocadmin'':\n\nSQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'ocadmin'@'localhost' to database 'owncloud'","level":3,"time":"2016-08-26T14:46:57+00:00","method":"POST","url":"\/scloud\/index.php","user":"--"}
{"reqId":"V8BaPWynhSUAAPBKc9oAAAD9","remoteAddr":"2.139.51.166","app":"files","message":"Upload error: 3 - The uploaded file was only partially uploaded","level":3,"time":"2016-08-26T15:03:34+00:00","method":"POST","url":"\/scloud\/index.php\/apps\/files\/ajax\/upload.php","user":"Matthew"}
{"reqId":"V8Bf22ynhSUAACbhVDsAAAB6","remoteAddr":"2.139.51.166","app":"files","message":"Upload error: 3 - The uploaded file was only partially uploaded","level":3,"time":"2016-08-26T15:29:00+00:00","method":"POST","url":"\/scloud\/index.php\/apps\/files\/ajax\/upload.php","user":"Matthew"}
{"reqId":"V8Bi62ynhSUAANdxOo0AAAKJ","remoteAddr":"2.139.51.166","app":"PHP","message":"Out of memory (allocated 78381056) (tried to allocate 48000000 bytes) at \/home\/user\/public_html\/scloud\/lib\/private\/legacy\/image.php#522","level":3,"time":"2016-08-26T15:40:27+00:00","method":"GET","url":"\/scloud\/index.php\/core\/preview.png?file=%2FDocuments%2FImages%2FWallpapers%2FOther%2Fhellsing_rip_van_winkle_wallpaper-9036.png&c=080208cf2f834903cf0781447782a662&x=32&y=32&forceIcon=0","user":"Matthew"}
{"reqId":"V9a7B2ynhSUAALeNDgEAAAGg","remoteAddr":"184.154.36.175","app":"core","message":"Trusted domain error. \"184.154.36.175\" tried to access using \"www.example.com\" as host.","level":2,"time":"2016-09-12T14:26:16+00:00","method":"GET","url":"\/scloud\/index.php\/login","user":"--"}
{"reqId":"V@QZU2ynhSUAAWMw2ZgAAAEL","remoteAddr":"80.29.85.186","app":"PHP","message":"fopen(\/home\/user\/public_html\/scloud\/data\/Matthew\/thumbnails\/2562\/243-242-max-cover.png): failed to open stream: No such file or directory at \/home\/user\/public_html\/scloud\/lib\/private\/Files\/Storage\/Local.php#273","level":3,"time":"2016-09-22T17:48:03+00:00","method":"GET","url":"\/scloud\/index.php\/core\/preview.png?file=%2FDocuments%2FImages%2FOther%2FFunny+Penguin+Species.png&x=389&y=219&a=1&mode=cover&c=332cb1420327036014480ba1d9d676b3&forceIcon=0","user":"Matthew"}
{"reqId":"V@ZmZGynhSUAABZZ@WUAAACg","remoteAddr":"83.39.0.28","app":"core","message":"Login failed: 'Matthew' (Remote IP: '83.39.0.28')","level":2,"time":"2016-09-24T11:41:25+00:00","method":"POST","url":"\/scloud\/index.php\/login","user":"--"}
{"reqId":"V@ZmZWynhSUAABZZ@XkAAACg","remoteAddr":"83.39.0.28","app":"PHP","message":"Undefined offset: 1 at \/home\/user\/public_html\/scloud\/core\/Controller\/LoginController.php#117","level":3,"time":"2016-09-24T11:41:26+00:00","method":"GET","url":"\/scloud\/index.php\/login?user=Matthew","user":"--"}
{"reqId":"V@ZmZWynhSUAABZZ@XkAAACg","remoteAddr":"83.39.0.28","app":"PHP","message":"Invalid argument supplied for foreach() at \/home\/user\/public_html\/scloud\/core\/templates\/login.php#23","level":3,"time":"2016-09-24T11:41:26+00:00","method":"GET","url":"\/scloud\/index.php\/login?user=Matthew","user":"--"}
{"reqId":"V@ZmbGynhSUAABZZ@fsAAACg","remoteAddr":"83.39.0.28","app":"core","message":"Login failed: 'Matthew' (Remote IP: '83.39.0.28')","level":2,"time":"2016-09-24T11:41:32+00:00","method":"POST","url":"\/scloud\/index.php\/login?user=Matthew","user":"--"}
{"reqId":"V@ZmbGynhSUAABZZ@gsAAACg","remoteAddr":"83.39.0.28","app":"PHP","message":"Undefined offset: 1 at \/home\/user\/public_html\/scloud\/core\/Controller\/LoginController.php#117","level":3,"time":"2016-09-24T11:41:33+00:00","method":"GET","url":"\/scloud\/index.php\/login?user=Matthew","user":"--"}
{"reqId":"V@ZmbGynhSUAABZZ@gsAAACg","remoteAddr":"83.39.0.28","app":"PHP","message":"Invalid argument supplied for foreach() at \/home\/user\/public_html\/scloud\/core\/templates\/login.php#23","level":3,"time":"2016-09-24T11:41:33+00:00","method":"GET","url":"\/scloud\/index.php\/login?user=Matthew","user":"--"}

Browser log

https://example.com/scloud/data/htaccesstest.txt?t=[RANDOM NUMBER HERE]Failed to load resource: the server responded with a status of 403 (Forbidden)
PVince81 commented 8 years ago

@VicDeo please have a look

PVince81 commented 8 years ago

Did you try with the patch from https://central.owncloud.org/t/patches-for-known-update-issues-from-version-9-0-4-9-0-5-9-1-0-9-1-1/3549/4 ?

The issue you have doesn't seem related though.

MatthewC commented 8 years ago

How exactly do you apply a path without access to the command line?

PVince81 commented 8 years ago

@GhostCyborg you can first extract the tarball locally, then apply the patch, then upload the modified ownCloud version to your shared hoster.

MatthewC commented 8 years ago

@PVince81 I'm sorry, I don't quite understand what you're saying, also, looking through what bugs that path fixes, none of them seem related to mine, or show the same error as mine.

VicDeo commented 8 years ago

This line contains PHP 5.4 incompatible construction and the patch fixes that too.You can just take files that are mentioned in the patch from 9.1.2 rc2 and FTP them to the respective locations.

MatthewC commented 8 years ago

@PVince81 @VicDeo I changed the PHP version to 7.0 and now get the error    [UnexpectedValueException]   Could not parse a response for config:list. Please check if the current shell user can run occ command. Raw output:   Not allowed   , also I still have no clue on what you mean by rc2, and how/where to install a patch. UPDATE: I managed to ask hosting provider for command line access, and managed to patch it, But now get this error: Capture.png UPDATE #2: The url that the "Update" button was talking me to seemed to have been glitching out, but when I went to "example.com/owncloud/index.php/settings/admin", It displayed an update screen, different to the one the "Update" button was showing, which actually updated OwnCloud but when I went back to the admin panel i got this error: Some files have not passed the integrity check. Further information on how to resolve this issue can be found in our documentation. (List of invalid files… / Rescan…), should i be worried about this? UPDATE #3: After researching, I found out that I have to replace 'version.php' and 'index.php' to the latest file from GitHub, but when I did this, and loaded index.php, It took me to a page, to update to '9.2.0 pre alpha' Capture UPDATE.png

MatthewC commented 8 years ago

@PVince81 @VicDeo Any update?

VicDeo commented 8 years ago

@GhostCyborg by 9.1.2 rc2 I mean exactly 9.1.2 rc2 https://central.owncloud.org/t/owncloud-server-maintenance-releases-8-0-16-rc2-8-1-11-rc2-8-2-9-rc2-9-0-6-rc2-and-9-1-2-rc2/3533

MatthewC commented 8 years ago

@VicDeco How would I run the sudo -u apache php occ upgrade command without terminal access?

VicDeo commented 8 years ago

@GhostCyborg

After researching, I found out that I have to replace 'version.php' and 'index.php' to the latest file from GitHub, but when I did this, and loaded index.php, It took me to a page, to update to '9.2.0 pre alpha'

If it is not too late I'd suggest to revert these files back to 9.1.0 If you execute upgrade in this state you will have version that will claim itself to be 9.2.0 pre alpha but it still will have database, core in apps from 9.1.0. Nothing except the version number will be updated in this case.

MatthewC commented 8 years ago

@VicDeo Ok, I installed 9.1.2 rc2, just like you asked, luckily, I still have the old version of the files I replaced (index.php, version.php). You want me to replace the new index.php/version.php with the version from 9.1.0, and once I do that, how would I start an update? UPDATE: Ok, I replaced index.php & version.php, and turned off maintenance mode, once I did that I got promoted to update, and it seems the update was successfull, but I got a message saying There were problems with the code integrity check. More information…. Should i be worried?

VicDeo commented 8 years ago

I'm sorry, I have no idea what you have done to your installation.

You can just take files that are mentioned in the patch from 9.1.2 rc2

means that you need to download 9.1.2rc, extract it and overwrite the following list of files in your 9.1.0 with the files from 9.1.2rc2

  1. updater/src/Command/PostUpgradeCleanupCommand.php
  2. updater/src/Console/Application.php
  3. updater/src/Controller/IndexController.php
  4. updater/src/Resources/views/partials/error.php
  5. updater/src/Utils/Locator.php
  6. updater/src/Utils/OccRunner.php
  7. core/Controller/OccController.php
  8. core/Application.php
  9. core/routes.php

the patch changes exactly these files.

MatthewC commented 8 years ago

@VicDeo I replaced my whole OwnCloud installation with the files from 9.1.2rc2, and then replaced index.php and version.php with the version I originally had in 9.1.0. Everything seems to be working in perfect order, and there doesn't seem to be an error, except for the There were problems with the code integrity check. More information…. message. Is there something I should be worried about, in regards to the 9.1.2rc2 update?

VicDeo commented 8 years ago

@GhostCyborg ok, there is a link after More information to see list of files that do not pass integrity check. Please click it and post the list here.

Most likely you just need to revert index.php and version.php to those that are shipped with 9.1.2rc2

MatthewC commented 8 years ago
Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- core
    - EXTRA_FILE
        - error_log
        - owncloud-9.1.2RC2.zip
        - .htaccess-1477593030
        - index.php.BAK
        - .htaccess-1477593043
    - INVALID_HASH
        - version.php

Raw output
==========
Array
(
    [core] => Array
        (
            [EXTRA_FILE] => Array
                (
                    [error_log] => Array
                        (
                            [expected] => 
                            [current] => 7fdf760570778ae9616370150124bfd5c754f6617840270232461b5b96624e6181b84afc1f00436a62fbd6500ee401f7145eefb9d412881d2e0952e271c1fc5a
                        )

                    [owncloud-9.1.2RC2.zip] => Array
                        (
                            [expected] => 
                            [current] => 879678d27f094f16db29e7925c7eded8089988b12e18e8fc66376adce6477d48c511b72efac8cbb917c5bcfadb4480817acfcee83e50b1cc3d3d5de7be4845e1
                        )

                    [.htaccess-1477593030] => Array
                        (
                            [expected] => 
                            [current] => 64b4bd211f5d1f4d6b42bb00a40eb5d4b79912633bd0a1b9764b7cef51b409eeb3213ea956d1c199845b17f5deeaee2df8f6495cef146dd1ec887a06b029f4e4
                        )

                    [index.php.BAK] => Array
                        (
                            [expected] => 
                            [current] => 344a890e8efac2f2cad8195f69257455ea6f55bf850a2c5280c52aabbce2cef265c765edf62dd7af27413aef1fc37cd7e1251dde2950d267132b82a36ebfe62b
                        )

                    [.htaccess-1477593043] => Array
                        (
                            [expected] => 
                            [current] => a602367a31e1d2aa81cf2d83330afbd97c77f47751f5ac78cba0b5148f8cbcb573218c6095ec7e3adecd5390a555def830e216315eb6ccf57fa0669186fca5bf
                        )

                )

            [INVALID_HASH] => Array
                (
                    [version.php] => Array
                        (
                            [expected] => 95be48d6123f928e59243ffb9f3801e4a60f12561e34cf6161ab5400d4ef57b648506030ec8faa1d47e0c0731081cbb0579aef6d26a1db3b057c6b1aca032488
                            [current] => 9cffe58d686d4de9332124008f3da2ea908480d42779215ed1d70ca2b09f1fb548f219010159026bdfaabb431ce0a48284b2b6a0b3a1a39b1b3dba1e89990f95
                        )

                )

        )

)

Just a quick note: the .BAK files are the old version of the files.

VicDeo commented 8 years ago

@PVince81 changing milestone to 9.1.2, fixed with https://github.com/owncloud/updater/pull/399 (stable9) https://github.com/owncloud/updater/pull/398 (stable9.1)

VicDeo commented 8 years ago

@GhostCyborg Revert version.php to be the one provided with 9.1.2rc2

Regarding extra files from the list below: you can just move them one level up to pass integrity check succesfully. Except error_log that was created by your hosting provider automatically and probably it will be recreated anyway.

- EXTRA_FILE
    - error_log
    - owncloud-9.1.2RC2.zip
    - .htaccess-1477593030
    - index.php.BAK
    - .htaccess-1477593043
MatthewC commented 8 years ago

@VicDeo When I restored version.php, it once again prompted me to update, and once that was finished I got the error There were problems with the code integrity check. More information…. This time the only invalid file was index.php:

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- core
    - INVALID_HASH
        - index.php

Raw output
==========
Array
(
    [core] => Array
        (
            [INVALID_HASH] => Array
                (
                    [index.php] => Array
                        (
                            [expected] => 7dd1af37deb88b4c604b1f3d19d1aae906ac8a76d4198cfd99a657bd1f25b09896b2b560da20a092d08dc61b24acffc5afc32e78e7987fb2caec32d276b18885
                            [current] => 344a890e8efac2f2cad8195f69257455ea6f55bf850a2c5280c52aabbce2cef265c765edf62dd7af27413aef1fc37cd7e1251dde2950d267132b82a36ebfe62b
                        )

                )

        )

)
VicDeo commented 8 years ago

@GhostCyborg what version is in your config/config.php right now?

MatthewC commented 8 years ago

@VicDeo It seems to be 9.1.2.4

VicDeo commented 7 years ago

@GhostCyborg What is the current state of you ownCloud? Did you try to update to 9.1.2?

MatthewC commented 7 years ago

@VicDeo Currently in '9.1.2 RC2'

VicDeo commented 7 years ago

Original issue Fatal error: Can't use method return value in write context is caused by PHP 5.4 incompatibility in Updater shipped with 9.0.4, 9.0.5, 9.1.0, 9.1.1 Patch fixing it is published at https://central.owncloud.org/t/patches-for-known-update-issues-from-version-9-0-4-9-0-5-9-1-0-9-1-1/3549/1

The patch can be downloaded as a patch or as a set of already patched files from the post linked above.

9.1.2 release was pushed to update server several days ago. Closing. Please open another issue if there is something left to fix.

MatthewC commented 7 years ago

@VicDeo One question, Which would do I use, because I have 9.1.2 RC2, meaning should I use the '9.1.0 and 9.1.1 ' one?

VicDeo commented 7 years ago

@GhostCyborg None of them. 9.1.2 RC2 already includes this patch.

MatthewC commented 7 years ago

@VicDeo Then what exactly should I do? I'm quite confused...

VicDeo commented 7 years ago

@GhostCyborg It depends on what you want to achieve. If you already replaced 9.1.1 files with 9.1.2rc2 and passed database update step you can't update via web UI until 9.1.3 is available online. IIRC there were no merges in post-RC phase so your 9.1.2rc2 is the same with 9.1.2 from the point of code.

If you don't want to wait but to get rid of letters rc2 asap you need to:

For anyone else reading this: This is not a correct way for a manual update but for this particular case only (moving from rc2 to release)

MatthewC commented 7 years ago

@VicDeo Thanks for your help, I'm going to wait for 9.1.3 is available, Thanks again!

lock[bot] commented 5 years ago

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.