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

subTreeByNodeId AttributeFilter doesn't handle the in/ not_in operator when used with custom attribute

    XMLWordPrintable

    Details

      Description

      When using eZContentObjectTreeNode::subTreeByNodeId, the not_in operator forces all the strings in the provided array to integer.

      ezcontentobjecttreenode.php
      while ( list( $key, $value ) = each( $filter[2] ) )
      {
          // Non-numerics must be escaped to avoid SQL injection
          switch ( $filterFieldType )
          {
              case 'string':
                  $filter[2][$key] = "'" . $db->escapeString( $value ) . "'";
                  break;
              case 'integer':
              default:
                  $filter[2][$key] = (int) $value;
          }
      }
      

      $filterFieldType is not defined anywhere when using a custom attribute, for example:

      eZContentObjectTreeNode::subTreeByNodeId( array(
          'AttributeFilter' => array( array( 'fruit/name', 'not_in', array( 'orange', 'banana' ) ),
          'ClassFilterType' => 'include',
          'ClassFilterArray' => array( 'fruit' )
          ), $parent_node_id );
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              oz.conseil oz.conseil Conseil
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: