Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryBuilder throws InvalidQueryException if node path contains '-<num>e' #779

Open
SalvatorePollaci opened this issue Mar 21, 2018 · 1 comment

Comments

@SalvatorePollaci
Copy link

SalvatorePollaci commented Mar 21, 2018

When querying for children of node with path which contains -<num>e, Query Builder throws InvalidQueryException.

$path = '/cms/site1/routes/it/home/test-1e';
$qb = $this->manager->createQueryBuilder();
                $qb->fromDocument(AutoRoute::class, 'a');
                $qb->where()->child($path, 'a');
                $out = $qb->getQuery()->execute();

STEP 1:
/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Client.php line 888
$querystring = $query->getStatement();

$querystring has value:

SELECT * FROM [nt:unstructured] AS a WHERE (ISCHILDNODE(a, [/cms/site1/routes/it/home/test-1e]) AND (a.[phpcr:class] = 'MyCompany\Bundle\CMSBundle\Document\CMS\AutoRoute' OR a.[phpcr:classparents] = 'MyCompany\Bundle\CMSBundle\Document\CMS\AutoRoute'))

STEP 2:
/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Request.php line 529
$response = $curl->exec();

$response has value:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><D:error xmlns:D="DAV:"><dcr:exception xmlns:dcr="http://www.day.com/jcr/webdav/1.0"><dcr:class>javax.jcr.query.InvalidQueryException</dcr:class><dcr:message>Query:
SELECT * FROM [nt:unstructured] AS a WHERE (ISCHILDNODE(a, [/cms/site1/routes/it/home/test-(*)1e]) AND (a.[phpcr:class] = 'MyCompany\Bundle\CMSBundle\Document\CMS\AutoRoute' OR a.[phpcr:classparents] = 'MyCompany\Bundle\CMSBundle\Document\CMS\AutoRoute'))</dcr:message></dcr:exception></D:error>

As you can see above, it seems that someone is adding '(*)' to the JCR query.

This only happens if node's path contains -<num>e.

Does anyone have any solutions?

@dbu
Copy link
Member

dbu commented Mar 22, 2018

what is the exception message? i remember that there is a bug in jackrabbit where it mis interprets those as codes even when url encoded. i think you are seeing jackalope/jackalope#313 - unfortunately that is a bug in the java jackrabbit server and they seem to not care to fix it.

the sulu cms did this: sulu/sulu-document-manager#91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants