marius-wieschollek / passwords

A simple, yet feature rich password manager for Nextcloud
GNU Affero General Public License v3.0
215 stars 45 forks source link

Setting favicon server causes an error when trying to open user settings #471

Closed shermzm closed 2 years ago

shermzm commented 2 years ago

System Information

Server:

{
    "version": {
        "server": "23.0.0.10",
        "app": "2022.1.20",
        "lsr": false,
        "php": "8.0.14"
    },
    "environment": {
        "os": "Linux",
        "architecture": "x86_64",
        "bits": 64,
        "database": "mysql",
        "cron": "cron",
        "proxy": false,
        "sslProxy": false,
        "subdirectory": false
    },
    "services": {
        "images": "gdlib",
        "favicons": "bi",
        "previews": "pageres",
        "security": "hibp",
        "words": "leipzig",
        "previewApi": false,
        "faviconApi": true
    },
    "settings": {
        "channel": "stable",
        "nightlies": false,
        "handbook": false,
        "performance": 5
    },
    "encryption": {
        "sse": {
            "SSEv1r1": false,
            "SSEv1r2": true,
            "SSEv2r1": false,
            "none": false,
            "default": "SSEv1r2"
        },
        "cse": {
            "CSEv1r1": false,
            "none": true,
            "default": "none"
        }
    }
}

Passwords:

        "passwords": {
            "SSEv1ServerKey": "AReallyLongString",
            "backup\/update\/restored": "0",
            "cron\/php\/version\/id": "80014",
            "cron\/php\/version\/string": "8.0.14",
            "enabled": "yes",
            "installed_version": "2022.1.20",
            "legacy_last_used": "1609527110",
            "migration\/customFields": "2020.12.2",
            "passwords\/localdb\/type": "hibp",
            "service\/favicon": "bi",
            "service\/favicon\/bi\/counter": "52:249:0",
            "service\/favicon\/bi\/url": "http:\/\/192.168.1.10:8192",
            "service\/preview": "pageres",
            "service\/words": "leipzig",
            "survey\/server\/mode": "0",
            "survey\/server\/notification": "1625180009",
            "types": ""
        }

Client:

 Browser and Version: Firefox 95.0.2
 Client OS and Version: Arch

Steps to reproduce

  1. Enable the passwords app
  2. (possible) Set an favicon server in the system settings
  3. Attempting to access the user settings causes an Internal Server Error

Expected result

You can view user settings

Actual result

Internal Server Error

Nextcloud log

Nextcloud log {"reqId":"SQ6rbGeXnh8nmn9SPGzd","level":3,"time":"2022-01-14T03:06:07+00:00","remoteAddr":"192.168.1.11","user":"redacted","app":"index","method":"GET","url":"/index.php/apps/passwords/api/1.0/service/favicon/default/96","message":"syntax error, unexpected '=>' (T_DOUBLE_ARROW)","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0","version":"23.0.0.10","exception":{"Exception":"ParseError","Message":"syntax error, unexpected '=>' (T_DOUBLE_ARROW)","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/lib/composer/composer/ClassLoader.php","line":428,"function":"Composer\\Autoload\\includeFile"},{"function":"loadClass","class":"Composer\\Autoload\\ClassLoader","type":"->"},{"function":"spl_autoload_call"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":112,"function":"__construct","class":"ReflectionClass","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":131,"function":"resolve","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":463,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":435,"function":"queryNoFallback","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":87,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->"},{"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":106,"function":"array_map"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":114,"function":"buildClass","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":131,"function":"resolve","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":463,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":435,"function":"queryNoFallback","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":87,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->"},{"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":106,"function":"array_map"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":114,"function":"buildClass","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":131,"function":"resolve","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":463,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":435,"function":"queryNoFallback","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":56,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":182,"function":"get","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":160,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php","line":114,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":127,"function":"offsetGet","class":"Pimple\\Container","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":457,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":435,"function":"queryNoFallback","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/App.php","line":130,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/usr/share/webapps/nextcloud/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/share/webapps/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/usr/share/webapps/nextcloud/apps/passwords/lib/Services/HelperService.php","Line":115,"CustomMessage":"--"},"id":"61e0e9266bf63"}

Browser log

Browser log Uncaught TypeError: r is undefined r index.js:178 main.js:25 main.js:196 main.js:196
marius-wieschollek commented 2 years ago

This error seems a bit strange to me. The url in the error from the Nextcloud log is /index.php/apps/passwords/api/1.0/service/favicon/default/96, so it occurred when a favicon was requested. It occurred in the ClassLoader with the message "syntax error, unexpected '=>' (T_DOUBLE_ARROW)". So the error happened before the passwords app itself did anything. My first assumption would be that the error is not related to the setting and instead happens whenever the server attempts to load the HelperService. The service includes some code with a double arrow which only works in PHP 8.

The PHP version on the command line and the PHP version used by the webserver can be different. Can you check which PHP version is reported in the system section of the Nextcloud admin settings?

shermzm commented 2 years ago

Welp, that might have done it. I upgraded everything to PHP8, but left PHP7 installed. After rebooting the server for the first time in a few months, it looks like something reverted back to PHP7. I must have missed updating systemd or something. I'll check tonight to see if that resolves everything or not.

Thanks for your help in pointing me in the right direction!

shermzm commented 2 years ago

Sure enough, php-fpm7 was running instead of php-fpm (8). Loaded the correct one and everything is working fine. Updated systemd to start the correct one moving forward.

Thanks again Marius!