Giter VIP home page Giter VIP logo

jackalope-jackrabbit's Introduction

Jackalope Test application Static analysis

A powerful implementation of the PHPCR API.

You can use Jackalope with different storage backends. For now, we support:

  • relational databases with the DoctrineDBAL backend. Works with any database supported by doctrine (mysql, postgres, ...) and has no dependency on java or jackrabbit. For the moment, it is less feature complete. See jackalope-doctrine-dbal
  • Jackrabbit server backend supports many features and requires you to simply install a .jar file for the data store component. See jackalope-jackrabbit

Discuss on [email protected] or visit #jackalope on irc.freenode.net

License

This code is dual licensed under the MIT license and the Apache License Version 2.0. Please see the file LICENSE in this folder.

Install instructions

Go to the repository of the storage backend you want and follow the instructions there.

Implementation notes

See doc/architecture.md for an introduction how Jackalope is built. Have a look at the source files and generate the phpdoc.

Contributors

jackalope-jackrabbit's People

Contributors

alexander-schranz avatar beberlei avatar chirimoya avatar chregu avatar cordoval avatar damz avatar dantleech avatar dbu avatar dotzoki avatar ebi avatar exsio avatar justinrainbow avatar kea avatar lapistano avatar lsmith77 avatar mhor avatar middlebrain avatar nacmartin avatar nicam avatar niklasnatter avatar ornicar avatar parsingphase avatar pitpit avatar rndstr avatar seldaek avatar spras avatar uwej711 avatar vdrnn avatar wachterjohannes avatar wouterj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jackalope-jackrabbit's Issues

jackrabbit oak support

it would be nice to have a working setup with jackrabbit oak.

a first step would be to wire the jcr to davex libraries around oak. once the oak http api starts to exist, we could also work with that one.

adobe people told us that using the davex libraries should work. but there is no ready made .jar like for jackrabbit 2.x so it would need some investigating into the internals of oak and jackrabbit.

Not longer working with jackalope 1.3.6

The changes in jackalope/jackalope#351

seems to crash the sql2 query operations with aliases?

The following test is failing currently

1) PHPCR\Tests\Query\QuerySql2OperationsTest::testQueryFieldDate
PHPCR\RepositoryException: Attempting to get the path for a non existent selector: nt:unstructured

/private/tmp/jackalope-jackrabbit/vendor/jackalope/jackalope/src/Jackalope/Query/Row.php:208
/private/tmp/jackalope-jackrabbit/vendor/phpcr/phpcr-api-tests/tests/Query/QuerySql2OperationsTest.php:70

ERRORS!
Tests: 1866, Assertions: 8624, Errors: 1, Skipped: 62, Incomplete: 12.

Not sure whre this issue need to be fixed.

Request with too big header section is sent on big update

I am trying to run a migration, which updates a few properties on a lot of different nodes. If the session is not saved after every single node, I am seeing the following error in the jackrabbit log:

