public function test_json_encode() { $result = Raven_Compat::json_encode(array('foo' => array('bar' => 1))); $this->assertEquals($result, '{"foo":{"bar":1}}'); $result = Raven_Compat::_json_encode(array('foo' => array('bar' => 1))); $this->assertEquals($result, '{"foo":{"bar":1}}'); }
public function test_json_encode() { $result = Raven_Compat::json_encode(array('foo' => array('bar' => 1))); $this->assertEquals('{"foo":{"bar":1}}', $result); $result = Raven_Compat::_json_encode(array('foo' => array('bar' => 1))); $this->assertEquals('{"foo":{"bar":1}}', $result); $result = Raven_Compat::_json_encode(array(1, 2, 3, 4, 'foo', 'bar')); $this->assertEquals('[1,2,3,4,"foo","bar"]', $result); $result = Raven_Compat::_json_encode(array(1, 'foo', 'foobar' => 'bar')); $this->assertEquals('{0:1,1:"foo","foobar":"bar"}', $result); $result = Raven_Compat::_json_encode(array(array())); $this->assertEquals('[[]]', $result); }
/** * Create a signature */ private function get_signature($message, $timestamp, $key) { return Raven_Compat::hash_hmac('sha1', sprintf('%F', $timestamp) . ' ' . $message, $key); }
/** * Wrapper to handle encoding and sending data to all defined Sentry servers * * @param array $data Associative array of data to log */ public function send($data) { if (is_callable($this->send_callback) && !call_user_func($this->send_callback, $data)) { // if send_callback returns falsely, end native send return; } if (!$this->servers) { return; } $message = Raven_Compat::json_encode($data); if (function_exists("gzcompress")) { $message = gzcompress($message); } $message = base64_encode($message); // PHP's builtin curl_* function are happy without this, but the exec method requires it foreach ($this->servers as $url) { $client_string = 'raven-php/' . self::VERSION; $timestamp = microtime(true); $headers = array('User-Agent' => $client_string, 'X-Sentry-Auth' => $this->get_auth_header($timestamp, $client_string, $this->public_key, $this->secret_key), 'Content-Type' => 'application/octet-stream'); $this->send_remote($url, $message, $headers); } }
<?php return ['enabled' => false, 'dsn' => '', 'options' => ['name' => Raven_Compat::gethostname(), 'tags' => [], 'curl_method' => 'sync', 'curl_path' => 'curl', 'trace' => true, 'logger' => 'php', 'message_limit' => 1024]];