1

これはfunction_existsがfalseを返すのと似ていますが、宣言はエラーをスローしますが、問題を引き起こしているのはユーザー関数ではなく内部関数であるため、名前空間の問題ではないと思います。

PHPアプリケーションでdompdfを使用していますが、dompdfクラス内の次の関数が問題を引き起こしています。

if ( !function_exists('sys_get_temp_dir')) {
    /**
     * Find the current system temporary directory
     *
     * @link http://us.php.net/manual/en/function.sys-get-temp-dir.php#85261
     */
    function sys_get_temp_dir() {
        if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); }
        if (!empty($_ENV['TMPDIR'])) { return realpath( $_ENV['TMPDIR']); }
        if (!empty($_ENV['TEMP'])) { return realpath( $_ENV['TEMP']); }
        $tempfile=tempnam(uniqid(rand(),TRUE),'');
        if (file_exists($tempfile)) {
        unlink($tempfile);
        return realpath(dirname($tempfile));
        }
    }
}

そして、私が得ているのは

Fatal error: Cannot redeclare sys_get_temp_dir() on line 873

get_defined_functions()メソッドを使用してエコーアウトすると、リストの最後に関数sys_get_temp_dirが表示されるので、ifステートメントに入る必要さえありません。

4

1 に答える 1