Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-20848

PDOException: SQLSTATE[42000]: Syntax error or access violation: when trying to search with API using a Field criterion on a XML block fieldtype

    XMLWordPrintable

    Details

      Description

      While testing the issue https://jira.ez.no/browse/EZP-20768 if you try to search a word on XML block you'll get the following error

      RuntimeException: Database error
      
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Search/Gateway/ExceptionConversion.php:61
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Search/Handler.php:103
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/SearchService.php:90
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/SearchService.php:65
      /var/www/apache2php53/ezp/ezpublish_testsystem/extension/ezpublishapitests/tests/ezpublishapi/ezpublishapi/kanban/ezp20768/ezpublishapiezp20768.php:64
      /var/www/apache2php53/ezp/ezpublish_testsystem/extension/selenium/classes/ezpselenesetest.php:743
      /var/www/apache2php53/ezp/ezpublish_testsystem/extension/ezpublishapitests/tests/ezpublishapi/ezpublishapi/kanban/ezp20768/ezpublishapiezp20768.php:24
      /var/www/apache2php53/ezp/ezpublish_testsystem/extension/selenium/classes/ezpselenesetest.php:772
      /var/www/apache2php53/ezp/ezpublish_testsystem/tests/toolkit/ezptestrunner.php:372
      

      After a little debugging, adding an Exception $e to public function find( Criterion $criterion, $offset = 0, $limit = null, array $sort = null, array $translations = null ) function on vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Search/Gateway/ExceptionConversion.php file I got a more specific error

      1) eZPublishAPIEzp20768::testTC1593SearchingWithAPIUsingAFieldCriterionLeadsToAFatalError
      PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ) AND ezcontentobject_version.status = 1 )' at line 1
      
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Search/Gateway/EzcDatabase.php:206
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Search/Gateway/EzcDatabase.php:116
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Search/Gateway/ExceptionConversion.php:53
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Search/Handler.php:103
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/SearchService.php:90
      /var/www/apache2php53/ezp/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/SearchService.php:65
      /var/www/apache2php53/ezp/ezpublish_testsystem/extension/ezpublishapitests/tests/ezpublishapi/ezpublishapi/kanban/ezp20768/ezpublishapiezp20768.php:63
      /var/www/apache2php53/ezp/ezpublish_testsystem/extension/selenium/classes/ezpselenesetest.php:743
      /var/www/apache2php53/ezp/ezpublish_testsystem/extension/ezpublishapitests/tests/ezpublishapi/ezpublishapi/kanban/ezp20768/ezpublishapiezp20768.php:24
      /var/www/apache2php53/ezp/ezpublish_testsystem/extension/selenium/classes/ezpselenesetest.php:772
      /var/www/apache2php53/ezp/ezpublish_testsystem/tests/toolkit/ezptestrunner.php:372
      

      Steps:

      Add a folder named "News"
      Add an article with the name "foo" and the intro with "test"
      Make the following search with the Public API

              $criteria = array(
                  new Criterion\ContentTypeIdentifier( 'article' ),
                  new Criterion\Field( 'intro', '=', 'test' )
              );
              
              $query = new \eZ\Publish\API\Repository\Values\Content\Query(
                  array(
                       'criterion' => new Criterion\LogicalAnd( $criteria )
                  )
              );
              
              $searchService = $this->repo->getSearchService();
              $result = $searchService->findContent( $query );
              
              echo( 'Found ' . $result->totalCount . ' items' );
              foreach ( $result->searchHits as $searchHit )
              {
                  echo( $searchHit->valueObject->contentInfo->name );
              }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              pedro.resende-obsolete@ez.no Pedro Resende (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days, 2 hours, 10 minutes
                  2d 2h 10m