Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6574753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:18:02+00:00 2026-05-25T15:18:02+00:00

I need to verify the existence of a method in a controller from a

  • 0

I need to verify the existence of a method in a controller from a model with codeigniter 2.0.2. and HMVC.

I’m trying to do with ReflectionClass:hasMethod(), without success.

My code in Model:

function hasPanel($controller){
    $rc = new ReflectionClass($controller);
    if($rc::hasMethod("panel_base")){
        return true;
    }
    return false;
}

And the unwelcome error:

Fatal error:  Uncaught exception 'ReflectionException' with message 'Class administracion does not exist' in D:\xampp\htdocs\sea\application\models\auth\permisos.php:368
Stack trace:
#0 D:\xampp\htdocs\sea\application\models\auth\permisos.php(368): ReflectionClass->__construct('administracion')
#1 D:\xampp\htdocs\sea\application\models\auth\permisos.php(357): Permisos->hasPanel('administracion')
#2 D:\xampp\htdocs\sea\application\controllers\auth\identificar.php(101): Permisos->getControladores('administracion')
#3 [internal function]: Identificar->modulo()
#4 D:\xampp\htdocs\sea\application\core\Admin_controller.php(317): call_user_func_array(Array, Array)
#5 D:\xampp\htdocs\sea\system\core\CodeIgniter.php(305): Admin_controller->_remap('modulo', Array)
#6 D:\xampp\htdocs\sea\www\index.php(252): require_once('D:\xampp\htdocs...')
#7 {main}
  thrown in D:\xampp\htdocs\sea\application\models\auth\permisos.php on line 368

EDITED
This solves the above…

function hasPanel($controller,$route){
    include_once($route);
    $rc = new ReflectionClass($controller);
    if($rc::hasMethod("panel_base")){
        return true;
    }
    return false;
}

But causes this:

Fatal error: Non-static method ReflectionClass::hasMethod() cannot be called statically, assuming $this from incompatible context in D:\xampp\htdocs\sea\application\models\auth\permisos.php on line 373

Some idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:18:03+00:00Added an answer on May 25, 2026 at 3:18 pm

    I’m not entirely sure, but this might be as simple as $rc->hasMethod("panel_base"); You did instantiate a new class. . .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is possible to verify the existence of a method without instantiating the class in
I have a string which I need to verify if it's a Country code.
I need to verify a signed jar from my application. I found I can
I am reading a std::istream and I need to verify without extracting characters that:
I will be taking URL from user. Now I need to verify whether address
I need to verify that a method is called, however it receives a parameter
I need to verify code signatures of binaries. Microsoft Authenticode I think is the
I'm trying to parse through a ppm file, but first need to verify if
I need to verify if the second word from $line_from_file is a string with
I need to verify if the args are valid file names, is this the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.