gary-kim/riotchat

Can't open Element on Nextcloud 25.0.10: syntax error in FileResponse.php

aab3r opened this issue · 2 comments

aab3r commented

Element in Nextcloud has been working fine up to the last Element update (0.16.0)

I get this from Nextcloud logs:

[index] Error: Exception: syntax error, unexpected ')', expecting '|' or variable (T_VARIABLE) in file '/var/www/nextcloud/apps/riotchat/lib/FileResponse.php' line 45 at <>

  1. /var/www/nextcloud/lib/private/AppFramework/App.php line 172
    OC\AppFramework\Http\Dispatcher->dispatch()
  2. /var/www/nextcloud/lib/private/Route/Router.php line 298
    OC\AppFramework\App::main()
  3. /var/www/nextcloud/lib/base.php line 1053
    OC\Route\Router->match()
  4. /var/www/nextcloud/index.php line 36
    OC::handleRequest()

GET /apps/riotchat/riot/
from 192.168.1.2 by (redacted) at 2023-08-29T20:59:06+02:00

Please, let me know if I can make any test or provide any other log.

Thanks!

Looks like the issue was introduced in this commit:

8eb60d4

Seems to me that the catch statement is missing the variable name for the exception type:

} catch (TypeError) {

should be

       } catch (TypeError $ex) {

I opened a pull request for the small change here: #539

In the meantime you could just add $ex to your local /var/www/nextcloud/apps/riotchat/lib/FileResponse.php file at line 45, it should look like this:

      try {
              $this->setHeaders(array_merge($this->getHeaders(), $headers));
      } catch (TypeError $ex) {
              $this->setHeaders($headers);
      }
aab3r commented

The change indeed works :) Thanks a lot!