0

I have this error :

Warning: usort() expects parameter 2 to be a valid callback, function 'sortSecmModules' not found or invalid function name 

How to resolve, an idea ?

Thank you.

I have a file called SecurityCheck like this

  namespace \Apps\Tools\SecurityCheck\Sites\Admin\Pages\Home\Actions;

  use Core\OM\Registry;

  class SecurityCheck extends \Core\OM\PagesActionsAbstract {
    public function execute() {
      $OSCOM_SecurityCheck = Registry::get('SecurityCheck');

      $this->page->setFile('security_check.php');

      $OSCOM_SecurityCheck->loadDefinitions('Sites/ClicShoppingAdmin/main');
    }

    public function sortSecmModules($a, $b) {
      return strcasecmp($a['title'], $b['title']);
    }
  }

and another file security_check.php with this elements inside :

  usort($modules, 'sortSecmModules');

1 Answer 1

3

sortSecmModules is a class method, you need to include the class name.

usort($modules, 'SecurityCheck::sortSecmModules');

But you also need to make it a static function, so it doesn't have to be called through an object.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.