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.

 

Comments

7 responses to “Fix requested URI error when using owncloud and PHP 7”

  1. HC Avatar
    HC

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

  2. vince Avatar
    vince

    save my life 🙂

  3. Martin Avatar
    Martin

    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 Avatar
    Mathieu

    Thanks very much ! it solved my problem

  5. Luis Avatar
    Luis

    Excelent!!!

  6. mike Avatar
    mike

    thank you very match

    greetings from munich, germany

  7. V Avatar

    This helped fix my OC. So Simple.. thanks!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.