Error Logs PHP - DAV CustomProperties

Support intro

Nextcloud version (eg, 20.0.5): Nextcloud AIO v8.1.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.2 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache , not find
PHP version (eg, 7.4): 8.2.17

Hello everyone,

I’m writing this topic today because I’m looking for help or ideas for solutions to a log error that appears periodically without me knowing why and potentially the effect it causes. I specify that no modification on my part has taken place in the config files.

This is the same message that has already appeared for several previous versions without me being able to resolve the problem, even after research on my part.

Here is the log in question:

[PHP] Error: unserialize(): Error at offset 48 of 51 bytes at /var/www/html/apps/dav/lib/DAV/CustomPropertiesBackend.php#463
PROPFIND /remote.php/dav/calendars/nolan/
from 172.22.0.1 by nolan at Apr 16, 2024, 7:54:42 PM

Looks like it concerns a calendar issue for a user but no certainty. And above all no malfunction noted at this level

Thank you in advance for everyone’s help !

Is there a user with username “nolan” on your cloud?

The error

[PHP] Error: unserialize(): Error at offset 48 of 51 bytes

occurs when PHP attempts to process a string to be unserialized that does not meet the requirements of the unserialize function. In this case, de-(un)serialization takes place in the decodeValueFromDatabase method. Here is a snippet of code relevant to de-(un)serialization in this case:

while ($row = $result->fetch()) {
     $props[$row['propertyname']] = $this->decodeValueFromDatabase($row['propertyvalue'], $row['valuetype']);
}

The decodeValueFromDatabase method is responsible for de-(un)serializing data from the database:

	/**
	 * @return mixed|Complex|string
	 */
	private function decodeValueFromDatabase(string $value, int $valueType) {
		switch ($valueType) {
			case self::PROPERTY_TYPE_XML:
				return new Complex($value);
			case self::PROPERTY_TYPE_HREF:
				return new Href($value);
			case self::PROPERTY_TYPE_OBJECT:
				return unserialize($value);
			case self::PROPERTY_TYPE_STRING:
			default:
				return $value;
		}
	}

As you can see, the unserialize function is only used, if the valuetype is “PROPERTY_TYPE_OBJECT”

At the top of that file you can see, that it is about the database table oc_properties and that PROPERTY_TYPE_OBJECT is the number “3”:

class CustomPropertiesBackend implements BackendInterface {

	/** @var string */
	private const TABLE_NAME = 'properties';

	/**
	 * Value is stored as string.
	 */
	public const PROPERTY_TYPE_STRING = 1;

	/**
	 * Value is stored as XML fragment.
	 */
	public const PROPERTY_TYPE_XML = 2;

	/**
	 * Value is stored as a property object.
	 */
	public const PROPERTY_TYPE_OBJECT = 3;

	/**
	 * Value is stored as a {DAV:}href string.
	 */
	public const PROPERTY_TYPE_HREF = 4;

The error occurs when the data stored in the database is corrupted or not in the expected format.

So now you can search in the database table ‘oc_properties’ for data from type 3:

SELECT * FROM oc_properties WHERE valuetype = 3;

With this information you should be able to find (and clean up) the incorrect data part.


Much and good luck,
ernolf

Hello to you,

First of all, thank you for your help. Honestly, I didn’t exactly understand everything but the main thing. In conclusion, I have an error to correct in my database, which is generating this log.
The problem is that I have no idea how to act on my given basis and how to go about it. In addition, being under nextcloud AIO, having already had to act on one of the dockers, the way of intervening on the different modules is different from the normal solution.

If you have any leads, I’m happy to take them.

Kind regards,

Moin,

ich klinke mich hier mal ein, habe ebenfalls oben genannten Fehler mit dem gleichen Error at offset 48 of 51 bytes.

Ich habe als Ergebnis der Datenbankabfrage folgenden Output bekommen:

nextcloud=# SELECT * FROM oc_properties WHERE valuetype = 3;
 id | userid |    propertypath    |    propertyname    |                    propertyvalue                    | valuetype 
----+--------+--------------------+--------------------+-----------------------------------------------------+-----------
 14 | sven   | calendars/sven/wir | {DAV:}resourcetype | O:35:"Sabre\DAV\Xml\Property\ResourceType":1:{s:8:" |         3
(1 row)

nextcloud=# 

Wie mache ich ab da weiter bzw wo liegt der Fehler?

Liebe Grüße aus dem Norden

Sven

1 Like

@esjott
Hi Sven,

ich würde mal sagen im Kalender “wir” von “sven”.

Wo das nun genau liegt sollst du ja jetzt heraus finden. Ich habe da keinen Zugriff drauf. :wink:


Viel Glück,
ernolf

Hello @esjott,

You seem to be in the same situation as me. Did you manage to understand and resolve your problem?
If so, I would like you to share your command lines with me with some information if possible, that would be super nice.

Sincerely,

Hi Menzaah,

sorry for posting in german last time - didn‘t think about it.

No, I didn‘t resolve it, I exported my calendars and moved them to baikal - no issues so far (using sqlite).

Hi,
Ah too bad… , thank you for your feedback in any case :slight_smile: