Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
szaimen opened this issue Nov 29, 2020 · 21 comments · Fixed by #2729
Open

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

szaimen opened this issue Nov 29, 2020 · 21 comments · Fixed by #2729

Comments

@szaimen
Copy link
Contributor

szaimen commented Nov 29, 2020

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

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
Copy link

X-Wizard commented Jan 4, 2021

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

@szaimen
Copy link
Contributor Author

szaimen commented Jan 11, 2021

@kesselb maybe you have and idea?

@szaimen
Copy link
Contributor Author

szaimen commented Jan 13, 2021

cc @nextcloud/server-triage

@blizzz
Copy link
Member

blizzz commented Jan 13, 2021

@nickvergessen seems activity related

@nickvergessen
Copy link
Member

Do you have numeric userids?

@szaimen
Copy link
Contributor Author

szaimen commented Jan 13, 2021

Thanks for the reply!

Do you have numeric userids?

No, I don't.

Any other idea?

@nickvergessen
Copy link
Member

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

@nickvergessen
Copy link
Member

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
Copy link
Contributor Author

szaimen commented Jan 14, 2021

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
Copy link
Contributor Author

szaimen commented Jan 14, 2021

@nickvergessen should I report this to the Deck repository?

@nickvergessen
Copy link
Member

So the problem is

if ($subject === self::SUBJECT_CARD_UPDATE_STACKID) {
$subjectParams['stackBefore'] = $this->stackMapper->find($additionalParams['before']);
$subjectParams['stack'] = $this->stackMapper->find($additionalParams['after']);
}

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
Copy link
Member

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

Feel free to try it

@szaimen
Copy link
Contributor Author

szaimen commented Jan 15, 2021

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

@X-Wizard
Copy link

X-Wizard commented Jan 16, 2021

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

PNG-afbeelding

@nickvergessen
Copy link
Member

The please apply #2727 (comment) as your issue might be a different app.

@szaimen
Copy link
Contributor Author

szaimen commented Jan 17, 2021

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
Copy link
Member

It's only attempted once a day

@szaimen
Copy link
Contributor Author

szaimen commented Jan 17, 2021

It's only attempted once a day

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

@szaimen
Copy link
Contributor Author

szaimen commented Feb 24, 2021

Unfortunately the error returned. I've applied the logger from #2727 (comment) 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 szaimen reopened this Feb 24, 2021
@szaimen
Copy link
Contributor Author

szaimen commented Apr 1, 2021

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
Copy link

heeplr commented Feb 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants