Skip to content

Cannot store complex custom Webdav property values + wrong values + Oracle failure #32670

Description

@PVince81

Steps

  1. Create a file "proppatch.xml" with the contents <?xml version="1.0" encoding="utf-8" ?><propertyupdate xmlns='DAV:'><set><prop><t:valnspace xmlns:t='http://example.com/neon/litmus/'><foo xmlns='http://bar'/></t:valnspace></prop></set></propertyupdate> which sets a complex value
  2. Create a folder "test" in the OC instance
  3. curl -k -D - -u admin:admin -X PROPPATCH -H "Content-Type: text/xml" --data-binary "@proppatch.xml" "http://localhost/owncloud/remote.php/webdav/test"
  4. Create a file "propfind.xml" with the contents <?xml version="1.0"?><a:propfind xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns"><a:prop><t:valnspace xmlns:t='http://example.com/neon/litmus/'/> </a:prop></a:propfind>
  5. curl -k -D - -u admin:admin -X PROPFIND -H "Content-Type: text/xml" --data-binary "@propfind-oracle.xml" "http://localhost/owncloud/remote.php/webdav/test"
  6. Check the "oc_properties" database table

Expected result

oc_properties table must contain <foo xmlns='http://bar'/> or something alike.
the PROPFIND response should contain <foo xmlns='http://bar'/>.

Actual result

With MySQL

oc_properties table contain the string "Object" as value.
the PROPFIND response contains <x1:valnspace xmlns:x1="http://example.com/neon/litmus/">Object</x1:valnspace>

With Oracle

PROPPATCH fails:


{"reqId":"u35FUAVYSNddV4jLeZoS","level":4,"time":"2018-09-10T20:50:17+00:00","remoteAddr":"172.18.0.4","user":"admin","app":"webdav","method":"PROPPATCH","url":"\/remote.php\/webdav\/litmus\/prop2","message":"Exception: An exception occurred while executing 'INSERT INTO \"oc_properties\" (\"fileid\",\"propertyname\",\"propertyvalue\") VALUES(?,?,?)' with params [123, \"{http:\\\/\\\/example.com\\\/neon\\\/litmus\\\/}valnspace\", {}]:\n\nORA-01008: not all variables bound: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\DriverException\",\"Message\":\"An exception occurred while executing 'INSERT INTO \\\"oc_properties\\\" (\\\"fileid\\\",\\\"propertyname\\\",\\\"propertyvalue\\\") VALUES(?,?,?)' with params [123, \\\"{http:\\\\\\\/\\\\\\\/example.com\\\\\\\/neon\\\\\\\/litmus\\\\\\\/}valnspace\\\", {}]:\\n\\nORA-01008: not all variables bound\",\"Code\":0,\"Trace\":\" #0 \\\/drone\\\/src\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(128): Doctrine\\\\DBAL\\\\Driver\\\\AbstractOracleDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\OCI8\\\\OCI8Exception))\\n #1 \\\/drone\\\/src\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(1015): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\OCI8\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\OCI8\\\\OCI8Exception), 'INSERT INTO \\\"oc...', Array)\\n #2 \\\/drone\\\/src\\\/lib\\\/private\\\/DB\\\/Connection.php(207): Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTO \\\"oc...', Array, Array)\\n #3 \\\/drone\\\/src\\\/apps\\\/dav\\\/lib\\\/DAV\\\/FileCustomPropertiesBackend.php(182): OC\\\\DB\\\\Connection->executeUpdate('INSERT INTO \\\"oc...', Array)\\n #4 \\\/drone\\\/src\\\/apps\\\/dav\\\/lib\\\/DAV\\\/AbstractCustomPropertiesBackend.php(206): OCA\\\\DAV\\\\DAV\\\\FileCustomPropertiesBackend->updateProperties('litmus\\\/prop2', Object(OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File), Array)\\n #5 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/PropPatch.php(317): OCA\\\\DAV\\\\DAV\\\\AbstractCustomPropertiesBackend->OCA\\\\DAV\\\\DAV\\\\{closure}(Array)\\n #6 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/PropPatch.php(245): Sabre\\\\DAV\\\\PropPatch->doCallBackMultiProp(Array, Object(Closure))\\n #7 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1265): Sabre\\\\DAV\\\\PropPatch->commit()\\n #8 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(385): Sabre\\\\DAV\\\\Server->updateProperties('litmus\\\/prop2', Array)\\n #9 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPropPatch(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n #10 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n #11 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PROPPATC...', Array)\\n #12 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n #13 \\\/drone\\\/src\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(64): Sabre\\\\DAV\\\\Server->exec()\\n #14 \\\/drone\\\/src\\\/remote.php(165): require_once('\\\/drone\\\/src\\\/apps...')\\n #15 {main}\",\"File\":\"\\\/drone\\\/src\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractOracleDriver.php\",\"Line\":76}"}
--

This is likely because the complex value cannot be converted to string properly, so some process in Doctrine attempts to transform it to string. In MySQL it becomes Object, with Oracle it becomes an empty string or the weird {} value in the query.

Version

ownCloud 10.0.10 RC1

Discovered while debugging Oracle Litmus failure with PROPPATCH, see #32639 (comment)

Not sure if this ever worked before.
I'm really surprised Litmus lets this pass for MySQL.

I suspect this never worked before as we never really tested with complex properties.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions