nextcloud / deck

🗂 Kanban-style project & personal management tool for Nextcloud, similar to Trello
https://apps.nextcloud.com/apps/deck
GNU Affero General Public License v3.0
1.21k stars 276 forks source link

TypeError: htmlspecialchars() expects parameter 1 to be string, int given #2727

Open szaimen opened 3 years ago

szaimen commented 3 years ago

How to use GitHub

Steps to reproduce

Don't know how to reproduce exactly. Most likely it has to do with the cronjob that tries to send activity mails.

Expected behaviour

No error report in the logs (and an activity mail should be send)

Actual behaviour

error report in the logs

Server configuration detail

Operating system: Linux 5.4.0-54-generic nextcloud/server#60-Ubuntu SMP Fri Nov 6 10:37:59 UTC 2020 x86_64

Webserver: Apache (fpm-fcgi)

Database: pgsql PostgreSQL 12.5 (Ubuntu 12.5-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit

PHP version:

7.4.3 Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, sodium, cgi-fcgi, json, apcu, igbinary, mysqlnd, PDO, xml, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, imap, intl, redis, ldap, exif, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, shmop, SimpleXML, smbclient, soap, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, libsmbclient, Zend OPcache

Nextcloud version: 20.0.2 - 20.0.2.2

Updated from an older Nextcloud/ownCloud or fresh install: Updated from 20.0.1

Where did you install Nextcloud from: Nextcloud VM

Signing status Array ( )
List of activated apps ``` Enabled: - accessibility: 1.6.0 - activity: 2.13.3 - admin_audit: 1.10.0 - apporder: 0.11.0 - bruteforcesettings: 2.0.1 - calendar: 2.1.2 - cloud_federation_api: 1.3.0 - cms_pico: 1.0.10 - contacts: 3.4.2 - contactsinteraction: 1.1.0 - dashboard: 7.0.0 - dav: 1.16.1 - deck: 1.2.2 - event_update_notification: 1.1.0 - extract: 1.2.5 - federatedfilesharing: 1.10.1 - files: 1.15.0 - files_external: 1.11.1 - files_linkeditor: 1.1.2 - files_mindmap: 0.0.23 - files_pdfviewer: 2.0.1 - files_readmemd: 1.2.0 - files_rightclick: 0.17.0 - files_sharing: 1.12.0 - files_trashbin: 1.10.1 - files_versions: 1.13.0 - files_videoplayer: 1.9.0 - forms: 2.0.4 - geoblocker: 0.4.0 - impersonate: 1.7.0 - issuetemplate: 0.7.0 - logreader: 2.5.0 - lookup_server_connector: 1.8.0 - maps: 0.1.8 - metadata: 0.12.0 - music: 0.17.3 - nextcloud_announcements: 1.9.0 - notifications: 2.8.0 - oauth2: 1.8.0 - onlyoffice: 6.1.0 - password_policy: 1.10.1 - photos: 1.2.0 - polls: 1.6.2 - previewgenerator: 3.0.1 - provisioning_api: 1.10.0 - rainloop: 7.0.3 - ransomware_protection: 1.8.0 - recommendations: 0.8.0 - serverinfo: 1.10.0 - settings: 1.2.0 - spreed: 10.0.3 - suspicious_login: 3.2.1 - talk_simple_poll: 1.2.0 - tasks: 0.13.6 - text: 3.1.0 - theming: 1.11.0 - theming_customcss: 1.7.0 - twofactor_nextcloud_notification: 3.0.0 - updatenotification: 1.10.0 - user_status: 1.0.1 - video_converter: 0.1.5 - viewer: 1.4.0 - weather_status: 1.0.0 - workflowengine: 2.2.0 Disabled: - bookmarks - comments - drawio - encryption - federation - firstrunwizard - notes - occweb - ocr - privacy - radio - sharebymail - support - survey_client - systemtags - user_ldap - whiteboard ```
Configuration (config/config.php) ``` { "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "localhost", "***REMOVED SENSITIVE VALUE***", "***REMOVED SENSITIVE VALUE***", "***REMOVED SENSITIVE VALUE***" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "pgsql", "version": "20.0.2.2", "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "instanceid": "***REMOVED SENSITIVE VALUE***", "log_type": "file", "logfile": "\/var\/log\/nextcloud\/nextcloud.log", "loglevel": "2", "mail_smtpmode": "smtp", "log_rotate_size": "10485760", "trashbin_retention_obligation": "auto, 180", "versions_retention_obligation": "auto, 365", "simpleSignUpLink.shown": false, "memcache.local": "\\OC\\Memcache\\APCu", "filelocking.enabled": true, "memcache.distributed": "\\OC\\Memcache\\Redis", "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 0, "timeout": 0.5, "dbindex": 0, "password": "***REMOVED SENSITIVE VALUE***" }, "logtimezone": "Europe\/Berlin", "htaccess.RewriteBase": "\/", "maintenance": false, "mail_smtpsecure": "ssl", "mail_sendmailmode": "smtp", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpauthtype": "LOGIN", "mail_smtpauth": 1, "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "465", "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "share_folder": "\/Shared", "enable_previews": true, "preview_max_x": "2048", "preview_max_y": "2048", "jpeg_quality": "60", "theme": "", "updater.release.channel": "stable", "twofactor_enforced": "true", "twofactor_enforced_groups": [], "twofactor_enforced_excluded_groups": [ "disabled_twofactorauth" ], "lost_password_link": "disabled", "allow_user_to_change_display_name": false, "knowledgebaseenabled": false, "log.condition": { "apps": [ "admin_audit" ] }, "data-fingerprint": "***REMOVED SENSITIVE VALUE***", "enabledPreviewProviders": { "11": "OC\\Preview\\PNG", "12": "OC\\Preview\\JPEG", "13": "OC\\Preview\\GIF", "14": "OC\\Preview\\BMP", "16": "OC\\Preview\\MP3", "18": "OC\\Preview\\Movie" } } ```

Are you using external storage, if yes which one: local

Are you using encryption: No

Are you using an external user-backend, if yes which one: No

Client configuration

Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36 Edg/87.0.664.47

Operating system: As shown in the Browser useragent

Logs

Web server error log ``` Insert your web server log here ```

Nextcloud log

TypeError: htmlspecialchars() expects parameter 1 to be string, int given

0. /var/www/nextcloud/apps/activity/lib/DigestSender.php - line 230:
htmlspecialchars()

1. /var/www/nextcloud/apps/activity/lib/DigestSender.php - line 184:
OCA\Activity\DigestSender->getHTMLSubject()

2. /var/www/nextcloud/apps/activity/lib/DigestSender.php - line 111:
OCA\Activity\DigestSender->sendDigestForUser()

3. /var/www/nextcloud/apps/activity/lib/BackgroundJob/DigestMail.php - line 47:
OCA\Activity\DigestSender->sendDigests()

4. /var/www/nextcloud/lib/private/BackgroundJob/Job.php - line 52:
OCA\Activity\BackgroundJob\DigestMail->run()

5. /var/www/nextcloud/lib/private/BackgroundJob/TimedJob.php - line 59:
OC\BackgroundJob\Job->execute()

6. /var/www/nextcloud/cron.php - line 127:
OC\BackgroundJob\TimedJob->execute()
Browser log Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ...
X-Wizard commented 3 years ago

Same issue here, hope that someone can solve this issue. I have the same errors as shown above.

szaimen commented 3 years ago

@kesselb maybe you have and idea?

szaimen commented 3 years ago

cc @nextcloud/server-triage

blizzz commented 3 years ago

@nickvergessen seems activity related

nickvergessen commented 3 years ago

Do you have numeric userids?

szaimen commented 3 years ago

Thanks for the reply!

Do you have numeric userids?

No, I don't.

Any other idea?

nickvergessen commented 3 years ago

Feel free to delete the names again. I will find it out tomorrow

nickvergessen commented 3 years ago

Does this happen regularly for anyone or one time thing? If it happens more often you could help find out which app it is.

In apps/activity/lib/DigestSender.php find (around line 227):

if (isset($parameter['link'])) {

before add:

            if (!is_string($replacement)) {
                \OC::$server->getLogger()->error("App {$event->getApp()} has activity with non-string placeholder $placeholder", [
                    'app' => 'server-24434',
                ]);
            }

check your log for server-24434 regularly and when you find an error in your log with this string, post the full line here. Thanks

szaimen commented 3 years ago

Thanks for the fast resolution!

Does this happen regularly for anyone or one time thing?

It happens regularly.


I've applied the logger and this was the new log message:

[server-24434] Error: App deck has activity with non-string placeholder before

at 2021-01-14T09:55:02+01:00

Installed is Deck 1.2.3

szaimen commented 3 years ago

@nickvergessen should I report this to the Deck repository?

nickvergessen commented 3 years ago

So the problem is https://github.com/nextcloud/deck/blob/199cccf86bd9386e7bb621e5bef724b02f5dee20/lib/Activity/ActivityManager.php#L402-L405

Which leaves the original stack/list id as before and after parameter with id+name being the int. they are not used because instead stack and stackBefore are used, so I guess they should be removed from the "store in db" function and also removed on rendering to unbreak existing entries.

nickvergessen commented 3 years ago

Patch is at https://github.com/nextcloud/deck/pull/2729/files

Feel free to try it

szaimen commented 3 years ago

I've applied the fix. We'll see tomorrow if it works, thanks!

X-Wizard commented 3 years ago

I’ve applied the fix, see the same error. No change :-(

PNG-afbeelding
nickvergessen commented 3 years ago

The please apply https://github.com/nextcloud/deck/issues/2727#issuecomment-760003284 as your issue might be a different app.

szaimen commented 3 years ago

The error message hasn't come up again since I've applied the fix but I'm not sure if it works since I didn't get any summary mail since then which seems a bit strange to me.

nickvergessen commented 3 years ago

It's only attempted once a day

szaimen commented 3 years ago

It's only attempted once a day

Yes but I've applied the fix ~45h ago...

szaimen commented 3 years ago

Unfortunately the error returned. I've applied the logger from https://github.com/nextcloud/deck/issues/2727#issuecomment-760003284 again and now get this message again:

[server-24434] Error: App deck has activity with non-string placeholder before

at 2021-02-24T15:40:02+01:00

Deck is now at version 1.2.4 on my NC20 instance.

szaimen commented 3 years ago

Sry, but the new issue is not excactly the same: it is now called: TypeError: htmlspecialchars() expects parameter 1 to be string, bool given but it is still definitely an issue of the Deck app.

{
  "reqId": "BdUZkUSJyxBdqo9E3qfa",
  "level": 3,
  "time": "2021-04-01T06:15:02+02:00",
  "remoteAddr": "",
  "user": "--",
  "app": "activity",
  "method": "",
  "url": "--",
  "message": {
    "Exception": "TypeError",
    "Message": "htmlspecialchars() expects parameter 1 to be string, bool given",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/activity/lib/DigestSender.php",
        "line": 239,
        "function": "htmlspecialchars"
      },
      {
        "file": "/var/www/nextcloud/apps/activity/lib/DigestSender.php",
        "line": 193,
        "function": "getHTMLSubject",
        "class": "OCA\\Activity\\DigestSender",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/activity/lib/DigestSender.php",
        "line": 112,
        "function": "sendDigestForUser",
        "class": "OCA\\Activity\\DigestSender",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/activity/lib/BackgroundJob/DigestMail.php",
        "line": 47,
        "function": "sendDigests",
        "class": "OCA\\Activity\\DigestSender",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/BackgroundJob/Job.php",
        "line": 52,
        "function": "run",
        "class": "OCA\\Activity\\BackgroundJob\\DigestMail",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/BackgroundJob/TimedJob.php",
        "line": 59,
        "function": "execute",
        "class": "OC\\BackgroundJob\\Job",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/cron.php",
        "line": 127,
        "function": "execute",
        "class": "OC\\BackgroundJob\\TimedJob",
        "type": "->"
      }
    ],
    "File": "/var/www/nextcloud/apps/activity/lib/DigestSender.php",
    "Line": 239,
    "CustomMessage": "Exception occurred while sending user digest email"
  },
  "userAgent": "--",
  "version": "20.0.8.1",
  "id": "606589d414a36"
}
heeplr commented 2 years ago

@szaimen I see this error in 22.2.3 as well. Maybe this should be a new issue since it's a different error?