nextcloud / cms_pico

🗃 Integrate Pico CMS and let your users manage their own websites
https://apps.nextcloud.com/apps/cms_pico
GNU Affero General Public License v3.0
136 stars 43 forks source link

Symfony YAML incompatibility issues with other Nextcloud apps #121

Open matt-horwood-mayden opened 4 years ago

matt-horwood-mayden commented 4 years ago

Morning, I seem to have an issue with my sites, have had a look at the error dump and not sure if my setup or code.

OS: Rasbian 9.11
nextcloud: 18.0.3 (upgrade)
Pico CMS: 1.0.5
Web server: Nginx 1.16.0 (separate server to PHP)
PHP-FPM: 7.2.27 (separate server to Nginx)
MySQL: MariaDB 10.3.22 (separate to PHP & Nginx)

Error in NC log

{
  "reqId": "QOC1a6tLmWIGOvr7makP",
  "level": 3,
  "time": "2020-04-01 07:26:35",
  "remoteAddr": "CLI_IP",
  "user": "USERNAME",
  "app": "cms_pico",
  "method": "GET",
  "url": "/index.php/apps/cms_pico/pico_proxy/SITE",
  "message": {
    "Exception": "OCA\\CMSPico\\Exceptions\\PicoRuntimeException",
    "Message": "The reserved indicator \"%\" cannot start a plain scalar; you need to quote the scalar at line 15 (near \"                                    #     See https://php.net/manual/en/function.strftime.php for more info\").",
    "Code": 0,
    "Trace": [
      {
        "file": "/srv/www/nextcloud/apps/cms_pico/lib/Service/WebsitesService.php",
        "line": 282,
        "function": "getPage",
        "class": "OCA\\CMSPico\\Service\\PicoService",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\CMSPico\\Model\\Website"
          }
        ]
      },
      {
        "file": "/srv/www/nextcloud/apps/cms_pico/lib/Controller/PicoController.php",
        "line": 108,
        "function": "getPage",
        "class": "OCA\\CMSPico\\Service\\WebsitesService",
        "type": "->",
        "args": [
          "SITE",
          "",
          "USERNAME",
          true
        ]
      },
      {
        "file": "/srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 170,
        "function": "getPage",
        "class": "OCA\\CMSPico\\Controller\\PicoController",
        "type": "->",
        "args": [
          "SITE",
          "",
          true
        ]
      },
      {
        "file": "/srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 99,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\CMSPico\\Controller\\PicoController"
          },
          "getPage"
        ]
      },
      {
        "file": "/srv/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 125,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\CMSPico\\Controller\\PicoController"
          },
          "getPage"
        ]
      },
      {
        "file": "/srv/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php",
        "line": 47,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\CMSPico\\Controller\\PicoController",
          "getPage",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "page": "",
            "proxyRequest": true,
            "site": "SITE",
            "_route": "cms_pico.Pico.getPageProxy"
          }
        ]
      },
      {
        "function": "__invoke",
        "class": "OC\\AppFramework\\Routing\\RouteActionHandler",
        "type": "->",
        "args": [
          {
            "page": "",
            "proxyRequest": true,
            "site": "SITE",
            "_route": "cms_pico.Pico.getPageProxy"
          }
        ]
      },
      {
        "file": "/srv/www/nextcloud/lib/private/Route/Router.php",
        "line": 299,
        "function": "call_user_func",
        "args": [
          {
            "__class__": "OC\\AppFramework\\Routing\\RouteActionHandler"
          },
          {
            "page": "",
            "proxyRequest": true,
            "site": "SITE",
            "_route": "cms_pico.Pico.getPageProxy"
          }
        ]
      },
      {
        "file": "/srv/www/nextcloud/lib/base.php",
        "line": 1008,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/cms_pico/pico_proxy/SITE"
        ]
      },
      {
        "file": "/srv/www/nextcloud/index.php",
        "line": 38,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/srv/www/nextcloud/apps/cms_pico/lib/Service/PicoService.php",
    "Line": 157,
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36 OPR/67.0.3575.79",
  "version": "18.0.3.0"
}
PhrozenByte commented 4 years ago

In some way it's the same issue as with #97: Some other Nextcloud app also ships Symfony YAML and replaces the one used by Pico. Since Symfony YAML does a pretty good job in maintaining BC users don't experience problems too often, but here's one of these cases.

Symfony YAML changed its behaviour and no longer allows unquoted strings to start with a %. You'll have to check all YAML headers of your .md files for any meta variable starting with a % and quote it with ". Also check nextcloud/data/appdata_*/cms_pico/config/config.yml. For example, replace date_format: %D %T by date_format: "%D %T".

This is indeed a bug, but not really the fault of Pico CMS for Nextcloud, but of the whole app infrastructure of Nextcloud. We unfortunately can't do anything about it at the moment :unamused: Also see #97, it's basically the same cause.

matt-horwood-mayden commented 4 years ago

Thanks for your investigations, I can confirm that the issue was in my appdata_*/cms_pico/config/config.yml the very line about date format.

now sorted!

PhrozenByte commented 4 years ago

Will keep this open as with #97