public static function checkForExtensions($arrExt = array())
    {
        if ((strcasecmp(PSI_SYSTEM_CODEPAGE, "UTF-8") == 0) || (strcasecmp(PSI_SYSTEM_CODEPAGE, "CP437") == 0))
            $arrReq = array('simplexml', 'pcre', 'xml', 'dom');
        elseif (PSI_OS == "WINNT")
            $arrReq = array('simplexml', 'pcre', 'xml', 'dom', 'mbstring', 'com_dotnet');
        else
            $arrReq = array('simplexml', 'pcre', 'xml', 'dom', 'mbstring');
        $extensions = array_merge($arrExt, $arrReq);
        $text = "";
        $error = false;
        $text .= "<?xml version='1.0'?>\n";
        $text .= "<phpsysinfo>\n";
        $text .= "  <Error>\n";
        foreach ($extensions as $extension) {
            if (!extension_loaded($extension)) {
                $text .= "    <Function>checkForExtensions</Function>\n";
                $text .= "    <Message>phpSysInfo requires the ".$extension." extension to php in order to work properly.</Message>\n";
                $error = true;
            }
        }
        $text .= "  </Error>\n";
        $text .= "</phpsysinfo>";
        if ($error) {
            header("Content-Type: text/xml\n\n");
            echo $text;
            die();
        }
    }
public static function checkForExtensions($arrExt = array())
    {
        if ((strcasecmp(PSI_SYSTEM_CODEPAGE, "UTF-8") == 0) || (strcasecmp(PSI_SYSTEM_CODEPAGE, "CP437") == 0))
            $arrReq = array('simplexml', 'pcre', 'xml', 'dom');
        elseif (PSI_OS == "WINNT")
            $arrReq = array('simplexml', 'pcre', 'xml', 'dom', 'mbstring', 'com_dotnet');
        else
            $arrReq = array('simplexml', 'pcre', 'xml', 'dom', 'mbstring');
        $extensions = array_merge($arrExt, $arrReq);
        $text = "";
        $error = false;
        $text .= "<?xml version='1.0'?>\n";
        $text .= "<phpsysinfo>\n";
        $text .= "  <Error>\n";
        foreach ($extensions as $extension) {
            if (!extension_loaded($extension)) {
                $text .= "    <Function>checkForExtensions</Function>\n";
                $text .= "    <Message>phpSysInfo requires the ".$extension." extension to php in order to work properly.</Message>\n";
                $error = true;
            }
        }
        $text .= "  </Error>\n";
        $text .= "</phpsysinfo>";
        if ($error) {
            header("Content-Type: text/xml\n\n");
            echo $text;
            die();
        }
    }
public static function checkForExtensions ( $ arrExt = array ( ) ) { if ( ( strcasecmp ( PSI_SYSTEM_CODEPAGE , "UTF-8" ) == 0 ) || ( strcasecmp ( PSI_SYSTEM_CODEPAGE , "CP437" ) == 0 ) ) $ arrReq = array ( 'simplexml' , 'pcre' , 'xml' , 'dom' ) ; elseif ( PSI_OS == "WINNT" ) $ arrReq = array ( 'simplexml' , 'pcre' , 'xml' , 'dom' , 'mbstring' , 'com_dotnet' ) ; else $ arrReq = array ( 'simplexml' , 'pcre' , 'xml' , 'dom' , 'mbstring' ) ; $ extensions = array_merge ( $ arrExt , $ arrReq ) ; $ text = "" ; $ error = false ; $ text .= "<?xml version='1.0'?>\n" ; $ text .= "<phpsysinfo>\n" ; $ text .= "  <Error>\n" ; foreach ( $ extensions as $ extension ) { if ( ! extension_loaded ( $ extension ) ) { $ text .= "    <Function>checkForExtensions</Function>\n" ; $ text .= "    <Message>phpSysInfo requires the " . $ extension . " extension to php in order to work properly.</Message>\n" ; $ error = true ; } } $ text .= "  </Error>\n" ; $ text .= "</phpsysinfo>" ; if ( $ error ) { header ( "Content-Type: text/xml\n\n" ) ; echo $ text ; die ( ) ; } }
Check for needed php extensions

We need that extensions for almost everything
This function will return a hard coded
XML string (with headers) if the SimpleXML extension isn't loaded.
Then it will terminate the script.
See bug #1787137

@param array $arrExt additional extensions for which a check should run

@return void
Check for needed php extensions