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

[Bug]: Array to string conversion in CalDAV backend #37025

Open
6 of 9 tasks
ChristophWurst opened this issue Mar 3, 2023 · 7 comments
Open
6 of 9 tasks

[Bug]: Array to string conversion in CalDAV backend #37025

ChristophWurst opened this issue Mar 3, 2023 · 7 comments
Labels
1. to develop Accepted and waiting to be taken care of 26-feedback 27-feedback 28-feedback bug feature: caldav Related to CalDAV internals feature: dav good first issue Small tasks with clear documentation about how and in which place you need to fix things in.

Comments

@ChristophWurst
Copy link
Member

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

Array to string conversion at https://github.com/nextcloud/server/blob/v26.0.0rc1/apps/dav/lib/CalDAV/Activity/Backend.php#L561

$users = $this->getUsersForShares(array_intersect($sourceShares, $targetShares));

Steps to reproduce

  1. Connect mac os to Nextcloud's CalDAV backend
  2. ???

Expected behavior

No errors

Installation method

None

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

n/a

List of activated Apps

n/a

Nextcloud Signing status

No response

Nextcloud Logs

{
  "reqId": "9DlC6Z02DsTFC2tvNxU2",
  "level": 3,
  "time": "2023-03-03T06:56:13+00:00",
  "remoteAddr": "redacted",
  "user": "user123",
  "app": "PHP",
  "method": "MOVE",
  "url": "/remote.php/dav/calendars/user123/personal/sabredav-abc-def-ghi.ics",
  "message": "Array to string conversion at /var/www/cloud.nextcloud.com/nextcloud/apps/dav/lib/CalDAV/Activity/Backend.php#561",
  "userAgent": "macOS/13.1 (22C65) dataaccessd/1.0",
  "version": "26.0.0.8",
  "data": {
    "app": "PHP"
  },
  "id": "123def567"
}

Additional info

No response

@ChristophWurst ChristophWurst added bug 1. to develop Accepted and waiting to be taken care of feature: dav feature: caldav Related to CalDAV internals labels Mar 3, 2023
@ChristophWurst
Copy link
Member Author

array_intersect does not like nested array: https://3v4l.org/TYrqn

@tcitworld
Copy link
Member

tcitworld commented Mar 20, 2023

I just saw the same thing (in 25). I don't see how shares can contain an array itself. 🤔

@kartoffelheinz
Copy link

This bug prevents certain events from syncing (from Apple devices, mostly fantastical) and had been fixed in early 26 beta but apparently has now been re-introduced. Unfortunate. Any idea on when this is going to be fixed again?

@Pazu
Copy link

Pazu commented Nov 5, 2023

Still seeing this running 27.1.3:

{
    "reqId": "[removed]",
    "level": 3,
    "time": "2023-11-05T17:35:11+00:00",
    "remoteAddr": "[removed]",
    "user": "[removed]",
    "app": "PHP",
    "method": "MOVE",
    "url": "/remote.php/dav/calendars/[removed]/[removed]/[GUID].ics",
    "message": "Array to string conversion at /var/www/path_to_web_root/apps/dav/lib/CalDAV/Activity/Backend.php#561",
    "userAgent": "iOS/17.0.3 (21A360) dataaccessd/1.0",
    "version": "27.1.3.2",
    "data": {
        "app": "PHP"
    },
    "id": "[removed]"
}

@solracsf
Copy link
Member

What if values are flatten before using the arrays, could this fix it?

$flatten = function ($array) use (&$flatten) {
	$result = [];
	foreach ($array as $value) {
		if (is_array($value)) {
			$result = array_merge($result, $flatten($value));
		} else {
			$result[] = $value;
		}
	}
	return $result;
};

$sourceShares = is_array($sourceShares) ? $flatten($sourceShares) : [];
$targetShares = is_array($targetShares) ? $flatten($targetShares) : [];

@jameskimmel
Copy link

Same error on 28.0.2


{
  "reqId": "removed",
  "level": 3,
  "time": "2024-02-21T11:07:11+00:00",
  "remoteAddr": "1.1.1.1",
  "user": "UserName1",
  "app": "PHP",
  "method": "MOVE",
  "url": "/remote.php/dav/calendars/UserName1/sitzungen_shared_by_UserName2/58B95D5D-32EA-490B-82E1-ADC31B854C3C.ics",
  "message": "Array to string conversion at /var/www/nextcloud/apps/dav/lib/CalDAV/Activity/Backend.php#561",
  "userAgent": "Mozilla/5.0 (iPad; CPU OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/121.0.6167.171 Mobile/15E148 Safari/604.1",
  "version": "28.0.2.5",
  "data": {
    "app": "PHP"
  },
  "id": "65defd55416b7"
}

@joshtrichards
Copy link
Member

Same solution as used in #43794 should work here (using array_map serialize/unserialize). I don't have a test setup for this, so I'll leave trying it to someone that feels like giving it a shot + can also reproduce this situation on-demand.

@joshtrichards joshtrichards removed their assignment Feb 28, 2024
@joshtrichards joshtrichards added the good first issue Small tasks with clear documentation about how and in which place you need to fix things in. label Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of 26-feedback 27-feedback 28-feedback bug feature: caldav Related to CalDAV internals feature: dav good first issue Small tasks with clear documentation about how and in which place you need to fix things in.
Projects
Status: 📄 To do
Development

No branches or pull requests

7 participants