2015-08-12 08:56:30.861 ERROR [1447510073@qtp-1720435669-275] HttpMultipartPost.java:95 Error while processing multipart.
org.apache.commons.fileupload.FileUploadException: Header section has more than 10240 bytes (maybe it is not properly terminated)
    at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:381) ~[jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126) ~[jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.jackrabbit.server.util.HttpMultipartPost.extractMultipart(HttpMultipartPost.java:90) [jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.jackrabbit.server.util.HttpMultipartPost.<init>(HttpMultipartPost.java:54) [jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.jackrabbit.server.util.RequestData.<init>(RequestData.java:36) [jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.jackrabbit.server.remoting.davex.JcrRemotingServlet.doPost(JcrRemotingServlet.java:387) [jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.execute(AbstractWebdavServlet.java:354) [jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.service(AbstractWebdavServlet.java:291) [jackrabbit-standalone-2.8.0.jar:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.Server.handle(Server.java:326) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) [jackrabbit-standalone-2.8.0.jar:na]
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) [jackrabbit-standalone-2.8.0.jar:na]
Caused by: org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Header section has more than 10240 bytes (maybe it is not properly terminated)
    at org.apache.commons.fileupload.MultipartStream.readHeaders(MultipartStream.java:542) ~[jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.findNextItem(FileUploadBase.java:976) ~[jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:942) ~[jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331) ~[jackrabbit-standalone-2.8.0.jar:na]
    at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:349) ~[jackrabbit-standalone-2.8.0.jar:na]
    ... 25 common frames omitted

I have checked the request that is causing this error, and its body looks something like this:

--c48f09d2ebd7f565002cf6ed304f6d98
--c48f09d2ebd7f565002cf6ed304f6d98
[repeated 500 times]
Content-Disposition: form-data; name=":diff"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

+/jcr:versions/201507231648 : {"jcr:primaryType":"phpcrmig:version",}
^/cmf/candulor/contents/i18n:de_ch-excerpt-tags : []
^/cmf/candulor/contents/i18n:de_at-navContexts : []
[500 more lines]
--c48f09d2ebd7f565002cf6ed304f6d98--

The line with --c48f09d2ebd7f565002cf6ed304f6d98 at the beginning is written once for every single change, which probably causes the error from above. As far as I can see this is caused by this line:

$body .= $this->getMimePart($n, $v, $mime_boundary);

Will try to find out what exactly is causing this, and to provide a test case.

Path escape for query-builder

We have a quite strange problem currently in sulu. You can create a node in jackrabbit named test-10e but you cannot query this path with a ISCHILDNODE constraint because jackrabbit says that its not "valid".

The query:

SELECT node.[jcr:uuid] AS uuid FROM [nt:unstructured] AS node WHERE ISCHILDNODE(node, [/cmf/candulor/contents/news/test-10e])

The error:

message: "HTTP 400: Query: SELECT node.[jcr:uuid] AS uuid FROM [nt:unstructured] AS node WHERE ISCHILDNODE(node, [/cmf/candulor/contents/news/test-(*)10e])

If you rename the node to test-e it works without any problems.

@dbu @lsmith77 do you know something like that?

As an addition: in doctrine-dbal everything works. When we escape the pathes with " it works in jackrabbit but not in doctrine-dbal.

property and child node with same name - invalid json

in jcr 2.0, a node may have a property and a child node with both the same name. if you think of it in xml, it makes perfectly sense. if you look at it in the api its weird because the path is identical (as paths do not distinguish node and property).

<test toast="bar">
    <toast/>
</test>

the json coming back after putting such a structure into jackrabbit looks like this:

{"toast":"bar",":jcr:primaryType":"Name","jcr:primaryType":"nt:unstructured","toast":{}}

there is twice the key "toast", which is not legal in json. php json_decode just overwrites the property "toast" => "bar" with the node array "toast" => array().

on the jackrabbit mailinglist we found that jackrabbit parses json by hand and happens to handle this broken case. see http://www.mail-archive.com/[email protected]/msg28047.html

so either we can try to provide a fix in jackrabbit to have valid json, or make the php client parse the json in a way that handles this broken situation. trying to forbid the feature seems hardly doable to me, at least not without patching jackrabbit as well.

there is testSetPropertyNewExistingNode (deactivated in 12aae16 ) that demonstrates the problem.

joiz.de down because of Not a valid json object: exeception

Its not longer possible to use the admin tool and the frontend shows a error 500
Somehow an editor must have added content which broke the repository
I create a SSH tunnel to the remote repository and get the follwing exeception

Not a valid json object:
Request: POST http://localhost:8080/server/joiz/jcr:root/.0.json
Response:
{"nodes":{"/cms/content/news/postroyal-baby-erstes-familienfoto":{"title":"Royal Baby: Erstes Familienfoto","teaserTitle":"Royal Baby: Erstes Familienfoto","jcr:uuid":"ffb2f0f1-95b7-4eea-bb5c-567ec96bcd77",":jcr:mixinTypes":"Name","jcr:mixinTypes":["phpcr:managed","mix:referenceable"],"onPreview":false,"published":true,":updatedAt":"Date","updatedAt":"2013-08-20T13:52:03.000+02:00","body":"

© gettyimages

\r\n

Nein, das ist kein Cover eines Hochglanzmagazins, sondern ein stinknormales Familienfoto, geschossen im eigenen Garten vom Opa.

\r\n

Die Rede ist von Kate,

getNodeTypes should not go to backend on repeated calls

each call to get a specific node type does a request to jackrabbit. first calling $session->getWorkspace()->getNodeTypeManager()->getAllNodeTypes(); reduces that to a single call which is about the same speed (not very fast though, at least with magnolia).

in jackalope-doctrine-dbal, we have the CachedClient that uses a Doctrine\Common\Cache to cache meta data and other things. i think our best approach would be to convert this CachedClient to a pure decorator pattern, instead of extending a Client, and move it to jackalope/jackalope. then it can be used with jackalope-jackrabbit as well.

(moved here from jackalope/jackalope#312)

Client::getNodes() with localized path

I'm having trouble using getNodes() with localized node names. I've isolated the problem I think to Client.php. Here's an example of the problem:

This works:

$path = '/content/site/ja_JP';
$body[] = http_build_query(array($query => $path));

This doesn't:

$path = '/content/site/ja_JP/最新情報';
$body[] = http_build_query(array($query => $path));

I can otherwise access /content/site/ja_JP/最新情報 without problems. Here's how I'm calling into the code:

$parentId = '/content/site/ja_JP/最新情報';
$sql = "SELECT * FROM [cq:PageContent] WHERE ISDESCENDANTNODE([{$parentId}])";
// Doctrine\ODM\PHPCR\DocumentManager
$query = $documentManager->createQuery($sql, 'JCR-SQL2');
// $query is Doctrine\ODM\PHPCR\Query\Query
$queryResult = $query->execute();
// returns nothing

Looking further into it, $query->execute() calls \Doctrine\ODM\PHPCR\DocmentManager::getDocumentsByPhpcrQuery which successfully gets the list of IDs of child nodes. It then calls findMany() where we have this line:

$nodes = $this->session->getNodes($ids);

$this->session is Jackalope\Session

Eventually we get to NodePathIterator::loadBatch which calls ObjectManager::getNodesByPathAsArray() where we have:

$data = $this->transport->getNodes($fetchPaths);

And that's the getNodes() where I'm having a problem.

So, all that to say, I think I understand the problem as an encoding issue, however, I'm not sure where the lack of encoding is happening. Can someone help me out?

Performance issues

I am seeing very slow query times when using Jackrabbit as the back-end for my PHPCR driven content site. Rendering a single block triggers 9 queries which take 4-5ms each, resulting in a total of 50ms. If I would fill my site with menu's, content and other blocks, it reaches 300ms! Is there any way I can improve this without moving away from PHPCR?

I am running Jackrabbit 1.12.2 standalone on a SSD drive, using the default repository.xml.

Can't remove a node with a space in the node name

The following code is throwing an exception during the session save:

if ($session->itemExists('/data/node/new node')) {
    $session->removeItem('/data/node/new node');
    $session->save();
}

The error:
PHP Fatal error: Uncaught exception 'PHPCR\PathNotFoundException' with message 'HTTP 409: /data/node/new%20node'

Issues removing nodes with spaces

I created 3 test nodes "/test node", "/test%20node1" and "/testnode23".
All 3 nodes created fine and displayed exactly as named.
"/test%20node1" and "testnode23" deleted just fine.
"/test node" gives the following error when trying to delete:

HTTP 409: /test%20node
500 Internal Server Error - PathNotFoundException

jsop and mixin types

there seems to be some bug with the handling of mixin types. i got it when running the phpcr-odm test suite:

PHPCR\NodeType\ConstraintViolationException: HTTP 409: no matching property definition found for {http://www.doctrine-project.org/projects/phpcr_odm}class

...phpcr-odm/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Request.php:522
...phpcr-odm/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Request.php:459
...phpcr-odm/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Request.php:353
...phpcr-odm/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Client.php:1517
...phpcr-odm/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php:788
...phpcr-odm/vendor/jackalope/jackalope/src/Jackalope/Session.php:386
...phpcr-odm/lib/Doctrine/ODM/PHPCR/UnitOfWork.php:1130
...phpcr-odm/lib/Doctrine/ODM/PHPCR/DocumentManager.php:696
...phpcr-odm/tests/Doctrine/Tests/ODM/PHPCR/Functional/FolderTest.php:37

POST /server/tests/jcr:root/ HTTP/1.1
Authorization: Basic YWRtaW46YWRtaW4=
Host: 127.0.0.1:8080
Accept: */*
Depth: 0
Content-Type: multipart/form-data; boundary=001e4b7ca5eac0c6fc1e763a4b98a743
User-Agent: jackalope-php/1.0
Content-Length: 2167

--001e4b7ca5eac0c6fc1e763a4b98a743
--001e4b7ca5eac0c6fc1e763a4b98a743
Content-Disposition: form-data; name="/functional/folder/jcr:mixinTypes"
Content-Type: jcr-value/name; charset=UTF-8
Content-Transfer-Encoding: 8bit

phpcr:managed
--001e4b7ca5eac0c6fc1e763a4b98a743
--001e4b7ca5eac0c6fc1e763a4b98a743
Content-Disposition: form-data; name="/functional/folder/file/jcr:mixinTypes"
Content-Type: jcr-value/name; charset=UTF-8
Content-Transfer-Encoding: 8bit

phpcr:managed
--001e4b7ca5eac0c6fc1e763a4b98a743
--001e4b7ca5eac0c6fc1e763a4b98a743
Content-Disposition: form-data; name="/functional/folder/file/jcr:content/jcr:mixinTypes"
Content-Type: jcr-value/name; charset=UTF-8
Content-Transfer-Encoding: 8bit

phpcr:managed
--001e4b7ca5eac0c6fc1e763a4b98a743
Content-Disposition: form-data; name="/functional/folder/file/jcr:content/jcr:data"; filename="/functional/folder/file/jcr:content/jcr:data"
Content-Type: jcr-value/binary; charset=UTF-8
Content-Transfer-Encoding: binary

Lorem ipsum dolor sit amet
--001e4b7ca5eac0c6fc1e763a4b98a743
Content-Disposition: form-data; name="/functional/folder/file/jcr:content/jcr:lastModified"
Content-Type: jcr-value/date; charset=UTF-8
Content-Transfer-Encoding: 8bit

2012-03-19T10:27:10.000+01:00
--001e4b7ca5eac0c6fc1e763a4b98a743
Content-Disposition: form-data; name=":diff"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

+/functional/folder : {"jcr:primaryType":"nt:folder","phpcr:class":"Doctrine\\ODM\\PHPCR\\Document\\Folder",}
^/functional/folder/jcr:mixinTypes : []
+/functional/folder/file : {"jcr:primaryType":"nt:file","phpcr:class":"Doctrine\\ODM\\PHPCR\\Document\\File",}
^/functional/folder/file/jcr:mixinTypes : []
+/functional/folder/file/jcr:content : {"jcr:primaryType":"nt:resource","phpcr:class":"Doctrine\\ODM\\PHPCR\\Document\\Resource","jcr:uuid":"a0bd4a9e-65b7-447d-8327-002540208a0e","jcr:mimeType":"application\/octet-stream",}
^/functional/folder/file/jcr:content/jcr:mixinTypes : []
^/functional/folder/file/jcr:content/jcr:data :
^/functional/folder/file/jcr:content/jcr:lastModified :
--001e4b7ca5eac0c6fc1e763a4b98a743--

Wrong workspace in answer from server: <?xml version="1.0" encoding="UTF-8" standalone="no"?>

I am running Jackrabbit under Tomcat after following this https://github.com/jackalope/jackalope/wiki/Running-jackrabbit-in-tomcat-with-mysql

My Jackrabbit server is running normally and can be accessed at url: http://localhost:8080/jackrabbit/repository/default however when I run a command from the command line or access a page on the site I am getting this error.

[PHPCR\RepositoryException]
  Wrong workspace in answer from server: <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <D:multistatus xmlns:D="DAV:"><D:response><D:href>http://localhost:8080/jackrabbit/repository/default/</D:href><D:propstat><D:prop><D:workspace/><dcr:workspaceName xmlns:dcr="http://www.day.com/jcr/webdav/1.0"/></D:prop><D:status>HTTP/1.1 404 Not Found</D:stat
  us></D:propstat></D:response></D:multistatus>

The cmf-sandbox also gives me this same error so that should rule out any user error.

Bad performance quering thousands of nodes

Because there is no SELECT COUNT(*) in jackrabbit sql/sql2 or something similar in xpath, I'm forced to use something like this: SELECT [jcr:score] FROM [foo:bar] and count the result.

If there are thousands of foo:bar nodes, the performance is terrible. Jackrabbit emits multi megabyte xml quick, but jackalope-jackrabbit is doing a bad job parsing such big xml chunks.

For testing I have created 20,000 Nodes with a snippet like that:

$session = ...
$rootNode = $session->getRootNode();
$childNode = $rootNode->addNode("childnode");

for ( $i = 0; $i < 20000; $i++ ) {
  $childNode->addNode(uniqid());
}

$session->save();

Counting the nodes with something like that ...

$session = ...
$ws = $session->getWorkspace();
$qm = $ws->getQueryManager();
$q = $qm->createQuery("SELECT [jcr:score] FROM [nt:unstructured]", "JCR-SQL2");
$total = iterator_count($q->execute());

... lasted about 68 seconds on my machine.

The reason for this bad performance is in file vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Client.php line 963 (current master branch):

foreach ($dom->getElementsByTagName('response') as $row) {

With the following patch, the counting time decreased from about 68 seconds to 1-2 seconds.

--- Client.php<>2017-02-08 17:58:47.000000000 +0100
+++ Client.php<>2017-02-13 15:10:23.348170771 +0100
@@ -958,9 +958,10 @@
.
         $dom = new DOMDocument();
         $dom->loadXML($rawData);
+        $domXpath = new \DOMXPath($dom);
.
         $rows = array();
-        foreach ($dom->getElementsByTagName('response') as $row) {
+        foreach ($domXpath->query('D:response') as $row) {
             $columns = array();
             foreach ($row->getElementsByTagName('column') as $column) {
                 $sets = array();

Please note, I'm not a php xml expert. This is a random fix based on google research.

Undefined Index in ObjectManager

I have initialized a Repository with following tree. Between initialize the tree and the rest i have added:

        $session->save();
        $session->refresh(false);

When i delete now /cmf/default/routes/test i get changing exceptions like:

  • Undefined index: /cmf/default/routes/de/test/news-2/sub-1
  • Undefined index: /cmf/default/routes/de/test/news-2/sub-2
  • Undefined index: /cmf/default/routes/de/test/news-1/sub-1
  • Undefined index: /cmf/default/routes/de/test/news-1/sub-2

the same exceptions i get when i purge the workspace:

        if (isset($this->session)) {
            NodeHelper::purgeWorkspace($this->session);
            $this->session->save();
        }

in the ObjectManager:

    public function isNodeDeleted($absPath)
    {
        return array_key_exists($absPath, $this->nodesRemove)
1675:    && ! ((array_key_exists($absPath, $this->nodesAdd))
                || $this->nodesAdd[$absPath]
                || $this->getMoveSrcPath($absPath))
            ;
    }

bildschirmfoto 2014-05-26 um 17 33 13

if line 1675 is false the next line will be executed and will fail because nodesAdd has no key $absPath

/cmf
-- /default
---- /routes
------ /news
-------- /news-1
---------- /sub-1
---------- /sub-2
-------- /news-2
---------- /sub-1
---------- /sub-2
------ /test
-------- /news-1
---------- /sub-1
---------- /sub-2
-------- /news-2
---------- /sub-1
---------- /sub-2

Stacktrace:

PHPUnit_Framework_Error_Notice : Undefined index: /cmf/default/routes/de/test/news-2/sub-2
#0 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php(1676): PHPUnit_Util_ErrorHandler::handleError(8, 'Undefined index...', '/Users/johannes...', 1676, Array)
#1 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Node.php(152): Jackalope\ObjectManager->isNodeDeleted('/cmf/default/ro...')
#2 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Node.php(1274): Jackalope\Node->parseData(Object(stdClass), true, false)
#3 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Item.php(589): Jackalope\Node->refresh(false)
#4 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Node.php(802): Jackalope\Item->checkState()
#5 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php(1169): Jackalope\Node->getIdentifier()
#6 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php(1197): Jackalope\ObjectManager->performNodeRemove('/cmf/default/ro...', Object(Jackalope\Node), true, true)
#7 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php(1262): Jackalope\ObjectManager->cascadeDelete('/cmf')
#8 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Item.php(414): Jackalope\ObjectManager->removeItem('/cmf')
#9 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Node.php(1306): Jackalope\Item->remove()
#10 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpcr/phpcr-utils/src/PHPCR/Util/NodeHelper.php(84): Jackalope\Node->remove()
#11 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/sulu/test-bundle/Sulu/Bundle/TestBundle/Testing/PhpcrTestCase.php(150): PHPCR\Util\NodeHelper::purgeWorkspace(Object(Jackalope\Session))
#12 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/Framework/TestCase.php(843): Sulu\Bundle\TestBundle\Testing\PhpcrTestCase->tearDown()
#13 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/Framework/TestResult.php(686): PHPUnit_Framework_TestCase->runBare()
#14 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/Framework/TestCase.php(754): PHPUnit_Framework_TestResult->run(Object(Sulu\Component\Content\Rlp\Strategy\PhpcrMapperTest))
#15 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#16 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(425): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#17 /usr/local/php5-5.4.20-20130930-105609/lib/php/PHPUnit/TextUI/Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#18 /private/var/folders/pd/j71nctrj4nb56hznrrz4v32w0000gn/T/ide-phpunit.php(268): PHPUnit_TextUI_Command->run(Array, true)
#19 /private/var/folders/pd/j71nctrj4nb56hznrrz4v32w0000gn/T/ide-phpunit.php(506): IDE_Base_PHPUnit_TextUI_Command::main()
#20 {main}

Problem with properties of frozen nodes from linear predecessors

The versioning code of the phpcr tutorial is not working with jackalope-jackrabbit as backend.

The third line of this code:

...
$version = $versionManager->checkin($node->getPath());
$oldversion = $version->getLinearPredecessor();
echo $oldversion->getName() . ': ' . $oldversion->getFrozenNode()->getPropertyValue('foo'); // jcr:rootVersion: fafa

throws the following error:

Uncaught exception 'PHPCR\PathNotFoundException' with message 'Property foo in /jcr:system/jcr:versionStorage/5e/95/2c/5e952c4f-33fc-4f96-9f2b-41ede6026222/jcr:rootVersion/jcr:frozenNode' in /path/to/jackalope-jackrabbit/vendor/jackalope/jackalope/src/Jackalope/Node.php:628

It could be interesting to write a test about that...

Converts Double props with integer values to Long

PHPCRSH > node:prop:set foobar 10 --type Double
PHPCRSH > ls
+-----------------+-----------------+-----------------+
| jcr:primaryType | NAME            | nt:unstructured |
| foobar          | DOUBLE          | 10              |
+-----------------+-----------------+-----------------+
PHPCRSH > save
PHPCRSH > ls
+-----------------+-----------------+-----------------+
| jcr:primaryType | NAME            | nt:unstructured |
| foobar          | LONG            | 10              |
+-----------------+-----------------+-----------------+

Given two concurrent write attempts to a same node (using different sessions), will one fail?

[ Repost of this SO (I asked the question). Want the library author's opinion on this one. ]

Hi,

I've recently got hooked onto JCR and the promise it holds for content management and delivery to websites. Consequently, I've started spending time with Apache's Jackrabbit. I've been writing general abstractions on top of the Jackalope and I'm thinking of using only Jackrabbit for content store and delivery for all my future web-projects.

A nice feature of Jackrabbit is concurrency control.

My questions are,

  • Suppose if there were two or more concurrent write/edit attempts using different sessions on the same node, would they all succeed?
  • Or, only the first one writes and all other 'threads' or 'processes' throw an exception?
  • Assuming that a node is locked, would it be a good idea to write a loop that checks back every 50ms to see if the lock still holds & write if it does not?
  • Assuming nothing of that sort had to be done and Jackrabbit handled all incoming concurrent write/edit requests natively, am I right in my understanding that data will be written in a 'first-come-first-write' manner, so that data that has come of the thread that writes/edits in the end will supersede all other data?

For those who have expertise with Jackalope, I go into a little bit more detail,

/* 1. Create node */
$node = $session->getNode('/data/sibling');
$node->addMixin('mix:lockable');
$session->save();

/* 2. Initialise lock manager */
$workspace   = $session->getWorkspace(); // get the lock manager
$lockManager = $workspace->getLockManager();
// $lockManager->isLocked('/data/sibling') should be false
$lockManager->lock('/data/sibling', true, true); // lock child nodes as well
// $lockManager->isLocked('/data/sibling') should be true
// $lockManager->isLocked('/data/sibling/child1') should be true

// now only this session may change the node //sibling and its descendants

/* 3. Write/Edit something than unlock */
$lockManager->unlock('/data/sibling');
// $lockManager->isLocked('/data/sibling') should be false again

Suppose there was a write/edit request from a different session between step 2 and 3 when the node is locked -

  • Would it fail and throw an exception?
  • Would it keep waiting for the lock to open up?
  • Would Jackrabbit handle it on it's own writing in a 'first-come-first-write' manner?

Thanks a bunch,

dbx834

"Problem (2) in the Chunked-Encoded data" while performing a CURL request

Hello

I've stumbled on a weird error lately. I've switched my computer to a newer model and started experiencing weird random behaviours when interacting with Jackrabbit. Sometimes (without a particular reason), when a CURL request is dispatched to my local Jackrabbit, this exception is thrown:

PHPCR\RepositoryException
Message: Not a valid json object: 
Request: POST http://localhost:7400/server/[repo_name]/jcr:root/.0.json 
Response: 

It turns out, that the response returned by CURL is a boolean(false). Tracking the latest curl_error associated with the problematic handle revealed a cryptic error msg:

Problem (2) in the Chunked-Encoded data

Don't know, if anyone else had a problem like that. It turned out, that the solution is simple. All it takes for CURL to start behaving normally is adding a new option to CURL handle:

$curl->setopt(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);

in

Jackalope\Transport\Jackrabbit\Request::singleRequest(436)

This option changes the HTTP version from 1.1 to 1.0. From my experience that did not break antyhing, but I can't be sure. I dont know what is causing this error - is it my NIC driver or something else... on my teammates computer everything looks fine. Any ideas? Thoughts?

compatible problem with PHPCR

I am having below composer. While I am tring to update the package I am getting this fatal error.

Composer.json

 "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1.*@stable",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.1.x-dev",      
        "twig/extensions": "1.0.*@dev",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.1.*",
        "symfony/monolog-bundle": "2.1.*",
        "sensio/distribution-bundle": "2.1.*",
        "sensio/framework-extra-bundle": "2.1.*",
        "sensio/generator-bundle": "2.1.*",
        "jms/security-extra-bundle": "dev-master",
        "jms/di-extra-bundle": "dev-master",
        "kriswallsmith/assetic": "1.1.*@dev",
        "doctrine/doctrine-fixtures-bundle": "dev-master",
        "doctrine/data-fixtures": "dev-master",
        "doctrine/migrations": "dev-master",
        "doctrine/doctrine-migrations-bundle": "dev-master",
        "friendsofsymfony/user-bundle": "dev-master",
        "stof/doctrine-extensions-bundle": "dev-master",
        "phpcr/phpcr": "2.1.0-beta8",
        "doctrine/phpcr-odm": "dev-master",
        "doctrine/phpcr-bundle": "dev-master",
        "phpcr/phpcr-api-tests": "dev-master",
        "jackalope/jackalope-jackrabbit": "1.0.x-dev",
        "jackalope/jackalope-doctrine-dbal": "1.0.x-dev",
        "phpcr/phpcr-utils": "1.0-beta4",
        "ext-midgard2": ">=10.05.6",
        "symfony-cmf/core-bundle": "1.0.x-dev",
        "symfony-cmf/content-bundle": "dev-master",
        "symfony-cmf/menu-bundle": "dev-master",
        "symfony-cmf/block-bundle": "dev-master",
        "symfony-cmf/routing-extra-bundle": "dev-master",
        "sonata-project/block-bundle": "dev-master",
        "symfony-cmf/routing": "dev-master",
        "symfony-cmf/tree-bundle": "dev-master",
        "symfony-cmf/tree-browser-bundle": "dev-master",
        "friendsofsymfony/jsrouting-bundle": "dev-master",
        "symfony-cmf/symfony-cmf": "dev-master",
        "symfony-cmf/simple-cms-bundle": "dev-master",
        "symfony-cmf/create-bundle": "dev-master",
        "midgard/createphp": "dev-master",
        "friendsofsymfony/rest-bundle":  "dev-master",
        "jms/serializer": "dev-master",
        "phpcollection/phpcollection": "dev-master",
        "jms/serializer-bundle":  "dev-master", 
        "sonata-project/jquery-bundle": "dev-master",
        "sonata-project/exporter": "dev-master",
        "sonata-project/doctrine-phpcr-admin-bundle": "dev-master",
        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle":  "dev-master",
        "sonata-project/cache-bundle":  "dev-master",
        "sonata-project/intl-bundle":  "dev-master",
        "sonata-project/user-bundle": "dev-master",
        "sonata-project/doctrine-extensions": "dev-master",
        "sonata-project/easy-extends-bundle": "dev-master",
        "sonata-project/google-authenticator": "dev-master",
        "jms/payment-core-bundle": "master-dev",
        "ornicar/gravatar-bundle" : "dev-master",
        "knplabs/knp-paginator-bundle": "dev-master",
        "vich/uploader-bundle": "dev-master",
        "liip/imagine-bundle": "dev-master",
        "knplabs/gaufrette":"0.2.*@dev",
        "knplabs/knp-gaufrette-bundle" : "dev-master",
        "doctrine/common":">=2.3-dev"
    },

Error that I am getting

PHP Fatal error:  Declaration of Jackalope\Session::getNode() must be compatible with that of PHPCR\SessionInterface::getNode() in /var/www/contest/vendor/jackalope/jackalope/src/Jackalope/Session.php on line 39

I can't use dev-master for phpcr, because I am getting other conflicting error with other packages. So How can I resolve this issue. Help me out

Very long pause when running intensive tests

I have noticed that with both PHPCR Shell and the Sulu CMF that when running a large series of functional tests involving the Jackrabbit implementation, the system will lock-up at the same point for maybe 5 minutes and then resume.

The point that the system locks up depends on where the tests start, so it seems this happens after a certain number of operations and does not seem to be related to any operation in particular.

Can't query user defined date properties

Start phpcr shell and send the following commands:

PHPCRSH > touch dateProp 2017-02-01 --type=Date
PHPCRSH > save
PHPCRSH > q "SELECT dateProp FROM rep:root" -l sql
[PHPCR\RepositoryException] Cannot convert a date that is not a \DateTime instance to string

The above exception is throwed by
vendor/phpcr/phpcr-utils/src/PHPCR/Util/ValueConverter.php:156

The save command sends the follwing request to jackrabbit:

POST /jackrabbit/server/default/jcr:root/ HTTP/1.1
Authorization: Basic YWRtaW46YWRtaW4=
Host: localhost:8080
Accept: */*
Depth: 0
Content-Type: multipart/form-data; 
boundary=9921e60822b4ae6af62b5476e4f6d50b
User-Agent: jackalope-php/1.0
Content-Length: 410

--9921e60822b4ae6af62b5476e4f6d50b
Content-Disposition: form-data; name="/dateProp"
Content-Type: jcr-value/date; charset=UTF-8
Content-Transfer-Encoding: 8bit

2017-02-01T00:00:00.000+02:00
--9921e60822b4ae6af62b5476e4f6d50b
Content-Disposition: form-data; name=":diff"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

^/dateProp :.
--9921e60822b4ae6af62b5476e4f6d50b--

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Mon, 06 Feb 2017 07:39:36 GMT

This looks correct to me.

And here the relevant part of the response from jackrabbit as anwer to the sql query:

...
  <dcr:column>
    <dcr:name>dateProp</dcr:name>
    <dcr:value dcr:type="String">2017-02-01T00:00:00.000+02:00</dcr:value>
  </dcr:column>
...

IMHO, the dcr:type should be "Date", not "String". That's the reason for the throwed Exception.

Tested with jackrabbit 2.10.1 and 2.14.0.

The question is: Who's to blame? Jackrabbit or PHPCR / Jackalope? Or do I miss something?

implement getting multiple nodes by uuid

adjust jackrabbit to be able to fetch multiple nodes by uuid, as we can by path now.
#34 adjusts the code to shift the responsibility to the transport.

@chregu can you provide your jackrabbit code here when you find it? if it does not exist, could you dig up the original patch you wrote for fetching multiple nodes by path? this one will look similar.

Workspace import does not work with protected version properties

I have a workspace and versioned some nodes in it. When I now export the workspace with the command app/console doctrine:phpcr:workspace:export -p /cmf test.xml and try to reimport it with app/console doctrine:phpcr:workspace:import -p / test.xml I get the following error:

  [PHPCR\NodeType\ConstraintViolationException]
  HTTP 409: Unable to perform operation. Node is protected.

My guess was that this is because of the additional version fields, and I can confirm that. I have deleted all jcr:baseVersion, jcr:isCheckedOut, jcr:predecessors and jcr:versionHistory properties from the XML, and the import was working without any troubles afterwards.

I have seen that the nodes are created via the PHPCR API. Is that a good idea? There seems to be a ProtectedPropertyImporter, which sounds like something that might work.

Query features

Hello,

I was wondering if using Jackalope QOM implementation one can:

Background: I have linked my content-backend (JCR) with the Angular-React Grid http://josebalius.github.io/ngReactGrid/ using Jackalope and a Restful API. The API has hooks for search, ordering, downloading data (in CSV/XLS/PDF generated using FOP), pagination, CRUD operations (wip) and filtering (wip).

Total number of rows (nodes) would help in pagination. Right now I'm storing total 'row' count in a property in the direct ancestor node.

Row index would help make the table look nicer. Right now, I'm using $offset variable to get the current row index.

My class method for dynamically querying using QOM follows

public function query($requestDefinition){

        /** Variables for return & the root node */
        $return     =   FALSE;
        $root       =   $this->session->getNode('/');
        $parentNode =   $requestDefinition['query'];

        /** Proceed only if query node exists and we have columns to read */
        if( ($root->hasNode($requestDefinition['query'])) && isset($requestDefinition['configuration']['columns'])){

            /** Get end point from query */
            $exploded       =   explode('/', $parentNode);
            $endPoint       =   end($exploded);

            /** Make limit and offset */
            $limit          =   isset($requestDefinition['configuration']['limit'])?(int)$requestDefinition['configuration']['limit']:25;
            $offset         =   isset($requestDefinition['configuration']['offset'])?(int)$requestDefinition['configuration']['offset']:0;

            /** Make orderBy and order */
            $orderBy        =   isset($requestDefinition['configuration']['order']['column'])?$requestDefinition['configuration']['order']['column']:false;
            $order          =   isset($requestDefinition['configuration']['order']['order'])?strtoupper($requestDefinition['configuration']['order']['order']):'ASC';

            /** Start a query builder */
            $queryFactory   =   $this->session->getWorkspace()->getQueryManager()->getQOMFactory();
            $queryBuilder   =   NEW QueryBuilder($queryFactory);

            /** Query builder step 1. Add source */
            $queryBuilder->from($queryFactory->selector($endPoint, 'nt:unstructured'));

            /** Query builder step 2. Add parent */
            $queryBuilder->where($queryFactory->descendantNode($endPoint, "/$parentNode"));

            /** Query builder step 3. Add limit and offset */
            $queryBuilder->setMaxResults($limit)->setFirstResult($offset);

            /** Query builder step 4. Add order if we have to */
            if($orderBy){
                $queryBuilder->orderBy($queryFactory->propertyValue($endPoint, $orderBy), $order);
            }

            /** Try to execute query */
            try {
                $queryResult    =   $queryBuilder->execute();
                $problem        =   FALSE;  
            } 
            catch (Exception $e) {
                x_error_log("[Repository query error] $e");
                $return         =   'there was an error executing the query. it has been logged';
                $problem        =   TRUE;
            }

            /** Move forward if no problem */
            if(!$problem){

                /** Get columns */
                $columns        =   $requestDefinition['configuration']['columns'];

                /** Reset return variable */
                $return         =   ARRAY();

                /** Iterate over nodes */
                foreach ($queryResult->getNodes() as $node) {

                    /** Check once if all requested columns exist. If they dont, break out of the foreach loop */
                    if(!$this->checkAllRequestedColumnsExist($node, $columns)){
                        $return     =   "one or more requested columns do/es not exist";
                        break;
                    }

                    /** Node to row */
                    $row        =   ARRAY();

                    /** Get all properties */
                    foreach($columns as $index => $propertyName){
                        $row[$propertyName]     =    $node->getPropertyValue($propertyName);
                    }

                    /** Push to return variable */
                    $return[]   =   $row;
                }
            }
        }

        /** Parent node does not exist */
        else{
            $return =   "parent node $parentNode does not exist!";
        }

        /** Return result */
        RETURN $return;
    }

Best
/dbx834

Asyncronicity issues with jackrabbit

We are seeing some edge-case async issues when updating the jackrabbit CR and then within 100ms requesting the updated data from another session.

Sometimes the updated data is not found, other times it is.

Waiting for at least 100ms "solves" this issue.

Is this something known?

LogicException: Tried to start a request on a closed transport.

I am getting this error after updating to Symfony 3 but really not sure what is happening, here is my stack trace:

/var/www/current/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Client.php:286
/var/www/current/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Client.php:494
/var/www/current/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php:201
/var/www/current/vendor/jackalope/jackalope/src/Jackalope/Session.php:273
/var/www/current/vendor/jackalope/jackalope/src/Jackalope/Session.php:204
/var/www/current/vendor/phpcr/phpcr-utils/src/PHPCR/Util/NodeHelper.php:72
/var/www/current/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php:75
/var/www/current/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php:136
/var/www/current/vendor/doctrine/phpcr-bundle/DataFixtures/PHPCRExecutor.php:54
/var/www/current/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php:65
/var/www/current/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php:76
/var/www/current/vendor/symfony-cmf/testing/src/Functional/DbManager/PHPCR.php:89

using these packages:

    "symfony/symfony": "~3",
    "doctrine/migrations": "~1",
    "doctrine/doctrine-migrations-bundle": "~1",
    "doctrine/phpcr-bundle": "1.3.*",
    "doctrine/phpcr-odm": "1.3.*",

    "jackalope/jackalope-jackrabbit": "~1",

    "sonata-project/admin-bundle": "~3",
    "sonata-project/doctrine-extensions": "~1",
    "sonata-project/doctrine-phpcr-admin-bundle": "dev-master",
    "sonata-project/doctrine-orm-admin-bundle": "~3"

Response says forbidden on Jackrabbit >= 2.12.4

We are currently having the following issue in Sulu: sulu/sulu-standard#756

Just for reference I am showing the error also in this Issue:

[PHPCR\RepositoryException]
          Unexpected error:
          CURL Error:
          Response (HTTP 403): POST
          --uri: --
          array (
            0 => 'http://localhost:8080/server/default/jcr:root/',
          )
          --curl getinfo: --
          array (
            'url' => 'http://localhost:8080/server/default/jcr:root/',
            'content_type' => 'text/html; charset=iso-8859-1',
            'http_code' => 403,
            'header_size' => 165,
            'request_size' => 7846,
            'filetime' => -1,
            'ssl_verify_result' => 0,
            'redirect_count' => 0,
            'total_time' => 0.002591,
            'namelookup_time' => 1.7E-5,
            'connect_time' => 0.000165,
            'pretransfer_time' => 0.000192,
            'size_upload' => 7588.0,
            'size_download' => 1389.0,
            'speed_download' => 536086.0,
            'speed_upload' => 2928598.0,
            'download_content_length' => 1389.0,
            'upload_content_length' => 7588.0,
            'starttransfer_time' => 0.0025690000000000001,
            'redirect_time' => 0.0,
            'redirect_url' => '',
            'primary_ip' => '::1',
            'certinfo' =>
            array (
            ),
            'primary_port' => 8080,
            'local_ip' => '::1',
            'local_port' => 64122,
          )
          --request body (size: 7588 bytes): --
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n:en-created"
          Content-Type: jcr-value/date; charset=UTF-8
          Content-Transfer-Encoding: 8bit
          2016-11-16T10:10:21.000+00:00
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n:en-changed"
          Content-Type: jcr-value/date; charset=UTF-8
          Content-Transfer-Encoding: 8bit
          2016-11-16T10:10:21.000+00:00
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n:en-published"
          Content-Type: jcr-value/date; charset=UTF-8
          Content-Transfer-Encoding: 8bit
          2016-11-16T10:10:21.000+00:00
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n:de-seo-title"
          Content-Type: jcr-value/string; charset=UTF-8
          Content-Transfer-Encoding: 8bit
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n:de-seo-description"
          Content-Type: jcr-value/string; charset=UTF-8
          Content-Transfer-Encoding: 8bit
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n:de-seo-keywords"
          Content-Type: jcr-value/string; charset=UTF-8
          Content-Transfer-Encoding: 8bit
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n:de-seo-canonicalUrl"
          Content-Type: jcr-value/string; charset=UTF-8
          Content-Transfer-Encoding: 8bit
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n:de-seo-noIndex"
          Content-Type: jcr-value/boolean; charset=UTF-8
          Content-Transfer-Encoding: 8bit
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n:de-seo-noFollow"
          Content-Type: jcr-value/boolean; charset=UTF-8
          Content-Transfer-Encoding: 8bit
          --07d542fbc64b7d5ee6f9362454e670f5
          Content-Disposition: form-data; name="/cmf/sulu_io/contents/i18n
           (truncated)
          --response body (size: 1389 bytes): --
          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
          <title>Error 403 FORBIDDEN</title>
          </head>
          <body><h2>HTTP ERROR 403</h2>
          <p>Problem accessing /server/default/jcr:root/. Reason:
          <pre>    FORBIDDEN</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>

          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          <br/>
          </body>
          </html>
          --end response body--

The strange thing is that creating workspaces with $workspace->createWorkspace and registering node types works, but as soon as $session->save is called I am getting the previous error.

I have digged deeper into it, and realized that there was only one change, which fixed this issue. It's about CSRF, so the 403 could be related to that error.

Is there a token or something missing the request?

Can't remove the protected property: jcr:created

After adding the mixin mix:created to a node I get this exception when the odm tries to set the value to null; obviously jackrabbit does not allow to remove that property but the odm doesn't know that it belongs to the mixin ... actually a solution would either be to ignore the exception in Node::setProperty or make the ODM aware or read-only fields.

I think making the ODM read-only aware should be easier and more flexible.

[PHPCR\NodeType\ConstraintViolationException]
Can't remove the protected property: jcr:created

Exception trace:
() at /vagrant/symfony/vendor/jackalope/jackalope/src/Jackalope/NodeType/NodeType.php:364
Jackalope\NodeType\NodeType->canRemoveProperty() at /vagrant/symfony/vendor/jackalope/jackalope/src/Jackalope/Node.php:536
Jackalope\Node->setProperty() at /vagrant/symfony/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/UnitOfWork.php:1954
Doctrine\ODM\PHPCR\UnitOfWork->executeUpdates() at /vagrant/symfony/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/UnitOfWork.php:1717
Doctrine\ODM\PHPCR\UnitOfWork->commit() at /vagrant/symfony/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/DocumentManager.php:864

setMixins fails with referenced nodes

I have a node type called sulu:page, which inherits from the mix:referenceable node type. I have a node which has the mix:referencebale node type and is already referenced by some other nodes.

Now I would like to change the node to only have the sulu:page mixins and not the mix:referenceable mixin. So I call $node->setMixins(['sulu:page']), but when saving the data in the session to jackrabbit I get an error message like this:

{http://www.jcp.org/jcr/mix/1.0}referenceable can not be removed: the node is being referenced through at least one property of type REFERENCE

I have checked the curl request which is being sent, and there are two relevant parts, which I'll show in the following snippet:

--716fd5cc8a3f81528673d2a9af259887
Content-Disposition: form-data; name="/cmf/microlife/contents/a/jcr:mixinTypes"
Content-Type: jcr-value/name; charset=UTF-8
Content-Transfer-Encoding: 8bit

sulu:page

Some more data, and quite at the bottom I see a line like this:

^/cmf/microlife/contents/a/jcr:mixinTypes : []

It looks to me like it is resetting the mixinTypes before setting the new value, which causes some references to break.

Is there any reason this is built like that? Can we fix that? If I get a hint I would create a PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.