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 · 16 comments
Open
6 of 9 tasks

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

ChristophWurst opened this issue Mar 3, 2023 · 16 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

joshtrichards commented Feb 28, 2024

Same solution as used in #43794 should work here (using array_map serialize/unserialize different approach taken in the final merged PR, but same idea). 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
@prismopensource

This comment was marked as duplicate.

@Jolopu

This comment was marked as duplicate.

@joshtrichards

This comment was marked as resolved.

@Quake85
Copy link

Quake85 commented Oct 23, 2024

Also on my instance 30.0.1

What about a fix or update?

@Mer0me
Copy link

Mer0me commented Nov 5, 2024

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?

We actually have some events not syncing only on some users' Iphones. Could you please develop your observations. It could help us to figure out what happened to these events.
The Array to string error throws every time we move an event from a calendar to another. But there is no evident correlation between moved events and missing events on Iphones.

@guckuck
Copy link

guckuck commented Nov 7, 2024

I have this problem too. I just updated to 30.0.2. I will observe this problem ...

{
  "reqId": "removed",
  "level": 3,
  "time": "2024-11-05T05:39:20+00:00",
  "remoteAddr": "IP",
  "user": "user.name",
  "app": "PHP",
  "method": "MOVE",
  "url": "/remote.php/dav/calendars/user.name/personal/A2829EA6-94ED-4E01-8FAD-D1879CAA78BF.ics",
  "message": "Array to string conversion at /var/www/nextcloud/apps/dav/lib/CalDAV/Activity/Backend.php#541",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0",
  "version": "30.0.1.2",
  "data": {
    "app": "PHP"
  },
  "id": "..."
}

@thibs43
Copy link

thibs43 commented Nov 14, 2024

Hello,
Also got this error here, nextcloud server Nextcloud Hub 9 (30.0.2)
Client is on a Android phone syncing with calDav

[PHP] Error: Array to string conversion at /var/www/html/apps/dav/lib/CalDAV/Activity/Backend.php#541
	MOVE /remote.php/dav/calendars/---/personal/F3D54AEF-000-4D86-BB5A-D********75FAE.ics
	from 192.168.1.254 by *** at Nov 13, 2024, 10:13:11 PM

@Quake85
Copy link

Quake85 commented Nov 14, 2024

Yes, i also Updated to 30.0.2, Same Problem. Also fresh/new Installation in my testing environment.

Ist’s clear, that this is a bug.

So please dear developers clear this Problem.

Thanks a lot

@jameskimmel
Copy link

I know this does not help most of you guys, but I can only say that the issue is gone for me.

I updated to 30.0.2, reconfigured my NGINX reverse proxy to include this

    location /.well-known/carddav {
    return 301 $scheme://$host/remote.php/dav;
    }

    location /.well-known/caldav {
    return 301 $scheme://$host/remote.php/dav;
    }

and also installed the calender via profiles on my iPhone. Works perfect and nothing in the logs.

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