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,