We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53484
    • 9 Posts
    Hey,

    lately I get once in a few days errors like this in my log, running last version of Modx and about 10 context with a multsite - any idea what causes this error? I have some idea this errors showed up after updating to 2.5.5-pl didn't had errors like this before.

    [2017-06-04 07:18:46] (ERROR @ /srv/psa04/xxx/core/xpdo/om/xpdoquery.class.php : 704) Error parsing condition with key 0: 
    [2017-06-04 07:18:46] (ERROR @ /srv/psa04/rxxx/core/xpdo/om/xpdoquery.class.php : 704) Error parsing condition with key 0: 
    [2017-06-05 07:38:43] (ERROR @ /srv/psa04/xx/core/xpdo/om/xpdoobject.class.php : 240) Error HY000 executing statement: 
    Array
    (
        [0] => HY000
        [1] => 2014
        [2] => Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
    )
    
    [2017-06-05 07:38:43] (ERROR @ /srv/psa04/xxx/core/xpdo/om/xpdoobject.class.php : 1452) Error HY000 executing statement:
    INSERT INTO `xxx_session` (`id`, `access`, `data`) VALUES ('p8oh3ammah1ul9l9erq2uh9v14', 1496648323, 'modx.user.0.resourceGroups|a:1:{s:7:\"sykoPat\";a:0:{}}modx.user.0.attributes|a:1:{s:7:\"sykoPat\";a:5:{s:16:\"modAccessContext\";a:12:{s:15:\"illegalisticcom\";a:1:{i:0;a:3:{s:9:\"principal\";i:0;s:9:\"authority\";s:1:\"0\";s:6:\"policy\";a:1:
    and up to 10+ more contexts


    Thanks in advance!

    This question has been answered by tezone. See the first response.

      • 53484
      • 9 Posts
      I managed to determine what causes the "704) Error parsing condition with key 0:" issue and it's an pdoResources call I make:

      [[pdoResources?
      		&tpl=`areasTpl.PatBloom.Aframe.Object`
      		&parents=`[[+id]]`
      		&showHidden=`1`
      		&where=`{"description:LIKE":"{"box","checkpoint"}"}`
      		&includeContent=`1`
      		&depth=`0`
      		&sortby=`pagetitle`
      		&sortdir=`ASC`
      		&limit=`0`
      ]]
      


      And especially the &where filter causes this error (tho the scripts does it's thing and retrieves the
      items correctly), but I want to get rid of the errors in the log. The format to filter on multiple parameters
      I got from the forum but with latests updates on PDO tools the errors start occurring.

      So I tried a variation in legit JSON format but it gave me double the amount of errors:

      [[pdoResources?
      		&tpl=`areasTpl.PatBloom.Aframe.Object`
      		&parents=`[[+id]]`
      		&showHidden=`1`
      		&where=`[
      			{description":"box"},
      			{description":"checkpoint"}
      		]`
      		&includeContent=`1`
      		&depth=`0`
      		&sortby=`pagetitle`
      		&sortdir=`ASC`
      		&limit=`0`
      ]]


      Any ideas how to filter on multiple parameters e.g. box, checkpoint.

      Thanks in advance!
        • 3749
        • 24,544 Posts
        This is the form for what you're trying to do (https://docs.modx.com/xpdo/2.x/class-reference/xpdoquery/xpdoquery.where) -- there are several other forms for this there as well:

        $query->where(array(
            array(
                'description' => 'box'
            ),
            array(
                'OR:description:=' => 'checkpoint'
            )
        ));


        I find that it's often faster to use a utility snippet to create the JSON, then just paste it into the tag inside the backticks:

        $q = array(
            array(
                'description' => 'box'
            ),
            array(
                'OR:description:=' => 'checkpoint'
            )
        );
        
        return $modx->toJSON($q);
        
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
        • discuss.answer
          • 53484
          • 9 Posts
          Thanks for pointing in the proper direction, the arrays (and variations on it) as above only gave the first result ('box'),
          it seems the 'OR' doesn't do it thing properly. I ended up with this (as PDO queries aren't my strongest quality):

          <?php
          
          $q  = array( 'description:LIKE' => 'box' );
          $q .= array( 'description:LIKE' => 'checkpoint' );
          
          return $modx->toJSON($q);


          No errors in the log anymore, when I have some more time I'll dive some deeper in the query / snippet approach.

          Thanks!
            • 16430
            • 217 Posts
            I have exactly the same problem.
            After upgrading site from 2.2.1 to 2.5.8 I got these errors in log and images on website are not recreated in core/cache/img folder...
            Any idea how to identify problem?

            path to images in resource are referenced via template variable. Webiste links refers to core/cache/img/some_image.jpg But this image doesnt exists in cache folder.
              • 16430
              • 217 Posts
              I identify the problem...
              I enabled .htaccess in core folder as sugested in manager... since then access to cached images was denied...