Fix requested URI error when using owncloud and PHP 7

This is just a quick note for people experiencing problems using ownCloud with PHP 7.0.6 (and potentially versions above) which cause the following error when trying to access the admin backend:

{“reqId”:”qKglxvKVntjfjDJur2Zw”,”remoteAddr”:””,”app”:”index”,”message”:”Exception: {\”Exception\”:\”Exception\”,\”Message\”:\”The requested uri() cannot be processed by the script ‘\\\/apps\\\/owncloud\\\/index.php’)\”,\”Code\”:0,\”Trace\”:\”#0 \\\/apps\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/http\\\/request.php(640): OC\\\\AppFramework\\\\Http\\\\Request->getRawPathInfo()\\n#1 \\\/apps\\\/owncloud\\\/lib\\\/base.php(819): OC\\\\AppFramework\\\\Http\\\\Request->getPathInfo()\\n#2 \\\/apps\\\/owncloud\\\/index.php(39): OC::handleRequest()\\n#3 {main}\”,\”File\”:\”\\\/apps\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/http\\\/request.php\”,\”Line\”:614}”,”level”:3,”time”:”2016-05-07T07:18:43+00:00″}

There’s a simple solution to this problem by patching __isset() in  lib/private/AppFramework/Http/Request.php:

public function __isset($name) {
 + if (in_array($name, $this->allowedKeys, true)) {
 + return true;
 + }
 return isset($this->items['parameters'][$name]);
 }

For more info have a look at the offical GitHub patch commit.

 

You may also like...

6 Responses

  1. HC says:

    Nice, this solved the problem. Meanwhile OC 9.0.2 is out that includes this patch.

  2. vince says:

    save my life 🙂

  3. Martin says:

    cool, that fixed my broken OC after my server updated from Ubuntu 14.04 to 16.04 and php to v7. Thanks for this!

  4. Mathieu says:

    Thanks very much ! it solved my problem

  5. Luis says:

    Excelent!!!

  6. mike says:

    thank you very match

    greetings from munich, germany

Leave a Reply

Your email address will not be published. Required fields are marked *