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

Compare tpl operator doesn't work properly

    XMLWordPrintable

Details

    Description

      1. There is an inconsistency:
      'compare' compares the contents of two arrays or strings
      but two different strings '0.3' and '0.30' are equal
      and arrays of these strings are equal as well in some cases and are not equal in other cases

      2. 'eq' operator works correctly and should always return true for these cases (in exemple), we think we should not change this behaviour.

      Steps to reproduce

      For example:

      {def $var1='0.3'
           $var2='0.30'}
      
      compare( {$var1}, {$var2} ): {$var1|compare( $var2 )}<br>
      compare( '0.3', '0.30' ): {'0.3'|compare( '0.30' )}<br>
      compare( array( {$var1} ), array( {$var2} ) ): {array( $var1 )|compare( array( $var2 ) )}<br>
      compare( array( '0.3' ), array( '0.30' ) ): {array( '0.3' )|compare( array( '0.30' ) )}<br>
      

      if template compilation is disabled
      it will produce:

      compare( 0.3, 0.30 ): 1
      compare( '0.3', '0.30' ): 1
      compare( array( 0.3 ), array( 0.30 ) ): 
      compare( array( '0.3' ), array( '0.30' ) ):
      

      but if template compilation is enabled
      it will produce

      compare( 0.3, 0.30 ): 1
      compare( '0.3', '0.30' ): 1
      compare( array( 0.3 ), array( 0.30 ) ): 1
      compare( array( '0.3' ), array( '0.30' ) ): 1
      

      'compare' operator should return false for all these cases but it doesn't.

      Attachments

        Activity

          People

            vd vd
            vd vd
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: