Exemplo n.º 1
0
 function __construct($options_or_dsn = null, $options = array())
 {
     if (is_null($options_or_dsn) && !empty($_SERVER['SENTRY_DSN'])) {
         // Read from environment
         $options_or_dsn = $_SERVER['SENTRY_DSN'];
     }
     if (!is_array($options_or_dsn)) {
         if (!empty($options_or_dsn)) {
             // Must be a valid DSN
             $options_or_dsn = self::parseDSN($options_or_dsn);
         } else {
             $options_or_dsn = array();
         }
     }
     $options = array_merge($options_or_dsn, $options);
     $this->servers = Raven_Util::get($options, 'servers');
     $this->secret_key = Raven_Util::get($options, 'secret_key');
     $this->public_key = Raven_Util::get($options, 'public_key');
     $this->project = Raven_Util::get($options, 'project', 1);
     $this->auto_log_stacks = (bool) Raven_Util::get($options, 'auto_log_stacks', false);
     $this->name = Raven_Util::get($options, 'name', Raven_Compat::gethostname());
     $this->site = Raven_Util::get($options, 'site', $this->_server_variable('SERVER_NAME'));
     $this->tags = Raven_Util::get($options, 'tags', array());
     $this->trace = (bool) Raven_Util::get($options, 'trace', true);
     // XXX: Signing is disabled by default as it is no longer required by modern versions of Sentrys
     $this->signing = (bool) Raven_Util::get($options, 'signing', false);
     $this->processors = array();
     foreach (Raven_util::get($options, 'processors', $this->getDefaultProcessors()) as $processor) {
         $this->processors[] = new $processor($this);
     }
     $this->_lasterror = null;
 }
 public function __construct($options_or_dsn = null, $options = array())
 {
     if (is_array($options_or_dsn)) {
         $options = array_merge($options_or_dsn, $options);
     }
     if (!is_array($options_or_dsn) && !empty($options_or_dsn)) {
         $dsn = $options_or_dsn;
     } elseif (!empty($_SERVER['SENTRY_DSN'])) {
         $dsn = @$_SERVER['SENTRY_DSN'];
     } elseif (!empty($options['dsn'])) {
         $dsn = $options['dsn'];
     } else {
         $dsn = null;
     }
     if (!empty($dsn)) {
         $options = array_merge($options, self::parseDSN($dsn));
     }
     $this->logger = Raven_Util::get($options, 'logger', 'php');
     $this->server = Raven_Util::get($options, 'server');
     $this->secret_key = Raven_Util::get($options, 'secret_key');
     $this->public_key = Raven_Util::get($options, 'public_key');
     $this->project = Raven_Util::get($options, 'project', 1);
     $this->auto_log_stacks = (bool) Raven_Util::get($options, 'auto_log_stacks', false);
     $this->name = Raven_Util::get($options, 'name', Raven_Compat::gethostname());
     $this->site = Raven_Util::get($options, 'site', $this->_server_variable('SERVER_NAME'));
     $this->tags = Raven_Util::get($options, 'tags', array());
     $this->release = Raven_Util::get($options, 'release', null);
     $this->environment = Raven_Util::get($options, 'environment', null);
     $this->trace = (bool) Raven_Util::get($options, 'trace', true);
     $this->timeout = Raven_Util::get($options, 'timeout', 2);
     $this->message_limit = Raven_Util::get($options, 'message_limit', self::MESSAGE_LIMIT);
     $this->exclude = Raven_Util::get($options, 'exclude', array());
     $this->severity_map = null;
     $this->shift_vars = (bool) Raven_Util::get($options, 'shift_vars', true);
     $this->http_proxy = Raven_Util::get($options, 'http_proxy');
     $this->extra_data = Raven_Util::get($options, 'extra', array());
     $this->send_callback = Raven_Util::get($options, 'send_callback', null);
     $this->curl_method = Raven_Util::get($options, 'curl_method', 'sync');
     $this->curl_path = Raven_Util::get($options, 'curl_path', 'curl');
     $this->curl_ipv4 = Raven_util::get($options, 'curl_ipv4', true);
     $this->ca_cert = Raven_Util::get($options, 'ca_cert', $this->get_default_ca_cert());
     $this->verify_ssl = Raven_Util::get($options, 'verify_ssl', true);
     $this->curl_ssl_version = Raven_Util::get($options, 'curl_ssl_version');
     $this->trust_x_forwarded_proto = Raven_Util::get($options, 'trust_x_forwarded_proto');
     // a list of prefixes used to coerce absolute paths into relative
     $this->prefixes = Raven_Util::get($options, 'prefixes', null);
     // app path is used to determine if code is part of your application
     $this->app_path = Raven_Util::get($options, 'app_path', null);
     $this->processors = $this->setProcessorsFromOptions($options);
     $this->_lasterror = null;
     $this->_last_event_id = null;
     $this->_user = null;
     $this->context = new Raven_Context();
     $this->breadcrumbs = new Raven_Breadcrumbs();
     $this->sdk = Raven_Util::get($options, 'sdk', array('name' => 'sentry-php', 'version' => self::VERSION));
     if ($this->curl_method == 'async') {
         $this->_curl_handler = new Raven_CurlHandler($this->get_curl_options());
     }
 }
Exemplo n.º 3
0
 public function __construct($options_or_dsn = null, $options = array())
 {
     if (is_null($options_or_dsn) && !empty($_SERVER['SENTRY_DSN'])) {
         // Read from environment
         $options_or_dsn = $_SERVER['SENTRY_DSN'];
     }
     if (!is_array($options_or_dsn)) {
         if (!empty($options_or_dsn)) {
             // Must be a valid DSN
             $options_or_dsn = self::parseDSN($options_or_dsn);
         } else {
             $options_or_dsn = array();
         }
     }
     $options = array_merge($options_or_dsn, $options);
     $this->logger = Raven_Util::get($options, 'logger', 'php');
     $this->server = Raven_Util::get($options, 'server');
     $this->secret_key = Raven_Util::get($options, 'secret_key');
     $this->public_key = Raven_Util::get($options, 'public_key');
     $this->project = Raven_Util::get($options, 'project', 1);
     $this->auto_log_stacks = (bool) Raven_Util::get($options, 'auto_log_stacks', false);
     $this->name = Raven_Util::get($options, 'name', Raven_Compat::gethostname());
     $this->site = Raven_Util::get($options, 'site', $this->_server_variable('SERVER_NAME'));
     $this->tags = Raven_Util::get($options, 'tags', array());
     $this->release = Raven_util::get($options, 'release', null);
     $this->environment = Raven_util::get($options, 'environment', null);
     $this->trace = (bool) Raven_Util::get($options, 'trace', true);
     $this->timeout = Raven_Util::get($options, 'timeout', 2);
     $this->message_limit = Raven_Util::get($options, 'message_limit', self::MESSAGE_LIMIT);
     $this->exclude = Raven_Util::get($options, 'exclude', array());
     $this->severity_map = null;
     $this->shift_vars = (bool) Raven_Util::get($options, 'shift_vars', true);
     $this->http_proxy = Raven_Util::get($options, 'http_proxy');
     $this->extra_data = Raven_Util::get($options, 'extra', array());
     $this->send_callback = Raven_Util::get($options, 'send_callback', null);
     $this->curl_method = Raven_Util::get($options, 'curl_method', 'sync');
     $this->curl_path = Raven_Util::get($options, 'curl_path', 'curl');
     $this->curl_ipv4 = Raven_util::get($options, 'curl_ipv4', true);
     $this->ca_cert = Raven_util::get($options, 'ca_cert', $this->get_default_ca_cert());
     $this->verify_ssl = Raven_util::get($options, 'verify_ssl', true);
     $this->curl_ssl_version = Raven_Util::get($options, 'curl_ssl_version');
     $this->trust_x_forwarded_proto = Raven_Util::get($options, 'trust_x_forwarded_proto');
     $this->processors = $this->setProcessorsFromOptions($options);
     $this->_lasterror = null;
     $this->_user = null;
     $this->context = new Raven_Context();
     if ($this->curl_method == 'async') {
         $this->_curl_handler = new Raven_CurlHandler($this->get_curl_options());
     }
 }
 public function __construct($options_or_dsn = null, $options = array())
 {
     if (is_null($options_or_dsn) && !empty($_SERVER['SENTRY_DSN'])) {
         // Read from environment
         $options_or_dsn = $_SERVER['SENTRY_DSN'];
     }
     if (!is_array($options_or_dsn)) {
         if (!empty($options_or_dsn)) {
             // Must be a valid DSN
             $options_or_dsn = self::parseDSN($options_or_dsn);
         } else {
             $options_or_dsn = array();
         }
     }
     $options = array_merge($options_or_dsn, $options);
     $this->logger = Raven_Util::get($options, 'logger', 'php');
     $this->servers = Raven_Util::get($options, 'servers');
     $this->secret_key = Raven_Util::get($options, 'secret_key');
     $this->public_key = Raven_Util::get($options, 'public_key');
     $this->project = Raven_Util::get($options, 'project', 1);
     $this->auto_log_stacks = (bool) Raven_Util::get($options, 'auto_log_stacks', false);
     $this->name = Raven_Util::get($options, 'name', Raven_Compat::gethostname());
     $this->site = Raven_Util::get($options, 'site', $this->_server_variable('SERVER_NAME'));
     $this->tags = Raven_Util::get($options, 'tags', array());
     $this->trace = (bool) Raven_Util::get($options, 'trace', true);
     $this->timeout = Raven_Util::get($options, 'timeout', 2);
     $this->exclude = Raven_Util::get($options, 'exclude', array());
     $this->severity_map = NULL;
     $this->shift_vars = (bool) Raven_Util::get($options, 'shift_vars', true);
     $this->http_proxy = Raven_Util::get($options, 'http_proxy');
     $this->extra_data = Raven_Util::get($options, 'extra', array());
     $this->send_callback = Raven_Util::get($options, 'send_callback', null);
     $this->curl_method = Raven_Util::get($options, 'curl_method', 'async');
     $this->curl_path = Raven_Util::get($options, 'curl_path', 'curl');
     $this->processors = array();
     foreach (Raven_util::get($options, 'processors', self::getDefaultProcessors()) as $processor) {
         $this->processors[] = new $processor($this);
     }
     $this->_lasterror = null;
     $this->_user = null;
     $this->context = new Raven_Context();
     if ($this->curl_method == 'async') {
         $this->_curl_handler = new Raven_CurlHandler($this->get_curl_options());
     }
 }
Exemplo n.º 5
0
 public function testGetReturnsPresentValuesEvenWhenEmpty()
 {
     $input = array('foo' => '');
     $result = Raven_Util::get($input, 'foo', 'bar');
     $this->assertEquals('', $result);
 }