tags:

views:

22

answers:

1

Hi all,

I'm integrating PayPal in an application written in PHP and running on PHP 5.3.1 (using Zend Engine 2.3.0). Every time I require a PayPal SDK file or use any of the methods it prints out an enormous amount of error and warning messages. I obviously want to keep error message reporting at the maximum level possible (at least for my code).

My problem is similar to this one (I didn't write that) https://www.x.com/message/167121#167121

I'm concerned with possible security issues and with the obvious annoying amount of messages going into the log.

Do you have any idea of how to fix/work around this?

Thanks :)

EDIT: A sample from the warning list (there are more):

As an example (but there are more):

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal.php on line 87

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal.php on line 115

Strict Standards: Declaration of PayPal::raiseError() should be compatible with that of PEAR::raiseError() in (...)/PayPal.php on line 198

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Hack.php on line 78

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Value.php on line 90

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Value.php on line 93

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 221

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 514

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 616

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 617

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 760

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 897

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 1055

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 1083

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 1109

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 1151

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/SOAP/Base.php on line 1176

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Type/XSDType.php on line 97

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Type/XSDType.php on line 110

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Type/XSDType.php on line 112

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Profile/Handler/Array.php on line 53

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Profile/API.php on line 256

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Type/XSDSimpleType.php on line 69

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Type/XSDSimpleType.php on line 71

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Type/XSDSimpleType.php on line 98

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Type/XSDSimpleType.php on line 111

Strict Standards: Assigning the return value of new by reference is deprecated in (...)/PayPal/Type/XSDSimpleType.php on line 113

+2  A: 

I assume that PayPal Code is an external library from the PEAR Package your using that isn't 5.3 Strict comparable. There quite some Code that suffers from that Problem.

Assuming you don't want to change that Code and Submit it back ( ;) ) there aren't so many things you can do.

To name the first two that come to mind:

In your wrapper Code for the Paypal access turn of E_STRICT everytime before the call and back on after. E.g.

<?php
class myPayPalWrapper { 
    public function doX() { 
         $x = error_reporting(E_ALL & ~E_STRICT); # or something
         $this->externalPaypalClass->doX();
         error_reporting($x);
    }
}

doesn't look really pretty and requires a good amount of code.

If your are already using a custom errorhandler in your project you could extend that to filter out all errors of that lib. E.g.

<?php
function myErrorHandler($iErrno, $sErrstr, $sErrfile, $iErrline) {
    if(error_reporting() & $iErrno) {
        if(strpos("libFolder/paypal", $sErrfile) !== false) {
            return true;
        }
    }
    return false;
}

Hope that helps

edorian
+1 for the turn-off-strict wrapper for ugly third-party code.
Charles
That's great! :) We're using the first option but the second sounds more reasonable :)Thanks
DiogoNeves