Cant Get Controllers

this is the code that returns empty array

$contPath = Yii::app()->getControllerPath();

$controllers = $this->_scanDir($contPath);

$contPath is correct ,is scan dir that don’t work.

desperately need help.

any clue?

thanks.

What is the output of the function _scanDir( $contPath ) ?


private function _scanDir($contPath, $module="", $subdir="", $controllers = array()) {

    $handle = opendir($contPath);

    $del = Helper::findModule('srbac')->delimeter;

    while (($file = readdir($handle)) !== false) {

      $filePath = $contPath . DIRECTORY_SEPARATOR . $file;

      if (is_file($filePath)) {

        if (preg_match("/^(.+)Controller.php$/", basename($file))) {

          if ($this->_extendsSBaseController($filePath)) {

            $controllers[] = (($module) ? $module . $del : "") .

              (($subdir) ? $subdir . "." : "") .

              str_replace(".php", "", $file);

          }

        }

      } else if (is_dir($filePath) && $file != "." && $file != "..") {

        $controllers = $this->_scanDir($filePath, $module, $file, $controllers);

      }

    }

    

    return $controllers;

  }