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

An ezjscore server function cannot return '0'

    Details

      Description

      Dunno if it's a bug or a feature indeed...

      I have this:

      class djUtilsServerFunctions extends ezjscServerFunctions
      {
          public static function ezjscore($args)
          {
              return "0";
          }
      

      in order to call http://www.domain.com/ezjscore/call/myextension::ezjscore

      It should return 0 as a plain text, but I see nothing, however, if I do "return '1'", then I'll see 1 in my page

      It comes from the static function: ezjscAjaxContent::textEncode that performs some filtering:

          /**
           * Encodes mixed value to string or comma seperated list of strings
           *
           * @param mixed $mix
           * @return string
           */
          public static function textEncode( $mix )
          {
              print_r($mix);
              if ( is_array( $mix ) )
                  return implode(',', array_map( array('ezjscAjaxContent', 'textEncode'), array_filter( $mix ) ) );
       
              return $mix;
          }
      

      Here is the result of the print_r($mix) to show my particular content:

      Array
      (
          [error_text] => 
          [content] => 0
      )
      

      => the array_filter() cleans everything indeed.
      Don't understand well the need for this function indeed

      As I say, maybe the behavior is good and I'm wrong.
      For the time being, I prefer to return OK, KO instead of 1/0, and all is fine

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            unknown
            Reporter:
            Jerome Despatis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: