update v1.0.4
This commit is contained in:
10
vendor/bugsnag/bugsnag-laravel/CHANGELOG.md
vendored
10
vendor/bugsnag/bugsnag-laravel/CHANGELOG.md
vendored
@@ -1,6 +1,16 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
1.6.2
|
||||
-----
|
||||
|
||||
### Enhancements
|
||||
|
||||
- Add support for configuring the notifier completely from
|
||||
[environment variables](https://github.com/bugsnag/bugsnag-laravel#environment-variables)
|
||||
| [Andrew](https://github.com/browner12)
|
||||
| [#71](https://github.com/bugsnag/bugsnag-laravel/pull/71)
|
||||
|
||||
1.6.1
|
||||
-----
|
||||
- Fix array syntax for older php
|
||||
|
||||
23
vendor/bugsnag/bugsnag-laravel/CONTRIBUTING.md
vendored
23
vendor/bugsnag/bugsnag-laravel/CONTRIBUTING.md
vendored
@@ -2,28 +2,15 @@ Contributing
|
||||
============
|
||||
|
||||
- [Fork](https://help.github.com/articles/fork-a-repo) the [notifier on github](https://github.com/bugsnag/bugsnag-laravel)
|
||||
- Build and test your changes
|
||||
- Build and test your changes:
|
||||
```
|
||||
composer install && ./vendor/bin/phpunit
|
||||
```
|
||||
|
||||
- Commit and push until you are happy with your contribution
|
||||
- [Make a pull request](https://help.github.com/articles/using-pull-requests)
|
||||
- Thanks!
|
||||
|
||||
Example apps
|
||||
============
|
||||
|
||||
Bugsnag supports both Laravel 4 and Laravel 5. You can test these out by running the locally.
|
||||
|
||||
brew tap josegonzalez/homebrew-php
|
||||
brew install php56 php56-mcrypt composer
|
||||
|
||||
Then cd into `example/laravel-4` and start the server:
|
||||
|
||||
composer install
|
||||
php56 artisan serve --port 8004
|
||||
|
||||
The same works for `example/laravel-5` and start the server:
|
||||
|
||||
composer install
|
||||
php56 artisan serve --port 8005
|
||||
|
||||
Releasing
|
||||
=========
|
||||
|
||||
159
vendor/bugsnag/bugsnag-laravel/README.md
vendored
159
vendor/bugsnag/bugsnag-laravel/README.md
vendored
@@ -11,11 +11,33 @@ capturing errors from your applications.
|
||||
|
||||
Check out this excellent [Laracasts screencast](https://laracasts.com/lessons/better-error-tracking-with-bugsnag) for a quick overview of how to use Bugsnag with your Laravel apps.
|
||||
|
||||
Contents
|
||||
--------
|
||||
|
||||
How to Install
|
||||
- [Getting Started](#getting-started)
|
||||
- [Installation](#installation)
|
||||
- [Laravel 5.0+](#laravel-50)
|
||||
- [Laravel (Older Versions)](#laravel-older-versions)
|
||||
- [Lumen](#lumen)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [Usage](#usage)
|
||||
- [Catching and Reporting Exceptions](#catching-and-reporting-exceptions)
|
||||
- [Sending Non-fatal Exceptions](#sending-non-fatal-exceptions)
|
||||
- [Configuration Options](#configuration-options)
|
||||
- [Error Reporting Levels](#error-reporting-levels)
|
||||
- [Callbacks](#callbacks)
|
||||
- [Demo Applications](#demo-applications)
|
||||
- [Support](#support)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
### Laravel 5.0 +
|
||||
### Installation
|
||||
|
||||
#### Laravel 5.0+
|
||||
|
||||
1. Install the `bugsnag/bugsnag-laravel` package
|
||||
|
||||
@@ -68,7 +90,7 @@ How to Install
|
||||
1. Create the configuration file `config/bugsnag.php`:
|
||||
|
||||
```shell
|
||||
$ php artisan vendor:publish
|
||||
$ php artisan vendor:publish --provider="Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider"
|
||||
```
|
||||
|
||||
1. Configure your `api_key` in your `.env` file:
|
||||
@@ -87,7 +109,9 @@ How to Install
|
||||
);
|
||||
```
|
||||
|
||||
### Laravel < 5.0
|
||||
#### Laravel (Older Versions)
|
||||
|
||||
For versions of Laravel before 5.0:
|
||||
|
||||
1. Install the `bugsnag/bugsnag-laravel` package
|
||||
|
||||
@@ -137,7 +161,7 @@ How to Install
|
||||
```
|
||||
|
||||
|
||||
### Lumen
|
||||
#### Lumen
|
||||
|
||||
1. In `bootstrap/app.php` add the line
|
||||
|
||||
@@ -170,41 +194,35 @@ How to Install
|
||||
);
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
In addition to `BUGSNAG_API_KEY`, other configuration keys can be automatically
|
||||
populated in `config.php` from your `.env` file:
|
||||
|
||||
- `BUGSNAG_API_KEY`: Your API key. You can find your API key on your Bugsnag
|
||||
dashboard.
|
||||
- `BUGSNAG_NOTIFY_RELEASE_STAGES`: Set which release stages should send
|
||||
notifications to Bugsnag.
|
||||
- `BUGSNAG_ENDPOINT`: Set what server to which the Bugsnag notifier should send
|
||||
errors. The default is https://notify.bugsnag.com, but for Bugsnag Enterprise
|
||||
the endpoint should be the URL of your Bugsnag instance.
|
||||
- `BUGSNAG_FILTERS`: Set which keys are filtered from metadata is sent to
|
||||
Bugsnag.
|
||||
- `BUGSNAG_PROXY`: Set the configuration options for your server if it is behind
|
||||
a proxy server. Additional details are available in the
|
||||
[sample configuration](src/Bugsnag/BugsnagLaravel/config.php#L56).
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Sending Custom Data With Exceptions
|
||||
-----------------------------------
|
||||
### Catching and Reporting Exceptions
|
||||
|
||||
It is often useful to send additional meta-data about your app, such as
|
||||
information about the currently logged in user, along with any
|
||||
error or exceptions, to help debug problems.
|
||||
|
||||
To send custom data, you should define a *before-notify* function,
|
||||
adding an array of "tabs" of custom data to the $metaData parameter. For example:
|
||||
|
||||
```php
|
||||
Bugsnag::setBeforeNotifyFunction("before_bugsnag_notify");
|
||||
|
||||
function before_bugsnag_notify($error) {
|
||||
// Do any custom error handling here
|
||||
|
||||
// Also add some meta data to each error
|
||||
$error->setMetaData(array(
|
||||
"user" => array(
|
||||
"name" => "James",
|
||||
"email" => "james@example.com"
|
||||
)
|
||||
));
|
||||
}
|
||||
```
|
||||
|
||||
See the [setBeforeNotifyFunction](https://bugsnag.com/docs/notifiers/php#setbeforenotifyfunction)
|
||||
documentation on the `bugsnag-php` library for more information.
|
||||
Bugsnag works "out of the box" for reporting unhandled exceptions in
|
||||
Laravel and Lumen apps.
|
||||
|
||||
|
||||
Sending Custom Errors or Non-Fatal Exceptions
|
||||
---------------------------------------------
|
||||
### Sending Non-fatal Exceptions
|
||||
|
||||
You can easily tell Bugsnag about non-fatal or caught exceptions by
|
||||
calling `Bugsnag::notifyException`:
|
||||
@@ -231,9 +249,16 @@ $metaData = array(
|
||||
);
|
||||
```
|
||||
|
||||
Additional data can be sent with exceptions as an options hash as detailed in the [Notification Options](docs/Notification Options.md) documentation, including some [options specific to non-fatal exceptions](docs/Notification Options.md#handled-notification-options).
|
||||
|
||||
Error Reporting Levels
|
||||
----------------------
|
||||
|
||||
### Configuration Options
|
||||
|
||||
The [Bugsnag PHP Client](https://bugsnag.com/docs/notifiers/php)
|
||||
is available as `Bugsnag`, which allows you to set various
|
||||
configuration options. These options are listed in the [documentation for Bugsnag PHP](https://bugsnag.com/docs/notifiers/php#additional-options).
|
||||
|
||||
#### Error Reporting Levels
|
||||
|
||||
By default we'll use the value of `error_reporting` from your `php.ini`
|
||||
or any value you set at runtime using the `error_reporting(...)` function.
|
||||
@@ -245,43 +270,67 @@ If you'd like to send different levels of errors to Bugsnag, you can call
|
||||
Bugsnag::setErrorReportingLevel(E_ALL & ~E_NOTICE);
|
||||
```
|
||||
|
||||
#### Callbacks
|
||||
|
||||
Additional Configuration
|
||||
------------------------
|
||||
It is often useful to send additional meta-data about your app, such as
|
||||
information about the currently logged in user, along with any
|
||||
error or exceptions, to help debug problems.
|
||||
|
||||
The [Bugsnag PHP Client](https://bugsnag.com/docs/notifiers/php)
|
||||
is available as `Bugsnag`, which allows you to set various
|
||||
configuration options, for example:
|
||||
To send custom data, you should define a *before-notify* function,
|
||||
adding an array of "tabs" of custom data to the $metaData parameter. For example:
|
||||
|
||||
```php
|
||||
Bugsnag::setReleaseStage("production");
|
||||
Bugsnag::setBeforeNotifyFunction("before_bugsnag_notify");
|
||||
|
||||
function before_bugsnag_notify($error) {
|
||||
// Do any custom error handling here
|
||||
|
||||
// Also add some meta data to each error
|
||||
$error->setMetaData(array(
|
||||
"user" => array(
|
||||
"name" => "James",
|
||||
"email" => "james@example.com"
|
||||
)
|
||||
));
|
||||
}
|
||||
```
|
||||
|
||||
See the [Bugsnag Notifier for PHP documentation](https://bugsnag.com/docs/notifiers/php#additional-configuration)
|
||||
for full configuration details.
|
||||
This example snippet adds a "user" tab to the Bugsnag error report. See the [setBeforeNotifyFunction](https://bugsnag.com/docs/notifiers/php#setbeforenotifyfunction)
|
||||
documentation on the `bugsnag-php` library for more information.
|
||||
|
||||
|
||||
Reporting Bugs or Feature Requests
|
||||
----------------------------------
|
||||
Demo Applications
|
||||
-----------------
|
||||
|
||||
Please report any bugs or feature requests on the github issues page for this
|
||||
project here:
|
||||
The [Bugsnag Laravel source repository](https://github.com/bugsnag/bugsnag-laravel) includes example applications for [Laravel 4, Laravel 5, and Lumen](https://github.com/bugsnag/bugsnag-laravel/tree/master/example).
|
||||
|
||||
<https://github.com/bugsnag/bugsnag-laravel/issues>
|
||||
Before running one of the example applications, install the prerequisites:
|
||||
|
||||
brew tap josegonzalez/homebrew-php
|
||||
brew install php56 php56-mcrypt composer
|
||||
|
||||
Then open the example directory (such as `example/laravel-5.1`) in a terminal and start the server:
|
||||
|
||||
composer install
|
||||
php56 artisan serve --port 8004
|
||||
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
* [Additional Documentation](https://github.com/bugsnag/bugsnag-laravel/tree/master/docs)
|
||||
* [Search open and closed issues](https://github.com/bugsnag/bugsnag-laravel/issues?utf8=✓&q=is%3Aissue) for similar problems
|
||||
* [Report a bug or request a feature](https://github.com/bugsnag/bugsnag-laravel/issues/new)
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
- [Fork](https://help.github.com/articles/fork-a-repo) the [notifier on github](https://github.com/bugsnag/bugsnag-laravel)
|
||||
- Commit and push until you are happy with your contribution
|
||||
- Run the tests to make sure they all pass: `composer install && ./vendor/bin/phpunit`
|
||||
- [Make a pull request](https://help.github.com/articles/using-pull-requests)
|
||||
- Thanks!
|
||||
We'd love you to file issues and send pull requests. The [contributing guidelines](https://github.com/bugsnag/bugsnag-laravel/CONTRIBUTING.md) details the process of building and testing `bugsnag-laravel`, as well as the pull request process. Feel free to comment on [existing issues](https://github.com/bugsnag/bugsnag-laravel/issues) for clarification or starting points.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
The Bugsnag Laravel notifier is free software released under the MIT License.
|
||||
See [LICENSE.txt](https://github.com/bugsnag/bugsnag-laravel/blob/master/LICENSE.txt) for details.
|
||||
See [LICENSE.txt](LICENSE.txt) for details.
|
||||
|
||||
@@ -66,7 +66,7 @@ class BugsnagLaravelServiceProvider extends ServiceProvider
|
||||
$client->setReleaseStage($app->environment());
|
||||
$client->setNotifier(array(
|
||||
'name' => 'Bugsnag Laravel',
|
||||
'version' => '1.6.1',
|
||||
'version' => '1.6.2',
|
||||
'url' => 'https://github.com/bugsnag/bugsnag-laravel'
|
||||
));
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ return array(
|
||||
| Example: array('development', 'production')
|
||||
|
|
||||
*/
|
||||
'notify_release_stages' => null,
|
||||
'notify_release_stages' => env('BUGSNAG_NOTIFY_RELEASE_STAGES', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -37,7 +37,7 @@ return array(
|
||||
| this should be the URL to your Bugsnag instance.
|
||||
|
|
||||
*/
|
||||
'endpoint' => null,
|
||||
'endpoint' => env('BUGSNAG_ENDPOINT', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -49,7 +49,7 @@ return array(
|
||||
| contain these strings will be filtered.
|
||||
|
|
||||
*/
|
||||
'filters' => array('password'),
|
||||
'filters' => env('BUGSNAG_FILTERS', array('password')),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -72,6 +72,6 @@ return array(
|
||||
| )
|
||||
|
|
||||
*/
|
||||
'proxy' => null
|
||||
'proxy' => env('BUGSNAG_PROXY', null)
|
||||
|
||||
);
|
||||
|
||||
6
vendor/bugsnag/bugsnag/.gitignore
vendored
6
vendor/bugsnag/bugsnag/.gitignore
vendored
@@ -1,2 +1,4 @@
|
||||
vendor
|
||||
composer.lock
|
||||
/vendor
|
||||
/composer.lock
|
||||
/composer.phar
|
||||
/.idea
|
||||
|
||||
5
vendor/bugsnag/bugsnag/.travis.yml
vendored
5
vendor/bugsnag/bugsnag/.travis.yml
vendored
@@ -1,3 +1,4 @@
|
||||
sudo: false
|
||||
language: php
|
||||
php:
|
||||
- 5.6
|
||||
@@ -6,7 +7,3 @@ php:
|
||||
- 5.3
|
||||
- 5.2
|
||||
- hhvm
|
||||
notifications:
|
||||
hipchat:
|
||||
rooms:
|
||||
secure: CP1Pqa5TRwHtft3UQRZpnnw/mRCAVtXAn5S/Am45uk4fpGGFLf3F/mHKOgjDeALB/aVyJQvHV/Lr2KrgY7FWOjOdzXVVwLDtGoXXimvqxGEjvSFQMiJGKiwm7Thw41EqwHOZUxIKLtJBByP36bqvx4zXxUeNbCTc4T2f92eiZps=
|
||||
|
||||
18
vendor/bugsnag/bugsnag/CHANGELOG.md
vendored
18
vendor/bugsnag/bugsnag/CHANGELOG.md
vendored
@@ -1,6 +1,24 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
2.6.0 (23 Dec 2015)
|
||||
-----
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Add support for PHP 7's Throwable
|
||||
| [Chris Stone](https://github.com/cmstone)
|
||||
| [#106](https://github.com/bugsnag/bugsnag-php/pull/106)
|
||||
|
||||
* Fix errors which arise from from error payloads not encoded using UTF-8
|
||||
| [GaetanNaulin](https://github.com/GaetanNaulin)
|
||||
| [#104](https://github.com/bugsnag/bugsnag-php/pull/104)
|
||||
| [#105](https://github.com/bugsnag/bugsnag-php/pull/105)
|
||||
|
||||
2.5.6
|
||||
-----
|
||||
- Added a debug flag to help diagnose notification problems
|
||||
|
||||
2.5.5
|
||||
-----
|
||||
- Ensure no unnecessary code is executed when errors should be skipped
|
||||
|
||||
26
vendor/bugsnag/bugsnag/CONTRIBUTING.md
vendored
26
vendor/bugsnag/bugsnag/CONTRIBUTING.md
vendored
@@ -2,7 +2,7 @@ Contributing
|
||||
============
|
||||
|
||||
- [Fork](https://help.github.com/articles/fork-a-repo) the [notifier on github](https://github.com/bugsnag/bugsnag-laravel)
|
||||
- Build and test your changes
|
||||
- Build and test your changes. Run the tests using [phpunit](https://phpunit.de) (vendored to `vendor/bin/phpunit`)
|
||||
- Commit and push until you are happy with your contribution
|
||||
- [Make a pull request](https://help.github.com/articles/using-pull-requests)
|
||||
- Thanks!
|
||||
@@ -22,15 +22,27 @@ Releasing
|
||||
=========
|
||||
|
||||
1. Commit all outstanding changes
|
||||
1. Bump the version in `src/Bugsnag/Configuration.php`.
|
||||
2. Update the CHANGELOG.md, and README if appropriate.
|
||||
3. Build a new phar package
|
||||
2. Bump the version in `src/Bugsnag/Configuration.php`.
|
||||
3. Update the CHANGELOG.md, and README if appropriate.
|
||||
4. Build a new phar package
|
||||
* NB: You may need to set `phar.readonly = Off` in /usr/local/etc/php/5.4/php.ini
|
||||
* If not located in /usr/local/etc, check /private/etc/php.ini
|
||||
* If not in /private/etc/php.ini:
|
||||
|
||||
```
|
||||
sudo cp /private/etc/php.ini.default /private/etc/php.ini
|
||||
```
|
||||
* Then:
|
||||
|
||||
```
|
||||
composer install
|
||||
php pharbuilder.php
|
||||
```
|
||||
|
||||
4. Commit, tag push
|
||||
|
||||
git commit -am v1.x.x
|
||||
git tag v1.x.x
|
||||
git push origin master v1.x.x
|
||||
```
|
||||
git commit -am v2.x.x
|
||||
git tag v2.x.x
|
||||
git push origin master && git push --tags
|
||||
```
|
||||
|
||||
8
vendor/bugsnag/bugsnag/README.md
vendored
8
vendor/bugsnag/bugsnag/README.md
vendored
@@ -1,4 +1,4 @@
|
||||
Bugsnag Notifier for PHP
|
||||
Bugsnag Notifier for PHP <img src="https://travis-ci.org/bugsnag/bugsnag-php.svg?branch=master" alt="build status" class="build-status">
|
||||
========================
|
||||
|
||||
The Bugsnag Notifier for PHP gives you instant notification of errors and
|
||||
@@ -161,14 +161,12 @@ you can set the `releaseStage` that is reported to Bugsnag.
|
||||
$bugsnag->setReleaseStage('development');
|
||||
```
|
||||
|
||||
By default this is set to be "production".
|
||||
By default this is set to "production".
|
||||
|
||||
> Note: If you would like errors from stages other than production to be sent
|
||||
to Bugsnag, you'll also have to call `setNotifyReleaseStages`.
|
||||
|
||||
###setNotifyReleaseStages
|
||||
|
||||
By default, we will notify Bugsnag of errors that happen in any
|
||||
By default, we will notify Bugsnag of errors that happen in *any*
|
||||
`releaseStage` If you would like to change which release stages notify
|
||||
Bugsnag of errors you can call `setNotifyReleaseStages`:
|
||||
|
||||
|
||||
BIN
vendor/bugsnag/bugsnag/build/bugsnag.phar
vendored
BIN
vendor/bugsnag/bugsnag/build/bugsnag.phar
vendored
Binary file not shown.
5
vendor/bugsnag/bugsnag/example/php/README.md
vendored
5
vendor/bugsnag/bugsnag/example/php/README.md
vendored
@@ -3,13 +3,14 @@
|
||||
<http://getcomposer.org/doc/01-basic-usage.md>
|
||||
|
||||
- Install bugsnag using composer
|
||||
|
||||
|
||||
```shell
|
||||
composer install
|
||||
```
|
||||
|
||||
- Add your API key to the example script
|
||||
- Run the example script
|
||||
|
||||
```shell
|
||||
php index.php
|
||||
```
|
||||
```
|
||||
|
||||
2
vendor/bugsnag/bugsnag/example/php/index.php
vendored
2
vendor/bugsnag/bugsnag/example/php/index.php
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
require_once "../../build/bugsnag.phar";
|
||||
|
||||
$bugsnag = new Bugsnag_Client("066f5ad3590596f9aa8d601ea89af845");
|
||||
$bugsnag = new Bugsnag_Client("YOUR-API-KEY-HERE");
|
||||
$bugsnag->notifyError("Broken", "Something broke", array("tab" => array("paying" => true, "object" => (object)array("key" => "value"), "null" => NULL, "string" => "test", "int" => 4)));
|
||||
|
||||
?>
|
||||
|
||||
97
vendor/bugsnag/bugsnag/src/Bugsnag/Client.php
vendored
97
vendor/bugsnag/bugsnag/src/Bugsnag/Client.php
vendored
@@ -3,12 +3,14 @@
|
||||
class Bugsnag_Client
|
||||
{
|
||||
private $config;
|
||||
/** @var Bugsnag_Notification|null */
|
||||
private $notification;
|
||||
|
||||
/**
|
||||
* Initialize Bugsnag
|
||||
*
|
||||
* @param String $apiKey your Bugsnag API key
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($apiKey)
|
||||
{
|
||||
@@ -33,6 +35,7 @@ class Bugsnag_Client
|
||||
* Set your release stage, eg "production" or "development"
|
||||
*
|
||||
* @param String $releaseStage the app's current release stage
|
||||
* @return $this
|
||||
*/
|
||||
public function setReleaseStage($releaseStage)
|
||||
{
|
||||
@@ -45,6 +48,7 @@ class Bugsnag_Client
|
||||
* Set your app's semantic version, eg "1.2.3"
|
||||
*
|
||||
* @param String $appVersion the app's version
|
||||
* @return $this
|
||||
*/
|
||||
public function setAppVersion($appVersion)
|
||||
{
|
||||
@@ -53,10 +57,11 @@ class Bugsnag_Client
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the host name
|
||||
*
|
||||
* @param String $hostname the host name
|
||||
* @return $this
|
||||
*/
|
||||
public function setHostname($hostname)
|
||||
{
|
||||
@@ -70,6 +75,7 @@ class Bugsnag_Client
|
||||
* eg array("production", "development")
|
||||
*
|
||||
* @param Array $notifyReleaseStages array of release stages to notify for
|
||||
* @return $this
|
||||
*/
|
||||
public function setNotifyReleaseStages(array $notifyReleaseStages)
|
||||
{
|
||||
@@ -82,6 +88,7 @@ class Bugsnag_Client
|
||||
* Set which Bugsnag endpoint to send errors to.
|
||||
*
|
||||
* @param String $endpoint endpoint URL
|
||||
* @return $this
|
||||
*/
|
||||
public function setEndpoint($endpoint)
|
||||
{
|
||||
@@ -90,11 +97,25 @@ class Bugsnag_Client
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable debug mode to help diagnose problems.
|
||||
*
|
||||
* @param Boolean $debug whether to enable debug mode
|
||||
* @return $this
|
||||
*/
|
||||
public function setDebug($debug)
|
||||
{
|
||||
$this->config->debug = $debug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not to use SSL when notifying bugsnag
|
||||
*
|
||||
* @param Boolean $useSSL whether to use SSL
|
||||
* @deprecated you can now pass full URLs to setEndpoint
|
||||
* @return $this
|
||||
*/
|
||||
public function setUseSSL($useSSL)
|
||||
{
|
||||
@@ -107,6 +128,7 @@ class Bugsnag_Client
|
||||
* Set the desired timeout for cURL connection when notifying bugsnag
|
||||
*
|
||||
* @param Integer $timeout the desired timeout in seconds
|
||||
* @return $this
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
@@ -121,6 +143,7 @@ class Bugsnag_Client
|
||||
* stacktrace lines.
|
||||
*
|
||||
* @param String $projectRoot the root path for your application
|
||||
* @return $this
|
||||
*/
|
||||
public function setProjectRoot($projectRoot)
|
||||
{
|
||||
@@ -135,6 +158,7 @@ class Bugsnag_Client
|
||||
* for grouping and reduces the noise in stack traces.
|
||||
*
|
||||
* @param String $stripPath the path to strip from filenames
|
||||
* @return $this
|
||||
*/
|
||||
public function setStripPath($stripPath)
|
||||
{
|
||||
@@ -148,6 +172,7 @@ class Bugsnag_Client
|
||||
* that are part of your application.
|
||||
*
|
||||
* @param String $projectRootRegex regex matching paths belong to your project
|
||||
* @return $this
|
||||
*/
|
||||
public function setProjectRootRegex($projectRootRegex)
|
||||
{
|
||||
@@ -161,6 +186,7 @@ class Bugsnag_Client
|
||||
* to Bugsnag. Eg. array("password", "credit_card")
|
||||
*
|
||||
* @param Array $filters an array of metaData filters
|
||||
* @return $this
|
||||
*/
|
||||
public function setFilters(array $filters)
|
||||
{
|
||||
@@ -178,6 +204,7 @@ class Bugsnag_Client
|
||||
* 'name' => 'Bob Hoskins',
|
||||
* 'email' => 'bob@hoskins.com'
|
||||
* )
|
||||
* @return $this
|
||||
*/
|
||||
public function setUser(array $user)
|
||||
{
|
||||
@@ -188,6 +215,8 @@ class Bugsnag_Client
|
||||
|
||||
/**
|
||||
* @deprecated deprecated since version 2.1
|
||||
* @param $userId
|
||||
* @return $this
|
||||
*/
|
||||
public function setUserId($userId)
|
||||
{
|
||||
@@ -204,6 +233,7 @@ class Bugsnag_Client
|
||||
* Set a context representing the current type of request, or location in code.
|
||||
*
|
||||
* @param String $context the current context
|
||||
* @return $this
|
||||
*/
|
||||
public function setContext($context)
|
||||
{
|
||||
@@ -218,6 +248,7 @@ class Bugsnag_Client
|
||||
* eg "laravel", or executing through delayed worker code, eg "resque".
|
||||
*
|
||||
* @param String $type the current type
|
||||
* @return $this
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
@@ -237,6 +268,7 @@ class Bugsnag_Client
|
||||
* "email" => "james@example.com"
|
||||
* )
|
||||
* )
|
||||
* @return $this
|
||||
*/
|
||||
public function setMetaData(array $metaData)
|
||||
{
|
||||
@@ -255,6 +287,7 @@ class Bugsnag_Client
|
||||
* 'user' => "username"
|
||||
* 'password' => "password123"
|
||||
* )
|
||||
* @return $this
|
||||
*/
|
||||
public function setProxySettings(array $proxySettings)
|
||||
{
|
||||
@@ -270,6 +303,7 @@ class Bugsnag_Client
|
||||
* array(
|
||||
* CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4
|
||||
* )
|
||||
* @return $this
|
||||
*/
|
||||
public function setCurlOptions(array $curlOptions)
|
||||
{
|
||||
@@ -292,8 +326,9 @@ class Bugsnag_Client
|
||||
* ));
|
||||
* }
|
||||
* $bugsnag->setBeforeNotifyFunction("before_bugsnag_notify");
|
||||
*
|
||||
*/
|
||||
* @param callable $beforeNotifyFunction
|
||||
* @return $this
|
||||
*/
|
||||
public function setBeforeNotifyFunction($beforeNotifyFunction)
|
||||
{
|
||||
$this->config->beforeNotifyFunction = $beforeNotifyFunction;
|
||||
@@ -308,6 +343,7 @@ class Bugsnag_Client
|
||||
*
|
||||
* @param Integer $errorReportingLevel the error reporting level integer
|
||||
* exactly as you would pass to PHP's error_reporting
|
||||
* @return $this
|
||||
*/
|
||||
public function setErrorReportingLevel($errorReportingLevel)
|
||||
{
|
||||
@@ -321,6 +357,7 @@ class Bugsnag_Client
|
||||
* exceptions and errors.
|
||||
*
|
||||
* @param Boolean $autoNotify whether to auto notify or not
|
||||
* @return $this
|
||||
*/
|
||||
public function setAutoNotify($autoNotify)
|
||||
{
|
||||
@@ -334,6 +371,7 @@ class Bugsnag_Client
|
||||
* each request.
|
||||
*
|
||||
* @param Boolean $batchSending whether to batch together errors
|
||||
* @return $this
|
||||
*/
|
||||
public function setBatchSending($batchSending)
|
||||
{
|
||||
@@ -347,6 +385,7 @@ class Bugsnag_Client
|
||||
* set by other notifier libraries.
|
||||
*
|
||||
* @param Array $notifier an array of name, version, url.
|
||||
* @return $this
|
||||
*/
|
||||
public function setNotifier($notifier)
|
||||
{
|
||||
@@ -359,6 +398,7 @@ class Bugsnag_Client
|
||||
* Sets whether Bugsnag should send $_ENV with each error.
|
||||
*
|
||||
* @param Boolean $sendEnvironment whether to send the environment
|
||||
* @return $this
|
||||
*/
|
||||
public function setSendEnvironment($sendEnvironment)
|
||||
{
|
||||
@@ -367,11 +407,38 @@ class Bugsnag_Client
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether Bugsnag should send $_COOKIE with each error.
|
||||
*
|
||||
* @param Boolean $sendCookies whether to send the environment
|
||||
* @return $this
|
||||
*/
|
||||
public function setSendCookies($sendCookies)
|
||||
{
|
||||
$this->config->sendCookies = $sendCookies;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether Bugsnag should send $_SESSION with each error.
|
||||
*
|
||||
* @param Boolean $sendSession whether to send the environment
|
||||
* @return $this
|
||||
*/
|
||||
public function setSendSession($sendSession)
|
||||
{
|
||||
$this->config->sendSession = $sendSession;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we send a small snippet of the code that crashed to help you
|
||||
* diagnose even faster from within your dashboard.
|
||||
*
|
||||
* @param Boolean $setSendCode whether to send code to Bugsnag
|
||||
* @param Boolean $sendCode whether to send code to Bugsnag
|
||||
* @return $this
|
||||
*/
|
||||
public function setSendCode($sendCode)
|
||||
{
|
||||
@@ -381,25 +448,27 @@ class Bugsnag_Client
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify Bugsnag of a non-fatal/handled exception
|
||||
* Notify Bugsnag of a non-fatal/handled throwable
|
||||
*
|
||||
* @param Exception $exception the exception to notify Bugsnag about
|
||||
* @param Throwable $throwable the throwable to notify Bugsnag about
|
||||
* @param Array $metaData optional metaData to send with this error
|
||||
* @param String $severity optional severity of this error (fatal/error/warning/info)
|
||||
*/
|
||||
public function notifyException(Exception $exception, array $metaData = null, $severity = null)
|
||||
public function notifyException($throwable, array $metaData = null, $severity = null)
|
||||
{
|
||||
$error = Bugsnag_Error::fromPHPException($this->config, $this->diagnostics, $exception);
|
||||
$error->setSeverity($severity);
|
||||
if (is_subclass_of($throwable, 'Throwable') || is_subclass_of($throwable, 'Exception') || get_class($throwable) == 'Exception') {
|
||||
$error = Bugsnag_Error::fromPHPThrowable($this->config, $this->diagnostics, $throwable);
|
||||
$error->setSeverity($severity);
|
||||
|
||||
$this->notify($error, $metaData);
|
||||
$this->notify($error, $metaData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify Bugsnag of a non-fatal/handled error
|
||||
*
|
||||
* @param String $errorName the name of the error, a short (1 word) string
|
||||
* @param String $errorMessage the error message
|
||||
* @param String $name the name of the error, a short (1 word) string
|
||||
* @param String $message the error message
|
||||
* @param Array $metaData optional metaData to send with this error
|
||||
* @param String $severity optional severity of this error (fatal/error/warning/info)
|
||||
*/
|
||||
@@ -412,13 +481,13 @@ class Bugsnag_Client
|
||||
}
|
||||
|
||||
// Exception handler callback, should only be called internally by PHP's set_exception_handler
|
||||
public function exceptionHandler($exception)
|
||||
public function exceptionHandler($throwable)
|
||||
{
|
||||
if(!$this->config->autoNotify) {
|
||||
return;
|
||||
}
|
||||
|
||||
$error = Bugsnag_Error::fromPHPException($this->config, $this->diagnostics, $exception);
|
||||
$error = Bugsnag_Error::fromPHPThrowable($this->config, $this->diagnostics, $throwable);
|
||||
$error->setSeverity("error");
|
||||
$this->notify($error);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,12 @@ class Bugsnag_Configuration
|
||||
public $proxySettings = array();
|
||||
public $notifier = array(
|
||||
'name' => 'Bugsnag PHP (Official)',
|
||||
'version' => '2.5.5',
|
||||
'version' => '2.6.0',
|
||||
'url' => 'https://bugsnag.com',
|
||||
);
|
||||
public $sendEnvironment = false;
|
||||
public $sendCookies = true;
|
||||
public $sendSession = true;
|
||||
public $sendCode = true;
|
||||
public $stripPath;
|
||||
public $stripPathRegex;
|
||||
@@ -39,6 +41,8 @@ class Bugsnag_Configuration
|
||||
|
||||
public $curlOptions = array();
|
||||
|
||||
public $debug = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->timeout = Bugsnag_Configuration::$DEFAULT_TIMEOUT;
|
||||
@@ -67,8 +71,6 @@ class Bugsnag_Configuration
|
||||
} else {
|
||||
return !(error_reporting() & $code);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setProjectRoot($projectRoot)
|
||||
|
||||
14
vendor/bugsnag/bugsnag/src/Bugsnag/Error.php
vendored
14
vendor/bugsnag/bugsnag/src/Bugsnag/Error.php
vendored
@@ -12,10 +12,12 @@ class Bugsnag_Error
|
||||
public $payloadVersion = "2";
|
||||
public $message;
|
||||
public $severity = "warning";
|
||||
/** @var Bugsnag_Stacktrace */
|
||||
public $stacktrace;
|
||||
public $metaData = array();
|
||||
public $config;
|
||||
public $diagnostics;
|
||||
/** @var Bugsnag_Error|null */
|
||||
public $previous;
|
||||
public $groupingHash;
|
||||
|
||||
@@ -28,10 +30,10 @@ class Bugsnag_Error
|
||||
return $error;
|
||||
}
|
||||
|
||||
public static function fromPHPException(Bugsnag_Configuration $config, Bugsnag_Diagnostics $diagnostics, Exception $exception)
|
||||
public static function fromPHPThrowable(Bugsnag_Configuration $config, Bugsnag_Diagnostics $diagnostics, $throwable)
|
||||
{
|
||||
$error = new Bugsnag_Error($config, $diagnostics);
|
||||
$error->setPHPException($exception);
|
||||
$error->setPHPException($throwable);
|
||||
|
||||
return $error;
|
||||
}
|
||||
@@ -74,7 +76,7 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStacktrace($stacktrace)
|
||||
public function setStacktrace(Bugsnag_Stacktrace $stacktrace)
|
||||
{
|
||||
$this->stacktrace = $stacktrace;
|
||||
|
||||
@@ -141,7 +143,7 @@ class Bugsnag_Error
|
||||
public function setPrevious($exception)
|
||||
{
|
||||
if ($exception) {
|
||||
$this->previous = Bugsnag_Error::fromPHPException($this->config, $this->diagnostics, $exception);
|
||||
$this->previous = Bugsnag_Error::fromPHPThrowable($this->config, $this->diagnostics, $exception);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -181,13 +183,13 @@ class Bugsnag_Error
|
||||
'stacktrace' => $this->stacktrace->toArray(),
|
||||
);
|
||||
|
||||
return $exceptionArray;
|
||||
return $this->cleanupObj($exceptionArray);
|
||||
}
|
||||
|
||||
private function cleanupObj($obj)
|
||||
{
|
||||
if (is_null($obj)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (is_array($obj)) {
|
||||
|
||||
@@ -5,6 +5,7 @@ class Bugsnag_Notification
|
||||
private static $CONTENT_TYPE_HEADER = 'Content-type: application/json';
|
||||
|
||||
private $config;
|
||||
/** @var Bugsnag_Error[] */
|
||||
private $errorQueue = array();
|
||||
|
||||
public function __construct(Bugsnag_Configuration $config)
|
||||
@@ -12,7 +13,7 @@ class Bugsnag_Notification
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function addError($error, $passedMetaData = array())
|
||||
public function addError(Bugsnag_Error $error, $passedMetaData = array())
|
||||
{
|
||||
// Check if this error should be sent to Bugsnag
|
||||
if (!$this->config->shouldNotify()) {
|
||||
@@ -27,6 +28,16 @@ class Bugsnag_Notification
|
||||
$error->setMetaData(Bugsnag_Request::getRequestMetaData());
|
||||
}
|
||||
|
||||
// Session Tab
|
||||
if ($this->config->sendSession && !empty($_SESSION)) {
|
||||
$error->setMetaData(array('session' => $_SESSION));
|
||||
}
|
||||
|
||||
// Cookies Tab
|
||||
if ($this->config->sendCookies && !empty($_COOKIE)) {
|
||||
$error->setMetaData(array('cookies' => $_COOKIE));
|
||||
}
|
||||
|
||||
// Add environment meta-data to error
|
||||
if ($this->config->sendEnvironment && !empty($_ENV)) {
|
||||
$error->setMetaData(array("Environment" => $_ENV));
|
||||
@@ -139,6 +150,11 @@ class Bugsnag_Notification
|
||||
|
||||
if ($statusCode > 200) {
|
||||
error_log('Bugsnag Warning: Couldn\'t notify ('.$responseBody.')');
|
||||
|
||||
if($this->config->debug) {
|
||||
error_log('Bugsnag Debug: Attempted to post to URL - "'.$url.'"');
|
||||
error_log('Bugsnag Debug: Attempted to post payload - "'.$body.'"');
|
||||
}
|
||||
}
|
||||
|
||||
if (curl_errno($http)) {
|
||||
|
||||
14
vendor/bugsnag/bugsnag/src/Bugsnag/Request.php
vendored
14
vendor/bugsnag/bugsnag/src/Bugsnag/Request.php
vendored
@@ -36,16 +36,6 @@ class Bugsnag_Request
|
||||
$requestData['request']['headers'] = $headers;
|
||||
}
|
||||
|
||||
// Session Tab
|
||||
if (!empty($_SESSION)) {
|
||||
$requestData['session'] = $_SESSION;
|
||||
}
|
||||
|
||||
// Cookies Tab
|
||||
if (!empty($_COOKIE)) {
|
||||
$requestData['cookies'] = $_COOKIE;
|
||||
}
|
||||
|
||||
return $requestData;
|
||||
}
|
||||
|
||||
@@ -54,7 +44,7 @@ class Bugsnag_Request
|
||||
if (self::isRequest() && isset($_SERVER['REQUEST_METHOD']) && isset($_SERVER["REQUEST_URI"])) {
|
||||
return $_SERVER['REQUEST_METHOD'].' '.strtok($_SERVER["REQUEST_URI"], '?');
|
||||
} else {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +53,7 @@ class Bugsnag_Request
|
||||
if (self::isRequest()) {
|
||||
return self::getRequestIp();
|
||||
} else {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
abstract class Bugsnag_TestCase extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @var Bugsnag_Configuration */
|
||||
protected $config;
|
||||
/** @var Bugsnag_Diagnostics */
|
||||
protected $diagnostics;
|
||||
|
||||
protected function getError($name = "Name", $message = "Message")
|
||||
{
|
||||
return Bugsnag_Error::fromNamedError($this->config, $this->diagnostics, $name, $message);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
class ClientTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @var PHPUnit_Framework_MockObject_MockObject|Bugsnag_Client */
|
||||
protected $client;
|
||||
|
||||
protected function setUp()
|
||||
@@ -77,6 +78,6 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSetInvalidCurlOptions()
|
||||
{
|
||||
$return = $this->client->setCurlOptions("option");
|
||||
$this->client->setCurlOptions("option");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @var Bugsnag_Configuration */
|
||||
protected $config;
|
||||
|
||||
protected function setUp()
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
class DiagnosticsTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @var Bugsnag_Configuration */
|
||||
protected $config;
|
||||
/** @var Bugsnag_Diagnostics */
|
||||
protected $diagnostics;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
|
||||
@@ -4,8 +4,11 @@ require_once 'Bugsnag_TestCase.php';
|
||||
|
||||
class ErrorTest extends Bugsnag_TestCase
|
||||
{
|
||||
/** @var Bugsnag_Configuration */
|
||||
protected $config;
|
||||
/** @var Bugsnag_Diagnostics */
|
||||
protected $diagnostics;
|
||||
/** @var Bugsnag_Error */
|
||||
protected $error;
|
||||
|
||||
protected function setUp()
|
||||
@@ -102,7 +105,7 @@ class ErrorTest extends Bugsnag_TestCase
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||
$exception = new Exception("secondly", 65533, new Exception("firstly"));
|
||||
|
||||
$error = Bugsnag_Error::fromPHPException($this->config, $this->diagnostics, $exception);
|
||||
$error = Bugsnag_Error::fromPHPThrowable($this->config, $this->diagnostics, $exception);
|
||||
|
||||
$errorArray = $error->toArray();
|
||||
|
||||
|
||||
@@ -4,8 +4,11 @@ require_once 'Bugsnag_TestCase.php';
|
||||
|
||||
class NotificationTest extends Bugsnag_TestCase
|
||||
{
|
||||
/** @var Bugsnag_Configuration */
|
||||
protected $config;
|
||||
/** @var Bugsnag_Diagnostics */
|
||||
protected $diagnostics;
|
||||
/** @var Bugsnag_Notification|PHPUnit_Framework_MockObject_MockObject */
|
||||
protected $notification;
|
||||
|
||||
protected function setUp()
|
||||
@@ -64,6 +67,7 @@ class NotificationTest extends Bugsnag_TestCase
|
||||
->method('shouldNotify')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
/** @var Bugsnag_Notification $notification */
|
||||
$notification = $this->getMockBuilder('Bugsnag_Notification')
|
||||
->setMethods(array("postJSON"))
|
||||
->setConstructorArgs(array($config))
|
||||
@@ -86,6 +90,7 @@ class NotificationTest extends Bugsnag_TestCase
|
||||
->method('shouldNotify')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
/** @var Bugsnag_Notification|PHPUnit_Framework_MockObject_MockObject $notification */
|
||||
$notification = $this->getMockBuilder('Bugsnag_Notification')
|
||||
->setMethods(array("postJSON"))
|
||||
->setConstructorArgs(array($config))
|
||||
|
||||
@@ -4,7 +4,9 @@ require_once 'Bugsnag_TestCase.php';
|
||||
|
||||
class StacktraceTest extends Bugsnag_TestCase
|
||||
{
|
||||
/** @var Bugsnag_Configuration */
|
||||
protected $config;
|
||||
/** @var Bugsnag_Diagnostics */
|
||||
protected $diagnostics;
|
||||
|
||||
protected function setUp()
|
||||
|
||||
Reference in New Issue
Block a user