Skip to content

Commit

Permalink
Merge branch 'master' into releases/1.8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
stayallive committed Mar 20, 2018
2 parents 6cd5114 + 7843378 commit ef1d7c8
Show file tree
Hide file tree
Showing 10 changed files with 297 additions and 27 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

- ...

## 1.8.4 (2018-03-20)

- Revert ignoring fatal errors on PHP 7+ (#571)
- Add PHP runtime information (#564)
- Cleanup the `site` value if it's empty (#555)
- Add `application/json` input handling (#546)

## 1.8.3 (2018-02-07)

- Serialize breadcrumbs to prevent issues with binary data (#538)
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# Sentry for PHP

[![Build Status](https://secure.travis-ci.org/getsentry/sentry-php.png?branch=master)](http://travis-ci.org/getsentry/sentry-php)
[![Total Downloads](https://img.shields.io/packagist/dt/sentry/sentry.svg?style=flat-square)](https://packagist.org/packages/sentry/sentry)
[![Downloads per month](https://img.shields.io/packagist/dm/sentry/sentry.svg?style=flat-square)](https://packagist.org/packages/sentry/sentry)
[![Latest stable version](https://img.shields.io/packagist/v/sentry/sentry.svg?style=flat-square)](https://packagist.org/packages/sentry/sentry)
[![License](http://img.shields.io/packagist/l/sentry/sentry.svg?style=flat-square)](https://packagist.org/packages/sentry/sentry)
[![Total Downloads](https://poser.pugx.org/sentry/sentry/downloads)](https://packagist.org/packages/sentry/sentry)
[![Monthly Downloads](https://poser.pugx.org/sentry/sentry/d/monthly)](https://packagist.org/packages/sentry/sentry)
[![Latest Stable Version](https://poser.pugx.org/sentry/sentry/v/stable)](https://packagist.org/packages/sentry/sentry)
[![License](https://poser.pugx.org/sentry/sentry/license)](https://packagist.org/packages/sentry/sentry)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/getsentry/sentry-php/master.svg)](https://scrutinizer-ci.com/g/getsentry/sentry-php/)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/getsentry/sentry-php/master.svg)](https://scrutinizer-ci.com/g/getsentry/sentry-php/)

Expand Down Expand Up @@ -103,7 +103,7 @@ $ git checkout -b releases/1.9.x

3. Update the hardcoded version tag in ``Client.php``:

```
```php
class Raven_Client
{
const VERSION = '1.9.0';
Expand Down Expand Up @@ -142,7 +142,7 @@ git checkout master

9. Update the version in ``Client.php``:

```
```php
class Raven_Client
{
const VERSION = '1.10.x-dev';
Expand All @@ -151,7 +151,7 @@ class Raven_Client

10. Lastly, update the composer version in ``composer.json``:

```
```json
"extra": {
"branch-alias": {
"dev-master": "1.10.x-dev"
Expand Down
8 changes: 4 additions & 4 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ The following settings are available for the client:
'User-Agent' => $client->getUserAgent(),
'X-Sentry-Auth' => $client->getAuthHeader(),
),
'body' => gzipCompress(jsonEncode($data)),
'body' => gzcompress(jsonEncode($data)),
))
},
Expand Down Expand Up @@ -221,7 +221,7 @@ The following settings are available for the client:
.. describe:: processors

An array of classes to use to process data before it is sent to
Sentry. By default, ``Raven_SanitizeDataProcessor`` is used
Sentry. By default, ``Raven_Processor_SanitizeDataProcessor`` is used

.. describe:: processorOptions

Expand All @@ -230,12 +230,12 @@ The following settings are available for the client:
the list of processors used by ``Raven_Client``

An example of overriding the regular expressions in
``Raven_SanitizeDataProcessor`` is below:
``Raven_Processor_SanitizeDataProcessor`` is below:

.. code-block:: php
'processorOptions' => array(
'Raven_SanitizeDataProcessor' => array(
'Raven_Processor_SanitizeDataProcessor' => array(
'fields_re' => '/(user_password|user_token|user_secret)/i',
'values_re' => '/^(?:\d[ -]*?){15,16}$/'
)
Expand Down
2 changes: 2 additions & 0 deletions docs/integrations/laravel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ step is not required anymore an you can skip ahead to the next one:
<?php
use Symfony\Component\HttpKernel\Exception\HttpException;
class Handler extends ExceptionHandler
{
public function report(Exception $exception)
Expand Down
6 changes: 3 additions & 3 deletions docs/sentry-doc-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"type": "framework",
"doc_link": "integrations/laravel/",
"wizard": [
"index#installation",
"integrations/laravel#laravel-5-x"
"integrations/laravel#laravel-5-x",
"integrations/laravel#laravel-4-x",
"integrations/laravel#lumen-5-x"
]
},
"php.monolog": {
Expand All @@ -34,7 +35,6 @@
"type": "framework",
"doc_link": "integrations/symfony2/",
"wizard": [
"index#installation",
"integrations/symfony2#symfony-2"
]
}
Expand Down
31 changes: 29 additions & 2 deletions lib/Raven/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ public function setEnvironment($value)
return $this;
}

/**
* Note: Prior to PHP 5.6, a stream opened with php://input can
* only be read once;
*
* @see http://php.net/manual/en/wrappers.php.php
*/
protected static function getInputStream()
{
if (PHP_VERSION_ID < 50600) {
return null;
}

return file_get_contents('php://input');
}

private static function getDefaultPrefixes()
{
$value = get_include_path();
Expand Down Expand Up @@ -437,7 +452,7 @@ public function setProcessorsFromOptions($options)
* @param string $dsn Raven compatible DSN
* @return array parsed DSN
*
* @doc http://raven.readthedocs.org/en/latest/config/#the-sentry-dsn
* @see http://raven.readthedocs.org/en/latest/config/#the-sentry-dsn
*/
public static function parseDSN($dsn)
{
Expand Down Expand Up @@ -748,6 +763,11 @@ protected function get_http_data()
// instead of a mapping which goes against the defined Sentry spec
if (!empty($_POST)) {
$result['data'] = $_POST;
} elseif (isset($_SERVER['CONTENT_TYPE']) && stripos($_SERVER['CONTENT_TYPE'], 'application/json') === 0) {
$raw_data = $this->getInputStream() ?: false;
if ($raw_data !== false) {
$result['data'] = (array) json_decode($raw_data, true) ?: null;
}
}
if (!empty($_COOKIE)) {
$result['cookies'] = $_COOKIE;
Expand Down Expand Up @@ -861,6 +881,13 @@ public function capture($data, $stack = null, $vars = null)
if (empty($data['request'])) {
unset($data['request']);
}
if (empty($data['site'])) {
unset($data['site']);
}

$existing_runtime_context = isset($data['contexts']['runtime']) ? $data['contexts']['runtime'] : array();
$runtime_context = array('version' => PHP_VERSION, 'name' => 'php');
$data['contexts']['runtime'] = array_merge($runtime_context, $existing_runtime_context);

if (!$this->breadcrumbs->is_empty()) {
$data['breadcrumbs'] = $this->breadcrumbs->fetch();
Expand Down Expand Up @@ -1042,7 +1069,7 @@ protected static function get_default_ca_cert()

/**
* @return array
* @doc http://stackoverflow.com/questions/9062798/php-curl-timeout-is-not-working/9063006#9063006
* @see http://stackoverflow.com/questions/9062798/php-curl-timeout-is-not-working/9063006#9063006
*/
protected function get_curl_options()
{
Expand Down
7 changes: 0 additions & 7 deletions lib/Raven/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,6 @@ public function handleFatalError()

public function shouldCaptureFatalError($type)
{
// Do not capture E_ERROR since those can be caught by userland since PHP 7.0
// E_ERROR should already be handled by the exception handler
// This prevents duplicated exceptions in PHP 7.0+
if (PHP_VERSION_ID >= 70000 && $type === E_ERROR) {
return false;
}

return $type & $this->fatal_error_types;
}

Expand Down
Loading

0 comments on commit ef1d7c8

Please # to comment.