Skip to content

Restadd mr26

Ghost User requested to merge (removed):restadd_mr26 into master-cakephp

Ran into a really weird issue here when trying to assign a value to an array with __(''), complained with Syntax Error: syntax error, unexpected '(', expecting ')'

I've tested this in a sandbox and it works fine when assigning function returns as array values except when being called in an array declared as a class member.

// snippet from template, no syntax error                                                                                           
  $works = array(
      'empty' => array(
          0 => __('Please Select')
      )
  );                                                                                                                                      

  // working, no syntax error
  $attributeOperators = array (
      '=' => array(
          'title' => __('Add as reply if unique'),
          )
  );

  class WHO
  {
      /**
       * @var attributeOperators
       * Contains a list of Attribute Operators used throughout the application
       */
      public $attributeOperators = array (
          '=' => array(
              'title' => __('Add as reply if unique'),
              'description' => __('
  Not allowed as a check item for RADIUS protocol attributes. It is allowed for server configuration attributes (Auth-Type, etc),     
  and sets the value of on attribute, only if there is no other item of the same name.                                                
  As a reply item, it means "add the item to the reply list, but only if there is no other item of the same attribute.                
              '),
          ),
      );
  }

Merge request reports