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

begins_with operator doesn't work as expected with strings

    XMLWordPrintable

Details

    Description

      Example :

      ezpublish begins with "pub" : {cond( "ezpublish"|begins_with( 'pub' ), 'true', 'false' )}
      ezpublish begins with "aaa" : {cond( "ezpublish"|begins_with( 'aaa' ), 'true', 'false' )}
      ezpublish begins with "ezp" : {cond( "ezpublish"|begins_with( 'ezp' ), 'true', 'false' )}
      

      outputs

      ezpublish begins with "pub" : false
      ezpublish begins with "aaa" : true
      ezpublish begins with "ezp" : true
      

      this is due to a wrong comparison (== vs ===) on the value returned by strpos() PHP function.

      Attachments

        Activity

          People

            andre1 andre1
            dpobel dpobel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: