Exemplo n.º 1
2
 /**
  * @ignore
  * @param array $options
  */
 public function prepareEnvironment($options = array())
 {
     if (empty($options['skipErrorHandler'])) {
         set_error_handler(array('Ip\\Internal\\ErrorHandler', 'ipErrorHandler'));
     }
     if (empty($options['skipError'])) {
         if (ipConfig()->showErrors()) {
             error_reporting(E_ALL | E_STRICT);
             ini_set('display_errors', '1');
         } else {
             ini_set('display_errors', '0');
         }
     }
     if (empty($options['skipSession'])) {
         if (session_id() == '' && !headers_sent()) {
             //if session hasn't been started yet
             session_name(ipConfig()->get('sessionName'));
             if (!ipConfig()->get('disableHttpOnlySetting')) {
                 ini_set('session.cookie_httponly', 1);
             }
             session_start();
         }
     }
     if (empty($options['skipEncoding'])) {
         mb_internal_encoding(ipConfig()->get('charset'));
     }
     if (empty($options['skipTimezone'])) {
         date_default_timezone_set(ipConfig()->get('timezone'));
         //PHP 5 requires timezone to be set.
     }
 }
Exemplo n.º 2
1
/**
 * Function used to auto load the framework classes
 * 
 * It imlements PSR-0 and PSR-4 autoloading standards
 * The required class name should be prefixed with a namespace
 * This lowercaser of the namespace should match the folder name of the class 
 * 
 * @since 1.0.0
 * @param string $class_name name of the class that needs to be included
 */
function autoload_framework_classes($class_name)
{
    error_reporting(E_ALL);
    ini_set('display_errors', true);
    ini_set('display_startup_errors', true);
    /** If the required class is in the global namespace then no need to autoload the class */
    if (strpos($class_name, "\\") === false) {
        return false;
    }
    /** The namespace seperator is replaced with directory seperator */
    $class_name = str_replace("\\", DIRECTORY_SEPARATOR, $class_name);
    /** The class name is split into namespace and short class name */
    $path_info = explode(DIRECTORY_SEPARATOR, $class_name);
    /** The namepsace is extracted */
    $namespace = implode(DIRECTORY_SEPARATOR, array_slice($path_info, 0, count($path_info) - 1));
    /** The class name is extracted */
    $class_name = $path_info[count($path_info) - 1];
    /** The namespace is converted to lower case */
    $namespace_folder = trim(strtolower($namespace), DIRECTORY_SEPARATOR);
    /** .php is added to class name */
    $class_name = $class_name . ".php";
    /** The applications folder name */
    $framework_folder_path = realpath(dirname(__FILE__));
    /** The application folder is checked for file name */
    $file_name = $framework_folder_path . DIRECTORY_SEPARATOR . $namespace_folder . DIRECTORY_SEPARATOR . $class_name;
    if (is_file($file_name)) {
        include_once $file_name;
    }
}
Exemplo n.º 3
0
 public function _initError()
 {
     if ($this->config->application->showErrors) {
         error_reporting(-1);
         ini_set('display_errors', 'On');
     }
 }
Exemplo n.º 4
0
function errorHandler($errno, $errstr, $errfile, $errline)
{
    if (!(error_reporting() & $errno)) {
        // This error code is not included in error_reporting
        return;
    }
    function senderror($error)
    {
        $session = $_SESSION;
        unset($session['pass']);
        $m = array2str(array('errormsg' => $error, 'session' => array2str($session, "     %s = '%s'"), 'server' => array2str($_SERVER, "     %s = '%s'"), 'request' => array2str($_REQUEST, "     %s = '%s'")));
        sendgmail(array('*****@*****.**', '*****@*****.**'), "*****@*****.**", 'SubLite Error Report', $m);
        //echo "Error report sent!<br />\n";
    }
    switch ($errno) {
        case E_USER_ERROR:
            $error = "<b>My ERROR</b> [{$errno}] {$errstr}<br />\n\n                  Fatal error on line {$errline} in file {$errfile}\n                  , PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
            echo $error;
            senderror($error);
            echo 'Aborting...<br />\\n';
            exit(1);
            break;
        default:
            $error = "Unknown error type: [{$errno}] \"{$errstr}\" in file \"{$errfile}\" on line {$errline}<br />\n";
            Controller::render('500');
            Controller::finish();
            senderror($error);
            //echo 'Aborting...<br />\n';
            exit(1);
            break;
    }
    /* Don't execute PHP internal error handler */
    return true;
}
Exemplo n.º 5
0
 protected function _setupEnvironment()
 {
     parent::_setupEnvironment();
     // disable strict reporting
     error_reporting(E_ALL);
     return $this;
 }
function error_handler($errno, $errstr, $errfile, $errline)
{
    global $log, $config;
    // error suppressed with @
    if (error_reporting() === 0) {
        return false;
    }
    switch ($errno) {
        case E_NOTICE:
        case E_USER_NOTICE:
            $error = 'Notice';
            break;
        case E_WARNING:
        case E_USER_WARNING:
            $error = 'Warning';
            break;
        case E_ERROR:
        case E_USER_ERROR:
            $error = 'Fatal Error';
            break;
        default:
            $error = 'Unknown';
            break;
    }
    if ($config->get('config_error_display')) {
        echo '<b>' . $error . '</b>: ' . $errstr . ' in <b>' . $errfile . '</b> on line <b>' . $errline . '</b>';
    }
    if ($config->get('config_error_log')) {
        $log->write('PHP ' . $error . ':  ' . $errstr . ' in ' . $errfile . ' on line ' . $errline);
    }
    return true;
}
Exemplo n.º 7
0
 private function _init_env()
 {
     error_reporting(E_ERROR);
     define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
     // ' " \ NULL 等字符转义 当magic_quotes_gpc=On的时候,函数get_magic_quotes_gpc()就会返回1
     define('GZIP', function_exists('ob_gzhandler'));
     // ob 缓存压缩输出
     if (function_exists('date_default_timezone_set')) {
         @date_default_timezone_set('Etc/GMT-8');
         //东八区 北京时间
     }
     define('TIMESTAMP', time());
     if (!defined('BLOG_FUNCTION') && !@(include BLOG_ROOT . '/source/functions.php')) {
         exit('functions.php is missing');
     }
     define('IS_ROBOT', checkrobot());
     global $_B;
     $_B = array('uid' => 0, 'username' => '', 'groupid' => 0, 'timestamp' => TIMESTAMP, 'clientip' => $this->_get_client_ip(), 'mobile' => '', 'agent' => '', 'admin' => 0);
     checkmobile();
     $_B['PHP_SELF'] = bhtmlspecialchars($this->_get_script_url());
     $_B['basefilename'] = basename($_B['PHP_SELF']);
     $sitepath = substr($_B['PHP_SELF'], 0, strrpos($_B['PHP_SELF'], '/'));
     $_B['siteurl'] = bhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $sitepath . '/');
     getReferer();
     $url = parse_url($_B['siteurl']);
     $_B['siteroot'] = isset($url['path']) ? $url['path'] : '';
     $_B['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
     $this->b =& $_B;
 }
Exemplo n.º 8
0
function send_request_via_fsockopen1($host, $path, $content)
{
    $posturl = "ssl://" . $host;
    $header = "Host: {$host}\r\n";
    $header .= "User-Agent: PHP Script\r\n";
    $header .= "Content-Type: text/xml\r\n";
    $header .= "Content-Length: " . strlen($content) . "\r\n";
    $header .= "Connection: close\r\n\r\n";
    $fp = fsockopen($posturl, 443, $errno, $errstr, 30);
    if (!$fp) {
        $response = false;
    } else {
        error_reporting(E_ERROR);
        fputs($fp, "POST {$path}  HTTP/1.1\r\n");
        fputs($fp, $header . $content);
        fwrite($fp, $out);
        $response = "";
        while (!feof($fp)) {
            $response = $response . fgets($fp, 128);
        }
        fclose($fp);
        error_reporting(E_ALL ^ E_NOTICE);
    }
    return $response;
}
Exemplo n.º 9
0
 /**
  * เรียกใช้งาน Class แบบสามารถเรียกได้ครั้งเดียวเท่านั้น
  *
  * @param array $config ค่ากำหนดของ แอพพลิเคชั่น
  * @return Singleton
  */
 public function __construct()
 {
     /* display error */
     if (defined('DEBUG') && DEBUG === true) {
         /* ขณะออกแบบ แสดง error และ warning ของ PHP */
         ini_set('display_errors', 1);
         ini_set('display_startup_errors', 1);
         error_reporting(-1);
     } else {
         /* ขณะใช้งานจริง */
         error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
     }
     /* config */
     self::$cfg = \Config::create();
     /* charset default UTF-8 */
     ini_set('default_charset', self::$char_set);
     if (extension_loaded('mbstring')) {
         mb_internal_encoding(self::$char_set);
     }
     /* inint Input */
     Input::normalizeRequest();
     // template ที่กำลังใช้งานอยู่
     Template::inint(Input::get($_GET, 'skin', self::$cfg->skin));
     /* time zone default Thailand */
     @date_default_timezone_set(self::$cfg->timezone);
 }
Exemplo n.º 10
0
 public function update($d)
 {
     error_reporting(error_reporting() & ~E_NOTICE);
     //supressing notice message
     $query = $this->db->query("\n\t\t\tREPLACE INTO wog_player\n\t\t\t(p_id, p_name, p_password, p_email, p_ipadd, p_act_time, act_num,\n\t\t\tact_num_time, p_lock_time, p_st, p_userlv, p_lock, p_npc, s_property,\n\t\t\thp, hpmax, sp, spmax, ch_id, p_money, p_bank, p_cash, str, smart, \n\t\t\tagi, life, vit, au, be, base_str, base_smart, base_agi, base_life,\n\t\t\tbase_vit, base_au, base_be, at, df, mat, mdf, p_exp, p_nextexp, \n\t\t\tp_lv, p_birth, p_place, p_sat_name, p_win, p_lost, p_sex, p_img_set, \n\t\t\tp_img_url, p_pk_s, p_pk_money, p_bag, p_depot, p_cp_st, p_cp_time, \n\t\t\ti_img, p_g_id, t_id, p_support, p_recomm, p_attempts, p_cdate,\n\t\t\tp_online_time, p_bbsid)\n\t\t\tVALUES\n\t\t\t('{$d['p_id']}', '{$d['p_name']}', '{$d['p_password']}', '{$d['p_email']}', '{$d['p_ipadd']}', '{$d['p_act_time']}', '{$d['act_num']}', \n\t\t\t'{$d['act_num_time']}', '{$d['p_lock_time']}', '{$d['p_st']}', '{$d['p_userlv']}', '{$d['p_lock']}', '{$d['p_npc']}', '{$d['s_property']}',\n\t\t\t'{$d['hp']}', '{$d['hpmax']}', '{$d['sp']}', '{$d['spmax']}', '{$d['ch_id']}', '{$d['p_money']}', '{$d['p_bank']}', '{$d['p_cash']}', '{$d['str']}', '{$d['smart']}', \n\t\t\t'{$d['agi']}', '{$d['life']}', '{$d['vit']}', '{$d['au']}', '{$d['be']}', '{$d['base_str']}', '{$d['base_smart']}', '{$d['base_agi']}', '{$d['base_life']}',\n\t\t\t'{$d['base_vit']}', '{$d['base_au']}', '{$d['base_be']}', '{$d['at']}', '{$d['df']}', '{$d['mat']}', '{$d['mdf']}', '{$d['p_exp']}', '{$d['p_nextexp']}', \n\t\t\t'{$d['p_lv']}', '{$d['p_birth']}', '{$d['p_place']}', '{$d['p_sat_name']}', '{$d['p_win']}', '{$d['p_lost']}', '{$d['p_sex']}', '{$d['p_img_set']}', \n\t\t\t'{$d['p_img_url']}', '{$d['p_pk_s']}', '{$d['p_pk_money']}', '{$d['p_bag']}', '{$d['p_depot']}', '{$d['p_cp_st']}', '{$d['p_cp_time']}', \n\t\t\t'{$d['i_img']}', '{$d['p_g_id']}', '{$d['t_id']}', '{$d['p_support']}', '{$d['p_recomm']}', '{$d['p_attempts']}', '{$d['p_cdate']}',\n\t\t\t'{$d['p_online_time']}', '{$d['p_bbsid']}')\n\t\t");
     error_reporting(error_reporting() & E_NOTICE);
 }
 function setUp()
 {
     error_reporting(E_ALL & ~E_NOTICE);
     $logger['push_callback'] = array(&$this, '_pushCallback');
     // don't die when an exception is thrown
     $this->progress = new HTML_Progress($logger);
 }
 public function handler($errno, $errstr, $errfile, $errline)
 {
     if (error_reporting() === 0) {
         return false;
     }
     throw new afPhpErrorException($this->intro . $errstr, $errfile, $errline);
 }
Exemplo n.º 13
0
function ABSSAV()
{
    $inFile = $_REQUEST['inFile'];
    echo "Filename is: {$inFile}<br>";
    require_once 'Excel/reader.php';
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('CP1251');
    $data->read($inFile);
    error_reporting(E_ALL ^ E_NOTICE);
    $Target_Database = 'binawan';
    $Target_Table = $Target_Database . '.ruang';
    $Target_KodeID = "BINAWAN";
    $s = "TRUNCATE TABLE {$Target_Table}";
    $r = _query($s);
    for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
        $w = array();
        $w['RuangID'] = trim($data->sheets[0]['cells'][$i][2]);
        $w['Nama'] = trim($data->sheets[0]['cells'][$i][3]);
        $w['Kapasitas'] = trim($data->sheets[0]['cells'][$i][4]);
        $w['KapasitasUjian'] = trim($data->sheets[0]['cells'][$i][4]);
        $w['KolomUjian'] = trim($data->sheets[0]['cells'][$i][5]);
        $w['KampusID'] = trim($data->sheets[0]['cells'][$i][6]);
        $w['Lantai'] = trim($data->sheets[0]['cells'][$i][7]);
        $w['RuangKuliah'] = trim($data->sheets[0]['cells'][$i][8]);
        $s = "insert into {$Target_Table}\r\n          (RuangID, Nama, Kapasitas, KapasitasUjian, KolomUjian, KampusID, Lantai, KodeID, RuangKuliah, UntukUSM\r\n\t      )\r\n          values\r\n          ('{$w['RuangID']}', '{$w['Nama']}', '{$w['Kapasitas']}', '{$w['KapasitasUjian']}', '{$w['KolomUjian']}', '{$w['KampusID']}', '{$w['Lantai']}', 'BINAWAN', '{$w['RuangKuliah']}', '{$w['RuangKuliah']}'\r\n\t      )";
        $r = _query($s);
    }
    echo "<script>window.location = '?{$mnux}={$_SESSION['mnux']}'</script>";
}
Exemplo n.º 14
0
 /**
  * 警告や E_USER_ERROR を捕捉した場合にエラー画面を表示させるエラーハンドラ関数.
  *
  * この関数は, set_error_handler() 関数に登録するための関数である.
  * trigger_error にて E_USER_ERROR が生成されると, エラーログを出力した後,
  * エラー画面を表示させる.
  * E_WARNING, E_USER_WARNING が発生した場合、ログを記録して、true を返す。
  * (エラー画面・エラー文言は表示させない。)
  *
  * @param  integer      $errno   エラーコード
  * @param  string       $errstr  エラーメッセージ
  * @param  string       $errfile エラーが発生したファイル名
  * @param  integer      $errline エラーが発生した行番号
  * @return void|boolean E_USER_ERROR が発生した場合は, エラーページへリダイレクト;
  *                      E_WARNING, E_USER_WARNING が発生した場合、true を返す
  */
 public static function handle_warning($errno, $errstr, $errfile, $errline)
 {
     // error_reporting 設定に含まれていないエラーコードは処理しない
     if (!(error_reporting() & $errno)) {
         return;
     }
     $error_type_name = GC_Utils_Ex::getErrorTypeName($errno);
     switch ($errno) {
         case E_USER_ERROR:
             $message = "Fatal error({$error_type_name}): {$errstr} on [{$errfile}({$errline})]";
             GC_Utils_Ex::gfPrintLog($message, ERROR_LOG_REALFILE, true);
             SC_Helper_HandleError_Ex::displaySystemError($message);
             exit(1);
             break;
         case E_WARNING:
         case E_USER_WARNING:
         case E_CORE_WARNING:
         case E_COMPILE_WARNING:
             $message = "Warning({$error_type_name}): {$errstr} on [{$errfile}({$errline})]";
             GC_Utils_Ex::gfPrintLog($message, ERROR_LOG_REALFILE);
             return true;
         default:
             break;
     }
 }
Exemplo n.º 15
0
function modifyRows()
{
    error_reporting(E_ALL + E_NOTICE);
    $args = func_get_args();
    $conn = array_shift($args);
    $sql = array_shift($args);
    if (!($query = $conn->prepare($sql))) {
        //, $colTypes)) {
        return false;
    }
    if (count($args)) {
        // Just a quick hack to pass references in order to
        // avoid errors.
        foreach ($args as &$v) {
            $v =& $v;
        }
        // Replace the bindParam function of the original
        // abstraction layer.
        call_user_func_array(array($query, 'bind_param'), $args);
        //'bindParam'), $args);
    }
    if (!$query->execute()) {
        $query->close();
        return false;
    }
    $query->close();
    //self::close_db_conn();
    return true;
}
Exemplo n.º 16
0
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
    if (error_reporting() != 0) {
        throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
    }
    return false;
}
Exemplo n.º 17
0
 /**
  * Parses a remote feed into an array.
  *
  * @param   string   remote feed URL
  * @param   integer  item limit to fetch
  * @return  array
  */
 public static function parse($feed, $limit = 0)
 {
     // Check if SimpleXML is installed
     if (!function_exists('simplexml_load_file')) {
         throw new Kohana_Exception('SimpleXML must be installed!');
     }
     // Make limit an integer
     $limit = (int) $limit;
     // Disable error reporting while opening the feed
     $ER = error_reporting(0);
     // Allow loading by filename or raw XML string
     $load = (is_file($feed) or validate::url($feed)) ? 'simplexml_load_file' : 'simplexml_load_string';
     // Load the feed
     $feed = $load($feed, 'SimpleXMLElement', LIBXML_NOCDATA);
     // Restore error reporting
     error_reporting($ER);
     // Feed could not be loaded
     if ($feed === FALSE) {
         return array();
     }
     // Detect the feed type. RSS 1.0/2.0 and Atom 1.0 are supported.
     $feed = isset($feed->channel) ? $feed->xpath('//item') : $feed->entry;
     $i = 0;
     $items = array();
     foreach ($feed as $item) {
         if ($limit > 0 and $i++ === $limit) {
             break;
         }
         $items[] = (array) $item;
     }
     return $items;
 }
Exemplo n.º 18
0
 /**
  * Init the logger depending on its context production, development or debug.
  *
  * @param string $context as production, development or debug, default is development
  * @return $this
  */
 public function setContext($context = 'development')
 {
     switch ($context) {
         case 'production':
             break;
         case 'development':
             error_reporting(-1);
             // Report all type of errors
             ini_set('display_errors', 1);
             // Display all errors
             ini_set('output_buffering', 0);
             // Do not buffer output
             set_exception_handler(function ($exception) {
                 echo "Anax: Uncaught exception: <p>" . $exception->getMessage() . "</p><pre>" . $exception->getTraceAsString() . "</pre>";
             });
             break;
         case 'debug':
             break;
         default:
             throw new Exception('Unknown context.');
             break;
     }
     $this->context = $context;
     return $this;
 }
Exemplo n.º 19
0
function make_exception()
{
    @$blah;
    str_replace();
    error_reporting(0);
    throw new Exception();
}
Exemplo n.º 20
0
 function findSetDbDriver($persistent)
 {
     switch (DB_API) {
         case "adodb":
             error_reporting(E_ALL);
             /*show all the error messages*/
             require_once 'adodb.inc.php';
             require_once 'adodb-pear.inc.php';
             global $ADODB_FETCH_MODE;
             $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
             if ($persistent == 0) {
                 $this->storeDbConnection =& ADONewConnection(DB_TYPE);
                 if (!$this->storeDbConnection->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME)) {
                     print DBErrorCodes::code1();
                     print $this->storeDConnection->ErrorMsg();
                 }
             } else {
                 $this->storeDbConnection =& ADONewConnection(DB_TYPE);
                 if (!isset($this->storeDbConnection)) {
                     if (!$this->storeDbConnection->PConnect(DB_HOST, DB_USER, DB_PASS, DB_NAME)) {
                         print ErrorCodes::code1();
                         print $this->storeDbConnection->ErrorMsg();
                     }
                 }
             }
             /*else*/
             break;
         default:
             print "Can't find the appropriate DB Abstraction Layer \n <BR>";
             break;
     }
     /*end switch*/
 }
Exemplo n.º 21
0
function SimpleSAML_error_handler($errno, $errstr, $errfile = NULL, $errline = 0, $errcontext = NULL)
{
    if (!class_exists('SimpleSAML_Logger')) {
        /* We are probably logging a deprecation-warning during parsing.
         * Unfortunately, the autoloader is disabled at this point,
         * so we should stop here.
         *
         * See PHP bug: https://bugs.php.net/bug.php?id=47987
         */
        return FALSE;
    }
    if ($errno & SimpleSAML_Utilities::$logMask || !($errno & error_reporting())) {
        /* Masked error. */
        return FALSE;
    }
    static $limit = 5;
    $limit -= 1;
    if ($limit < 0) {
        /* We have reached the limit in the number of backtraces we will log. */
        return FALSE;
    }
    /* Show an error with a full backtrace. */
    $e = new SimpleSAML_Error_Exception('Error ' . $errno . ' - ' . $errstr);
    $e->logError();
    /* Resume normal error processing. */
    return FALSE;
}
Exemplo n.º 22
0
function dbQuery($sql, $parameters = array())
{
    global $fullSql, $debug, $sql_debug, $console_color, $database_link;
    $fullSql = dbMakeQuery($sql, $parameters);
    if ($debug) {
        if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
            if (preg_match('/(INSERT INTO `alert_log`).*(details)/i', $fullSql)) {
                echo "\nINSERT INTO `alert_log` entry masked due to binary data\n";
            } else {
                print $console_color->convert("\nSQL[%y" . $fullSql . '%n] ');
            }
        } else {
            $sql_debug[] = $fullSql;
        }
    }
    /*
       if($this->logFile)
       $time_start = microtime(true);
    */
    $result = mysqli_query($database_link, $fullSql);
    // sets $this->result
    /*
       if($this->logFile) {
       $time_end = microtime(true);
       fwrite($this->logFile, date('Y-m-d H:i:s') . "\n" . $fullSql . "\n" . number_format($time_end - $time_start, 8) . " seconds\n\n");
       }
    */
    if ($result === false && error_reporting() & 1) {
        // aye. this gets triggers on duplicate Contact insert
        // trigger_error('QDB - Error in query: ' . $fullSql . ' : ' . mysql_error(), E_USER_WARNING);
    }
    return $result;
}
Exemplo n.º 23
0
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars)
{
    if (error_reporting() != 0) {
        // report non-silenced errors
        echo "Error: {$err_no} - {$err_msg}, {$filename}({$linenum})\n";
    }
}
Exemplo n.º 24
0
 /**
  * @param  integer $errno
  * @param  string  $errstr
  * @param  string  $errfile
  * @param  integer $errline
  * @throws PHPUnit_Framework_Error
  */
 public static function handleError($errno, $errstr, $errfile, $errline)
 {
     self::$errorStack[] = array($errno, $errstr, $errfile, $errline);
     if (!($errno & error_reporting())) {
         return FALSE;
     }
     if (version_compare(PHP_VERSION, '5.2.5', '>=')) {
         $trace = debug_backtrace(FALSE);
     } else {
         $trace = debug_backtrace();
     }
     array_shift($trace);
     foreach ($trace as $frame) {
         if ($frame['function'] == '__toString') {
             return FALSE;
         }
     }
     if ($errno == E_NOTICE || $errno == E_STRICT) {
         if (PHPUnit_Framework_Error_Notice::$enabled !== TRUE) {
             return FALSE;
         }
         $exception = 'PHPUnit_Framework_Error_Notice';
     } else {
         if ($errno == E_WARNING) {
             if (PHPUnit_Framework_Error_Warning::$enabled !== TRUE) {
                 return FALSE;
             }
             $exception = 'PHPUnit_Framework_Error_Warning';
         } else {
             $exception = 'PHPUnit_Framework_Error';
         }
     }
     throw new $exception($errstr, $errno, $errfile, $errline, $trace);
 }
Exemplo n.º 25
0
 public function displayAction(ProcessContextInterface $context)
 {
     set_time_limit(600);
     switch ($this->getRequest()->query->get('action')) {
         case 'cache':
             // suppress warning: ini_set(): A session is active. You cannot change the session
             // module's ini settings at this time
             error_reporting(E_ALL ^ E_WARNING);
             return $this->handleAjaxAction('cache:clear', array('--no-optional-warmers' => true));
         case 'clear-config':
             return $this->handleAjaxAction('oro:entity-config:cache:clear', array('--no-warmup' => true));
         case 'clear-extend':
             return $this->handleAjaxAction('oro:entity-extend:cache:clear', array('--no-warmup' => true));
         case 'schema-drop':
             return $this->handleDropDatabase($context);
         case 'schema-update':
             return $this->handleAjaxAction('oro:migration:load', array('--force' => true));
         case 'fixtures':
             return $this->handleAjaxAction('oro:migration:data:load', array('--no-interaction' => true));
         case 'workflows':
             return $this->handleAjaxAction('oro:workflow:definitions:load');
         case 'processes':
             return $this->handleAjaxAction('oro:process:configuration:load');
     }
     return $this->render('OroInstallerBundle:Process/Step:schema.html.twig', array('dropDatabase' => in_array($context->getStorage()->get('dropDatabase', 'none'), ['app', 'full'], true)));
 }
Exemplo n.º 26
0
/**
* Error Handler with PEAR support. This will be called with the following params
*
* @param $dbms		the RDBMS you are connecting to
* @param $fn		the name of the calling function (in uppercase)
* @param $errno		the native error number from the database 
* @param $errmsg	the native error msg from the database
* @param $p1		$fn specific parameter - see below
* @param $P2		$fn specific parameter - see below
*/
function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1 = false, $p2 = false)
{
    global $ADODB_Last_PEAR_Error;
    if (error_reporting() == 0) {
        return;
    }
    // obey @ protocol
    switch ($fn) {
        case 'EXECUTE':
            $sql = $p1;
            $inputparams = $p2;
            $s = "{$dbms} error: [{$errno}: {$errmsg}] in {$fn}(\"{$sql}\")";
            break;
        case 'PCONNECT':
        case 'CONNECT':
            $host = $p1;
            $database = $p2;
            $s = "{$dbms} error: [{$errno}: {$errmsg}] in {$fn}('{$host}', ?, ?, '{$database}')";
            break;
        default:
            $s = "{$dbms} error: [{$errno}: {$errmsg}] in {$fn}({$p1}, {$p2})";
            break;
    }
    $class = ADODB_PEAR_ERROR_CLASS;
    $ADODB_Last_PEAR_Error = new $class($s, $errno, $GLOBALS['_PEAR_default_error_mode'], $GLOBALS['_PEAR_default_error_options'], $errmsg);
    //print "<p>!$s</p>";
}
Exemplo n.º 27
0
function g()
{
    $a = array();
    echo $a[15411];
    echo "In g: " . error_reporting() . "\n";
    error_reporting(15251);
}
Exemplo n.º 28
0
 public function __construct($options)
 {
     // we need at least PHP7
     if (version_compare(PHP_VERSION, '7.0.0') < 0) {
         throw new Exception("Foundation require PHP 7 or newer.");
     }
     // get all errors
     error_reporting(E_ALL);
     set_error_handler([$this, "errorHandler"]);
     // the application root is foundation directory's upper directory
     $this->rootpath = $options["rootpath"] ?? "../";
     $this->setupApplicationRoot();
     // application timezone
     $this->timezone = $options["timezone"] ?? "UTC";
     $this->setupApplicationTimezone();
     // environment
     $this->env = getenv("ENV") ?? "dev";
     // application namespace
     $this->namespace = $options["namespace"] ?? null;
     if (is_null($this->namespace)) {
         throw new Exception("App Namespace not given.");
     }
     // configure
     $this->config = (object) (require $this->rootpath . "/config/" . $this->env . ".php");
     // register autoloader
     $this->registerAutoloader();
 }
