0

CentralNIC の NET_EPP ライブラリを使用しています ( https://github.com/centralnic/php-epp/ ) ある時点で、スクリプトが呼び出します

@$frame = new \Net_EPP_Frame_Command_Login(); //the EPP framework throws a warning otherwise    

行の先頭にある @ に注意してください。これは、サード パーティのライブラリによってスローされる警告を抑制する目的で行われます。

したがって、Net_EPP_Frame_Command_Login のコンストラクターは、その親コン​​ストラクターを呼び出します。

class Net_EPP_Frame_Command_Login extends Net_EPP_Frame_Command {
    function __construct() {
        parent::__construct('login');

それは次のように見えます

class Net_EPP_Frame_Command extends Net_EPP_Frame {

        function __construct($command, $type) {
            $this->type = $type;

この部分では、2 つの警告が表示されます -

WARNING: Missing argument 2 for Net_EPP_Frame_Command::__construct()
NOTICE: Undefined variable: type

ライブラリを変更せずにこれらの警告を抑制するにはどうすればよいですか?

アップデート

興味深いことに、サーバーに直接話しかけても警告は表示されませんが、curl を使用してページのコンテンツを取得すると表示されます。

$args = array("domainName" => $_POST['domain'], "tld" => $_POST['tld']);
$action = "CheckAvailabilityActionByModule";
$msg = new CommsMessage($action,$args);
$reply = TestServer::main($msg->encode());
$reply = CommsMessage::decodeReply($reply);

サーバーと直接話しているため、正常に動作します。しかし

$reply = $client->getAvailabilityByModule($_POST['domain'], $_POST['tld']);

このリクエストはcurlを介して行われるため、そうではありません

4

3 に答える 3

0

詳細については、 http://php.net/manual/en/function.error-reporting.phpを確認してください 。すべてのエラー報告をオフにします。

error_reporting(0); 
于 2013-07-25T16:14:19.900 に答える
0

error_reporting を変更できます (警告や通知以外はすべて):

error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));

または、独自のエラー ハンドラをセットアップします。error_reportingこの場合、設定は効果がありません。

set_error_handler("myErrorHandler");

function myErrorHandler($errno, $errstr, $errfile, $errline) {
    // do what you want in case of error

    /* Don't execute PHP internal error handler */
    return true;
}
于 2013-07-25T16:23:28.893 に答える
0

両方の引数に値を与えるか、__construct 関数から 1 つの値を削除してください。

于 2013-07-25T16:24:05.067 に答える