error handling - PHP supress 3rd party library warning -
i using net_epp library centralnic (https://github.com/centralnic/php-epp/) @ point script calls
@$frame = new \net_epp_frame_command_login(); //the epp framework throws warning otherwise
note @ in beginning of line, done purpose suppress warning thrown here 3rd party library.
so, constructor of net_epp_frame_command_login calls parent constructor
class net_epp_frame_command_login extends net_epp_frame_command { function __construct() { parent::__construct('login');
that looks like
class net_epp_frame_command extends net_epp_frame { function __construct($command, $type) { $this->type = $type;
this part in turn throws me 2 warnings -
warning: missing argument 2 net_epp_frame_command::__construct() notice: undefined variable: type
how can suppress warnings without modifying library?
update
interestingly, if talk server directly not display warning although if page contents using curl does.
$args = array("domainname" => $_post['domain'], "tld" => $_post['tld']); $action = "checkavailabilityactionbymodule"; $msg = new commsmessage($action,$args); $reply = testserver::main($msg->encode()); $reply = commsmessage::decodereply($reply);
works fine talking directly server. but
$reply = $client->getavailabilitybymodule($_post['domain'], $_post['tld']);
does not because request done through curl
you can change error_reporting (all no warning or notice):
error_reporting(e_all ^ (e_notice | e_warning));
or setup own error handler. error_reporting
settings have no effect in case:
set_error_handler("myerrorhandler"); function myerrorhandler($errno, $errstr, $errfile, $errline) { // want in case of error /* don't execute php internal error handler */ return true; }
Comments
Post a Comment