1

I am getting the above error when I tried to create invoice.Invoice is creating successfully but the above error is not going.

I found this but it's not working- Declaration of Methods should be Compatible with Parent Methods in PHP Here are the functions-

class PayPal
{
    .
    .
    .
    /**
     * Send the API request to PayPal using CURL
     *
     * @access  public
     * @param   string  NVP string
     * @return  string
     */
    function CURLRequest($Request)
    {
        $curl = curl_init();
                // curl_setopt($curl, CURLOPT_HEADER,TRUE);
                curl_setopt($curl, CURLOPT_VERBOSE, 1);
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
                curl_setopt($curl, CURLOPT_TIMEOUT, 30);
                curl_setopt($curl, CURLOPT_URL, $this->EndPointURL);
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($curl, CURLOPT_POSTFIELDS, $Request);

        if($this->APIMode == 'Certificate')
        {
            curl_setopt($curl, CURLOPT_SSLCERT, $this->PathToCertKeyPEM);
        }

        $Response = curl_exec($curl);       
        curl_close($curl);
        return $Response;   
    }

    .
    .
}

class PayPal_Adaptive extends PayPal
    {
        .
        .
        .   
        /**
         * Send the API request to PayPal using CURL
         *
         * @access  public
         * @param   string $Request
         * @param   string $APIName
         * @param   string $APIOperation
         * @return  string
         */
        function CURLRequest($Request, $APIName, $APIOperation)
        {
            $curl = curl_init();
                    curl_setopt($curl, CURLOPT_VERBOSE, 1);
                    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
                    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
                    curl_setopt($curl, CURLOPT_URL, $this -> EndPointURL . $APIName . '/' . $APIOperation);
                    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($curl, CURLOPT_POSTFIELDS, $Request);
                    curl_setopt($curl, CURLOPT_HTTPHEADER, $this -> BuildHeaders(false));

            if($this -> APIMode == 'Certificate')
            {
                curl_setopt($curl, CURLOPT_SSLCERT, $this -> PathToCertKeyPEM);
            }

            $Response = curl_exec($curl);       
            curl_close($curl);
            return $Response;
        }
        .
        .
    } // End Class PayPal_Adaptive

I have changed all the parameters to same number as well as same default values but does not seem to work. System is using custom error handler. I also tried this - error_reporting(E_ALL & ~(E_NOTICE | E_DEPRECATED | E_STRICT));

I have downloaded this library from here.

Thanks.

Community
  • 1
  • 1
Irfan
  • 7,029
  • 3
  • 42
  • 57
  • @JoachimIsaksson:Yes both have the same visiblity.Error is in php 5.3.5 but not in 5.2.8 . – Irfan Jan 27 '13 at 07:53
  • Can't repeat, could you boil it down to an actually compilable sample with the method declarations intact and the methods empty and add it to your question? – Joachim Isaksson Jan 27 '13 at 08:23
  • Until I (hopefully) get time to test the library and see what the error is about; to remove the warning, you need to set `error_reporting` in php.ini, since it's a compilation error and compilation takes place before running the error_reporting() line in your code. – Joachim Isaksson Jan 27 '13 at 09:21
  • @JoachimIsaksson:Thanks for your time.I'll do it as you said.See if I get any fix for this error. – Irfan Jan 27 '13 at 09:29

1 Answers1

5

It looks like you must be using my PHP class library for PayPal..??

I've got this issue fixed in my current local version, but I have a few other things to update before I release the official update.

To fix this problem, set the opening line for that function to the following...

function CURLRequest($Request = '', $APIName = '', $APIOperation = '')
{

}

Depending on which version of my library you're using there may be other extended classes for PayPal Here, PayFlow, and PayPal Access. If you have these, just make the same change to the CURLRequest function in those extended classes so it matches everywhere.

This will eliminate the notice.

Drew Angell
  • 25,968
  • 5
  • 32
  • 51
  • Thanks it worked,before posting the question I tried the same dont know what wrong I did.One more thing if you can answer here that I am getting 2000 instead of 20 as response for total amount should I have to divide it by 100.Thanks for the library. – Irfan Jan 28 '13 at 03:40
  • I've never seen that myself. I'd have to see a sample of what you're sending to PayPal and what you're getting back. – Drew Angell Jan 28 '13 at 07:38