Page 1 of 1

Call to undefined method

Posted: Wed Apr 28, 2010 7:14 pm
by kaingo
Dear Gurus,

Please help I am a newbie to php. I am playing with snort and acid, I have got everything working but whenever I click a link I get the following message:

Call to undefined method ProtocolFieldCriteria::ProtocolFieldCriteria() in /usr/local/apache2/htdocs/acid/acid_state_citems.inc on line 979
The code where this occurs is as follows:

Code: Select all

function IPFieldCriteria($db, $cs, $export_name, $element_cnt)
    978    {
    979       parent::ProtocolFieldCriteria(&$db, &$cs, $export_name, $element_cnt,
    980                                     array("ip_tos"  => "TOS",
    981                                           "ip_ttl"  => "TTL",
    982                                           "ip_id"   => "ID",
    983                                           "ip_off"  => "offset",
    984                                           "ip_csum" => "chksum",
    985                                           "ip_len"  => "length"));
    986    }
Can someone please help. I have been at it now and some are saying I have to downgrade to PHP 4.3.4, I am using php-5.3.1 and I am new to php.

Thanks in advance.

Kaingo

Re: Call to undefined method

Posted: Wed Apr 28, 2010 8:27 pm
by jraede
What does the __construct() function look like for the class that that function comes from?

Re: Call to undefined method

Posted: Sat May 01, 2010 6:36 am
by kaingo
Hi jraede,

I ma very sorry for not responding soon to our reply. However this is the class statement I can get above the function

class IPFieldCriteria extends ProtocolFieldCriteria

Is that what you wanted to see?
I am getting the same error for all links I click on so if a fix is found for one I am sure this will solve all. Thanks for your effort

kaingo

Re: Call to undefined method

Posted: Sat May 01, 2010 12:15 pm
by social_experiment
You are attempting to call a method that doesn't exist

Re: Call to undefined method

Posted: Sat May 01, 2010 5:02 pm
by phu
In order for the code you posted to work, IPFieldCriteria must be a method on a class that extends a class that defines the method ProtocolFieldCriteria. parent:: notation will not work unless this is the case; some part of this equation is missing, but you did not provide enough code to know which.

Code: Select all

class ParentClass
{
    public function ProtocolFieldCriteria(...)
    { ... }
}

class SomeClass extends ParentClass
{
    public function IPFieldCriteria(...)
    {
        ...
        parent::ProtocolFieldCriteria(...);
        ...
    }
}
It looks like you may be using methods with the exact same name as classes... I'd assume that would work, but it's not a good idea from a readability standpoint, and if you're duplicating names across classes and methods, one or the other could definitely be more descriptive/accurate if you changed it.

Re: Call to undefined method

Posted: Sun May 02, 2010 7:25 am
by kaingo
Hi phu,

Thanks very much for your input. As I said, I am a newbie so let me digest this and try some of the tips especially looking at the syntax you provided. Can I post the whole code if I fail to correct this problem?
Thanks in advance

kaingo

Re: Call to undefined method

Posted: Thu Jan 06, 2011 7:33 pm
by PPowerHouseK
Hey, I am having this same problem. What exactly needs to be changed to fix this:
Fatal error: Call to undefined method ProtocolFieldCriteria::ProtocolFieldCriteria() in acid_state_citems.inc on line 979