dkd / php-cmis-client

This is a PHP CMIS Client implementation based on OpenCMIS. It has been retired and put in to archive mode.
Apache License 2.0
54 stars 34 forks source link

Extension properties are not properly ignored #67

Closed terescode closed 5 years ago

terescode commented 5 years ago

Currently when the php-cmis-client is parsing property definitions, if it receives a property in the type definition that it does not recognize, this causes an exception to be thrown. I noticed this when using php-cmis with a Filenet server that has the "isHidden" extension enabled. Here is a sample of the data returned from the browser binding.

"IndexationId": {
"id": "IndexationId",
"localName": "IndexationId",
"displayName": "Indexation Id",
"queryName": "IndexationId",
"description": "The object ID of the verity collection an object is stored into, or null for objects that were full text indexed prior to the 4.0 release.",
"propertyType": "id",
"cardinality": "single",
"updatability": "readonly",
"inherited": false,
"required": false,
"queryable": true,
"orderable": true,
"openChoice": false,
"isHidden": "false"
},

When php-cmis tries to parse this in the JSONConverter, it ends up in this code.

        array_intersect_key($data, array_fill_keys(JSONConstants::getPropertyTypeKeys(), 1)),
        $propertyDefinition->populate(
            $data,
            [JSONConstants::JSON_PROPERTY_TYPE_RESOLUTION => 'dateTimeResolution']
        );
        $propertyDefinition->setExtensions($this->convertExtension($data, JSONConstants::getPropertyTypeKeys()));

The pouplate() code ends up looking for a setter for isHidden in the determinePropertyAccessFunctionName method and since it cannot find one it throws an exception instead of ignoring it.

        if (empty($accessMethodNames)) {
            throw new AccessException(
                'No "' . $method . '" method(s) can be determined for property ' . $propertyName,
                1422021212
            );
        } 

Section 2.1.1.3 of the CMIS specification says the following about unrecognized repository features.

Clients that don’t understand this information SHOULD ignore it.