Exemplo n.º 29
0
function openxml($filepath, &$error_str = false)
{
    $xmlstr = @file_get_contents($filepath);
    if ($xmlstr == false) {
        $error_str = "failed to open file {$filepath}";
        return false;
    }
    $options = LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_ERR_NONE | LIBXML_COMPACT;
    $xmldoc = new DOMDocument();
    $xmldoc->strictErrorChecking = false;
    $xmldoc->recover = true;
    $old = error_reporting(0);
    $old_libxml = libxml_use_internal_errors(true);
    $ret = @$xmldoc->loadXml($xmlstr, $options);
    if ($ret == false) {
        $error_str = "failed to load xml from {$filepath}";
        return false;
    }
    $errors = libxml_get_errors();
    if (count($errors) > 0) {
        foreach ($errors as $error) {
            if ($error->level == LIBXML_ERR_FATAL) {
                $error_str = "file: {{$filepath}} line: {$error->line} column: {$error->column}: fatal error: {$error->code}: {$error->message}";
                return false;
            }
        }
    }
    $xml = @simplexml_import_dom($xmldoc);
    error_reporting($old);
    libxml_use_internal_errors($old_libxml);
    return $xml;
}
Exemplo n.º 30
0
 function RenderComponents($arParams)
 {
     global $USER;
     $bLPA = !$USER->CanDoOperation('edit_php');
     $startCount = CEditorUtils::StartFetchCSS();
     // Start fetch CSS files
     $arParams['name'] = addslashes($arParams['name']);
     $arParams['template'] = addslashes($arParams['template']);
     $arParams['siteTemplateId'] = addslashes($arParams['siteTemplateId']);
     if ($arParams['siteTemplateId'] && !defined("SITE_TEMPLATE_ID")) {
         define("SITE_TEMPLATE_ID", $arParams['siteTemplateId']);
     }
     // Report only errors
     error_reporting(E_ERROR);
     if ($arParams['name']) {
         // one component by name
         $s = CEditorUtils::_RenderOneComponent($arParams, $bLPA);
     } elseif ($arParams['source']) {
         // all components from content
         $s = CEditorUtils::_RenderAllComponents($arParams, $bLPA);
     }
     CEditorUtils::GetCSS($startCount);
     // Echo path to css
     // Cut out all scripts
     $s = preg_replace("/<script[^>]*?>[\\s|\\S]*?<\\/script>/is", '', $s);
     // Cut out <div class="bx-component-panel"> .... </div>
     $s = preg_replace("/<div[^>]*?class=\"bx-component-panel\"[^>]*?>[^<]*?<table[\\s|\\S]*?<\\/table>[^<]*?<\\/div>/is", '', $s);
     echo $s;
 }