Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-392

Inappropriate "eval" usage in kBase::makeClass method

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: Minor
    • Resolution: no change required
    • Affects Version/s: 5.0.2-B1
    • Fix Version/s: 5.2.0-B1
    • Component/s: Optimization
    • Labels:
      None

      Description

      Method kBase::makeClass is calling ref_call_user_func_array no matter if he has only class name or class name + constructor arguments passed. This slows downs the things a little bit. I propose to use code, mentioned above, that was called from kFactory class to optimize things.

      if ( func_num_args() == 1 )

      { $class = new $real_class(); }

      else

      { $func_args = func_get_args(); $pseudo_class = array_shift($func_args); $class =& ref_call_user_func_array( Array ($real_class,'makeClass'), $func_args ); }

      -------------------------

      Also kDBLIst class constructor during filter creation calls makeClass 13 times, but there are only two class types it creates, so we could create two classes and just clone them to create other fiters. Here is problematic code:

      $filters = $this->getFilterStructure();

      foreach ($filters as $filter_params)

      { $filter =& $this->$filter_params['type']; $filter[ $filter_params['class'] ] =& $this->Application->makeClass('kMultipleFilter', $filter_params['join_using']); }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Alex
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: