update 1.0.8.0
Commits for version update
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
example/ export-ignore
|
||||
tests/ export-ignore
|
||||
phpunit.xml export-ignore
|
||||
4
vendor/bugsnag/bugsnag-laravel/.gitignore
vendored
4
vendor/bugsnag/bugsnag-laravel/.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
/vendor
|
||||
composer.phar
|
||||
composer.lock
|
||||
.DS_Store
|
||||
18
vendor/bugsnag/bugsnag-laravel/.travis.yml
vendored
18
vendor/bugsnag/bugsnag-laravel/.travis.yml
vendored
@@ -1,18 +0,0 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
|
||||
before_script:
|
||||
- travis_retry composer install --no-interaction --prefer-source
|
||||
|
||||
script:
|
||||
- phpunit
|
||||
|
||||
notifications:
|
||||
hipchat:
|
||||
rooms:
|
||||
secure: h9501ANwjT/oDK9YM1fmLV9+1WuhEWpRu35VCqJrOHEHpDQjk7W0LZw4xJo/kK10AKCN861U5VT1U5ncxujFLBZ2HnrKGraTCvXRss/dC2wn+fG2P+T4hsQGWAyU/rU/A8uPwZT71gqCmNtt1Xo/uGHt1UHT+H59J3d3GoFjgBY=
|
||||
129
vendor/bugsnag/bugsnag-laravel/CHANGELOG.md
vendored
129
vendor/bugsnag/bugsnag-laravel/CHANGELOG.md
vendored
@@ -1,129 +0,0 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
## 1.6.4 (9 Mar 2016)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing 'config' tag in service provider
|
||||
[Dan Smith](https://github.com/DanSmith83)
|
||||
[#73](https://github.com/bugsnag/bugsnag-laravel/pull/73)
|
||||
|
||||
1.6.3
|
||||
-----
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Avoid initializing Bugsnag when no API key is set
|
||||
| [Dries Vints](https://github.com/driesvints)
|
||||
| [#72](https://github.com/bugsnag/bugsnag-laravel/pull/72)
|
||||
|
||||
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
|
||||
|
||||
1.6.0
|
||||
-----
|
||||
- Move to using .env for api key in laravel 5+
|
||||
- Support for artisan vendor:publish
|
||||
|
||||
1.5.1
|
||||
-----
|
||||
- Lumen Service Provider use statement
|
||||
|
||||
1.5.0
|
||||
-----
|
||||
- Lumen support
|
||||
- Fix bug in instructions
|
||||
- Fix bug with reading settings from service file
|
||||
|
||||
1.4.2
|
||||
-----
|
||||
- Try/catch for missing/nonstandard auth service
|
||||
|
||||
1.4.1
|
||||
-----
|
||||
- Default severity to 'error'
|
||||
|
||||
1.4.0
|
||||
-----
|
||||
- Better laravel 5 support!
|
||||
|
||||
1.3.0
|
||||
-----
|
||||
- Laravel 5 support!
|
||||
|
||||
1.2.1
|
||||
-----
|
||||
- Protect against missing configuration variables (thanks @jasonlfunk!)
|
||||
|
||||
1.2.0
|
||||
-----
|
||||
- Update `bugsnag-php` dependency to enable support for code snippets on
|
||||
your Bugsnag dashboard
|
||||
- Allow configuring of more Bugsnag settings from your `config.php`
|
||||
(thanks @jacobmarshall!)
|
||||
|
||||
1.1.1
|
||||
-----
|
||||
- Fix issue where sending auth information with complex users could fail (thanks @hannesvdvreken!)
|
||||
|
||||
1.1.0
|
||||
-----
|
||||
- Send user/auth information if available (thanks @hannesvdvreken!)
|
||||
|
||||
1.0.10
|
||||
------
|
||||
- Laravel 5 support
|
||||
|
||||
1.0.9
|
||||
------
|
||||
- Split strip paths from `inProject`
|
||||
|
||||
1.0.8
|
||||
-----
|
||||
- Bump the bugsnag-php dependency to include recent fixes
|
||||
|
||||
1.0.7
|
||||
-----
|
||||
- Fix major notification bug introduced in 1.0.6
|
||||
|
||||
1.0.6
|
||||
-----
|
||||
- Fix incompatibility with PHP 5.3
|
||||
|
||||
1.0.5
|
||||
-----
|
||||
- Identify as Laravel notifier instead of PHP
|
||||
|
||||
1.0.4
|
||||
-----
|
||||
- Allow configuration of notify_release_stages from config file
|
||||
|
||||
1.0.3
|
||||
-----
|
||||
- Fix bug when setting releaseStage in the ServiceProvider
|
||||
|
||||
1.0.2
|
||||
-----
|
||||
- Fix laravel requirement to work with 4.1
|
||||
- Add a `Bugsnag` facade for quick access to $app["bugsnag"]
|
||||
|
||||
1.0.1
|
||||
-----
|
||||
- Fixed fatal error handling
|
||||
- Set release stage based on laravel's `App::environment` setting
|
||||
|
||||
1.0.0
|
||||
-----
|
||||
- Initial release
|
||||
26
vendor/bugsnag/bugsnag-laravel/CONTRIBUTING.md
vendored
26
vendor/bugsnag/bugsnag-laravel/CONTRIBUTING.md
vendored
@@ -1,26 +0,0 @@
|
||||
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:
|
||||
```
|
||||
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!
|
||||
|
||||
|
||||
Releasing
|
||||
=========
|
||||
|
||||
1. Commit all outstanding changes
|
||||
1. Bump the version in `src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php` and `src/Bugsnag/BugsnagLaravel/BugsnagLumenServiceProvider.php`
|
||||
2. Update the CHANGELOG.md, and README if appropriate.
|
||||
3. Commit, tag push
|
||||
|
||||
git commit -am v1.x.x
|
||||
git tag v1.x.x
|
||||
git push origin master v1.x.x
|
||||
|
||||
354
vendor/bugsnag/bugsnag-laravel/README.md
vendored
354
vendor/bugsnag/bugsnag-laravel/README.md
vendored
@@ -1,354 +0,0 @@
|
||||
Bugsnag Notifier for Laravel and Lumen
|
||||
=====================================
|
||||
|
||||
The Bugsnag Notifier for Laravel gives you instant notification of errors and
|
||||
exceptions in your Laravel PHP applications. We support Laravel 5, Laravel 4,
|
||||
Laravel 3, and Lumen.
|
||||
|
||||
[Bugsnag](https://bugsnag.com) captures errors in real-time from your web,
|
||||
mobile and desktop applications, helping you to understand and resolve them
|
||||
as fast as possible. [Create a free account](https://bugsnag.com) to start
|
||||
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
|
||||
--------
|
||||
|
||||
- [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
|
||||
---------------
|
||||
|
||||
### Installation
|
||||
|
||||
#### Laravel 5.0+
|
||||
|
||||
1. Install the `bugsnag/bugsnag-laravel` package
|
||||
|
||||
```shell
|
||||
$ composer require bugsnag/bugsnag-laravel:1.*
|
||||
```
|
||||
|
||||
1. Update `config/app.php` to activate Bugsnag
|
||||
|
||||
```php
|
||||
# Add `BugsnagLaravelServiceProvider` to the `providers` array
|
||||
'providers' => array(
|
||||
...
|
||||
Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider::class,
|
||||
)
|
||||
|
||||
# Add the `BugsnagFacade` to the `aliases` array
|
||||
'aliases' => array(
|
||||
...
|
||||
'Bugsnag' => Bugsnag\BugsnagLaravel\BugsnagFacade::class,
|
||||
)
|
||||
```
|
||||
|
||||
1. Use the Bugsnag exception handler from `App/Exceptions/Handler.php`.
|
||||
|
||||
```php
|
||||
# DELETE this line
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
```
|
||||
|
||||
```php
|
||||
# ADD this line instead
|
||||
use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler;
|
||||
```
|
||||
|
||||
After this change, your file should look like this:
|
||||
|
||||
```php
|
||||
<?php namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler {
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
1. Create the configuration file `config/bugsnag.php`:
|
||||
|
||||
```shell
|
||||
$ php artisan vendor:publish --provider="Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider"
|
||||
```
|
||||
|
||||
1. Configure your `api_key` in your `.env` file:
|
||||
|
||||
```shell
|
||||
BUGSNAG_API_KEY=YOUR-API-KEY-HERE
|
||||
```
|
||||
|
||||
1. Optionally, you can add the `notify_release_stages` key to the
|
||||
`config/bugsnag.php` file to define which Laravel environments will send
|
||||
Exceptions to Bugsnag.
|
||||
|
||||
```php
|
||||
return array(
|
||||
'api_key' => env('BUGSNAG_API_KEY'),
|
||||
'notify_release_stages' => ['production', 'staging']
|
||||
);
|
||||
```
|
||||
|
||||
#### Laravel (Older Versions)
|
||||
|
||||
For versions of Laravel before 5.0:
|
||||
|
||||
1. Install the `bugsnag/bugsnag-laravel` package
|
||||
|
||||
```shell
|
||||
$ composer require bugsnag/bugsnag-laravel:1.*
|
||||
```
|
||||
|
||||
1. Update app/config/app.php` to activate Bugsnag
|
||||
|
||||
```php
|
||||
# Add `BugsnagLaravelServiceProvider` to the `providers` array
|
||||
'providers' => array(
|
||||
...
|
||||
'Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider',
|
||||
)
|
||||
|
||||
# Add the `BugsnagFacade` to the `aliases` array
|
||||
'aliases' => array(
|
||||
...
|
||||
'Bugsnag' => 'Bugsnag\BugsnagLaravel\BugsnagFacade',
|
||||
)
|
||||
```
|
||||
|
||||
1. Generate a template Bugsnag config file
|
||||
|
||||
```shell
|
||||
$ php artisan config:publish bugsnag/bugsnag-laravel
|
||||
```
|
||||
|
||||
1. Update `app/config/packages/bugsnag/bugsnag-laravel/config.php` with your
|
||||
Bugsnag API key:
|
||||
|
||||
```php
|
||||
return array(
|
||||
'api_key' => 'YOUR-API-KEY-HERE'
|
||||
);
|
||||
```
|
||||
|
||||
1. Optionally, you can add the `notify_release_stages` key to the same file
|
||||
above to define which Laravel environments will send Exceptions to Bugsnag.
|
||||
|
||||
```php
|
||||
return array(
|
||||
'api_key' => 'YOUR-API-KEY-HERE',
|
||||
'notify_release_stages' => ['production', 'staging']
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
#### Lumen
|
||||
|
||||
1. Install the `bugsnag/bugsnag-laravel` package
|
||||
|
||||
```shell
|
||||
$ composer require bugsnag/bugsnag-laravel:1.*
|
||||
```
|
||||
|
||||
2. In `bootstrap/app.php` add the line
|
||||
|
||||
```php
|
||||
$app->register('Bugsnag\BugsnagLaravel\BugsnagLumenServiceProvider');
|
||||
```
|
||||
|
||||
just before the line
|
||||
|
||||
```php
|
||||
require __DIR__ . '/../app/Http/routes.php';
|
||||
```
|
||||
|
||||
3. Change the function `report` in `app/Exceptions/Handler.php` to look like
|
||||
this:
|
||||
|
||||
```php
|
||||
public function report(Exception $e) {
|
||||
app('bugsnag')->notifyException($e, []);
|
||||
return parent::report($e);
|
||||
}
|
||||
```
|
||||
|
||||
4. Create a file `config/bugsnag.php` that contains your API key
|
||||
|
||||
```php
|
||||
<?php # config/bugsnag.php
|
||||
|
||||
return array(
|
||||
'api_key' => 'YOUR-API-KEY-HERE'
|
||||
);
|
||||
```
|
||||
|
||||
### 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
|
||||
-----
|
||||
|
||||
### Catching and Reporting Exceptions
|
||||
|
||||
Bugsnag works "out of the box" for reporting unhandled exceptions in
|
||||
Laravel and Lumen apps.
|
||||
|
||||
|
||||
### Sending Non-fatal Exceptions
|
||||
|
||||
You can easily tell Bugsnag about non-fatal or caught exceptions by
|
||||
calling `Bugsnag::notifyException`:
|
||||
|
||||
```php
|
||||
Bugsnag::notifyException(new Exception("Something bad happened"));
|
||||
```
|
||||
|
||||
You can also send custom errors to Bugsnag with `Bugsnag::notifyError`:
|
||||
|
||||
```php
|
||||
Bugsnag::notifyError("ErrorType", "Something bad happened here too");
|
||||
```
|
||||
|
||||
Both of these functions can also be passed an optional `$metaData` parameter,
|
||||
which should take the following format:
|
||||
|
||||
```php
|
||||
$metaData = array(
|
||||
"user" => array(
|
||||
"name" => "James",
|
||||
"email" => "james@example.com"
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
If you'd like to send different levels of errors to Bugsnag, you can call
|
||||
`setErrorReportingLevel`, for example:
|
||||
|
||||
```php
|
||||
Bugsnag::setErrorReportingLevel(E_ALL & ~E_NOTICE);
|
||||
```
|
||||
|
||||
#### Callbacks
|
||||
|
||||
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"
|
||||
)
|
||||
));
|
||||
}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Demo Applications
|
||||
-----------------
|
||||
|
||||
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).
|
||||
|
||||
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
|
||||
-------
|
||||
|
||||
* [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
|
||||
------------
|
||||
|
||||
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](LICENSE.txt) for details.
|
||||
11
vendor/bugsnag/bugsnag-laravel/composer.json
vendored
11
vendor/bugsnag/bugsnag-laravel/composer.json
vendored
@@ -12,12 +12,17 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"illuminate/support": "4.*|5.*",
|
||||
"bugsnag/bugsnag": ">=2.5.0"
|
||||
"illuminate/support": "^4.0|^5.0",
|
||||
"bugsnag/bugsnag": "^2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8|^5.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Bugsnag\\BugsnagLaravel\\": "src/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
||||
@@ -1,27 +1,25 @@
|
||||
<?php namespace Bugsnag\BugsnagLaravel;
|
||||
<?php
|
||||
|
||||
namespace Bugsnag\BugsnagLaravel;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class BugsnagExceptionHandler extends ExceptionHandler {
|
||||
class BugsnagExceptionHandler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @param \Exception $e
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $e)
|
||||
{
|
||||
foreach ($this->dontReport as $type) {
|
||||
if ($e instanceof $type) {
|
||||
return parent::report($e);
|
||||
}
|
||||
}
|
||||
|
||||
if (app()->bound('bugsnag')) {
|
||||
app('bugsnag')->notifyException($e, null, "error");
|
||||
if ($this->shouldReport($e) && app()->bound('bugsnag')) {
|
||||
app('bugsnag')->notifyException($e, null, 'error');
|
||||
}
|
||||
|
||||
return parent::report($e);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php namespace Bugsnag\BugsnagLaravel;
|
||||
<?php
|
||||
|
||||
namespace Bugsnag\BugsnagLaravel;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php namespace Bugsnag\BugsnagLaravel;
|
||||
<?php
|
||||
|
||||
namespace Bugsnag\BugsnagLaravel;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -18,11 +20,9 @@ class BugsnagLaravelServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
|
||||
$app = $this->app;
|
||||
|
||||
if (version_compare($app::VERSION, '5.0') < 0) {
|
||||
|
||||
$this->package('bugsnag/bugsnag-laravel', 'bugsnag');
|
||||
|
||||
// Register for exception handling
|
||||
@@ -30,16 +30,16 @@ class BugsnagLaravelServiceProvider extends ServiceProvider
|
||||
if ('Symfony\Component\Debug\Exception\FatalErrorException'
|
||||
!== get_class($exception)
|
||||
) {
|
||||
$app['bugsnag']->notifyException($exception, null, "error");
|
||||
$app['bugsnag']->notifyException($exception, null, 'error');
|
||||
}
|
||||
});
|
||||
|
||||
// Register for fatal error handling
|
||||
$app->fatal(function ($exception) use ($app) {
|
||||
$app['bugsnag']->notifyException($exception, null, "error");
|
||||
$app['bugsnag']->notifyException($exception, null, 'error');
|
||||
});
|
||||
} else {
|
||||
$this->publishes(array(
|
||||
$this->publishes(array(
|
||||
__DIR__.'/config.php' => config_path('bugsnag.php'),
|
||||
), 'config');
|
||||
}
|
||||
@@ -65,9 +65,9 @@ class BugsnagLaravelServiceProvider extends ServiceProvider
|
||||
$client->setBatchSending(false);
|
||||
$client->setReleaseStage($app->environment());
|
||||
$client->setNotifier(array(
|
||||
'name' => 'Bugsnag Laravel',
|
||||
'version' => '1.6.4',
|
||||
'url' => 'https://github.com/bugsnag/bugsnag-laravel'
|
||||
'name' => 'Bugsnag Laravel',
|
||||
'version' => '1.7.0',
|
||||
'url' => 'https://github.com/bugsnag/bugsnag-laravel',
|
||||
));
|
||||
|
||||
if (isset($config['notify_release_stages']) && is_array($config['notify_release_stages'])) {
|
||||
@@ -110,6 +110,6 @@ class BugsnagLaravelServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return array("bugsnag");
|
||||
return array('bugsnag');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php namespace Bugsnag\BugsnagLaravel;
|
||||
<?php
|
||||
|
||||
namespace Bugsnag\BugsnagLaravel;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -36,15 +38,15 @@ class BugsnagLumenServiceProvider extends ServiceProvider
|
||||
|
||||
$client = new \Bugsnag_Client($config['api_key']);
|
||||
$client->setStripPath(base_path());
|
||||
$client->setProjectRoot(base_path() . '/app');
|
||||
$client->setProjectRoot(base_path().'/app');
|
||||
$client->setAutoNotify(false);
|
||||
$client->setBatchSending(false);
|
||||
$client->setReleaseStage($app->environment());
|
||||
$client->setNotifier(array(
|
||||
'name' => 'Bugsnag Lumen',
|
||||
'version' => '1.6.4',
|
||||
'url' => 'https://github.com/bugsnag/bugsnag-laravel'
|
||||
));
|
||||
'name' => 'Bugsnag Lumen',
|
||||
'version' => '1.7.0',
|
||||
'url' => 'https://github.com/bugsnag/bugsnag-laravel',
|
||||
));
|
||||
|
||||
if (isset($config['notify_release_stages']) && is_array($config['notify_release_stages'])) {
|
||||
$client->setNotifyReleaseStages($config['notify_release_stages']);
|
||||
@@ -86,6 +88,6 @@ class BugsnagLumenServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return array("bugsnag");
|
||||
return array('bugsnag');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,76 +2,76 @@
|
||||
|
||||
return array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can find your API key on your Bugsnag dashboard.
|
||||
|
|
||||
| This api key points the Bugsnag notifier to the project in your account
|
||||
| which should receive your application's uncaught exceptions.
|
||||
|
|
||||
*/
|
||||
'api_key' => env('BUGSNAG_API_KEY'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can find your API key on your Bugsnag dashboard.
|
||||
|
|
||||
| This api key points the Bugsnag notifier to the project in your account
|
||||
| which should receive your application's uncaught exceptions.
|
||||
|
|
||||
*/
|
||||
'api_key' => env('BUGSNAG_API_KEY', ''),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Notify Release Stages
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set which release stages should send notifications to Bugsnag.
|
||||
|
|
||||
| Example: array('development', 'production')
|
||||
|
|
||||
*/
|
||||
'notify_release_stages' => env('BUGSNAG_NOTIFY_RELEASE_STAGES', null),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Notify Release Stages
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set which release stages should send notifications to Bugsnag.
|
||||
|
|
||||
| Example: array('development', 'production')
|
||||
|
|
||||
*/
|
||||
'notify_release_stages' => env('BUGSNAG_NOTIFY_RELEASE_STAGES', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Endpoint
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set what server the Bugsnag notifier should send errors to. By default
|
||||
| this is set to 'https://notify.bugsnag.com', but for Bugsnag Enterprise
|
||||
| this should be the URL to your Bugsnag instance.
|
||||
|
|
||||
*/
|
||||
'endpoint' => env('BUGSNAG_ENDPOINT', null),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Endpoint
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set what server the Bugsnag notifier should send errors to. By default
|
||||
| this is set to 'https://notify.bugsnag.com', but for Bugsnag Enterprise
|
||||
| this should be the URL to your Bugsnag instance.
|
||||
|
|
||||
*/
|
||||
'endpoint' => env('BUGSNAG_ENDPOINT', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Use this if you want to ensure you don't send sensitive data such as
|
||||
| passwords, and credit card numbers to our servers. Any keys which
|
||||
| contain these strings will be filtered.
|
||||
|
|
||||
*/
|
||||
'filters' => env('BUGSNAG_FILTERS', array('password')),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Use this if you want to ensure you don't send sensitive data such as
|
||||
| passwords, and credit card numbers to our servers. Any keys which
|
||||
| contain these strings will be filtered.
|
||||
|
|
||||
*/
|
||||
'filters' => env('BUGSNAG_FILTERS', array('password')),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Proxy
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your server is behind a proxy server, you can configure this as well.
|
||||
| Other than the host, none of these settings are mandatory.
|
||||
|
|
||||
| Note: Proxy configuration is only possible if the PHP cURL extension
|
||||
| is installed.
|
||||
|
|
||||
| Example:
|
||||
|
|
||||
| 'proxy' => array(
|
||||
| 'host' => 'bugsnag.com',
|
||||
| 'port' => 42,
|
||||
| 'user' => 'username',
|
||||
| 'password' => 'password123'
|
||||
| )
|
||||
|
|
||||
*/
|
||||
'proxy' => env('BUGSNAG_PROXY', null)
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Proxy
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your server is behind a proxy server, you can configure this as well.
|
||||
| Other than the host, none of these settings are mandatory.
|
||||
|
|
||||
| Note: Proxy configuration is only possible if the PHP cURL extension
|
||||
| is installed.
|
||||
|
|
||||
| Example:
|
||||
|
|
||||
| 'proxy' => array(
|
||||
| 'host' => 'bugsnag.com',
|
||||
| 'port' => 42,
|
||||
| 'user' => 'username',
|
||||
| 'password' => 'password123'
|
||||
| )
|
||||
|
|
||||
*/
|
||||
'proxy' => env('BUGSNAG_PROXY', null),
|
||||
|
||||
);
|
||||
|
||||
134
vendor/bugsnag/bugsnag-laravel/src/config/config.php
vendored
134
vendor/bugsnag/bugsnag-laravel/src/config/config.php
vendored
@@ -2,76 +2,76 @@
|
||||
|
||||
return array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can find your API key on your Bugsnag dashboard.
|
||||
|
|
||||
| This api key points the Bugsnag notifier to the project in your account
|
||||
| which should receive your application's uncaught exceptions.
|
||||
|
|
||||
*/
|
||||
'api_key' => 'YOUR-API-KEY-HERE',
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can find your API key on your Bugsnag dashboard.
|
||||
|
|
||||
| This api key points the Bugsnag notifier to the project in your account
|
||||
| which should receive your application's uncaught exceptions.
|
||||
|
|
||||
*/
|
||||
'api_key' => 'YOUR-API-KEY-HERE',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Notify Release Stages
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set which release stages should send notifications to Bugsnag.
|
||||
|
|
||||
| Example: array('development', 'production')
|
||||
|
|
||||
*/
|
||||
'notify_release_stages' => null,
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Notify Release Stages
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set which release stages should send notifications to Bugsnag.
|
||||
|
|
||||
| Example: array('development', 'production')
|
||||
|
|
||||
*/
|
||||
'notify_release_stages' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Endpoint
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set what server the Bugsnag notifier should send errors to. By default
|
||||
| this is set to 'https://notify.bugsnag.com', but for Bugsnag Enterprise
|
||||
| this should be the URL to your Bugsnag instance.
|
||||
|
|
||||
*/
|
||||
'endpoint' => null,
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Endpoint
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set what server the Bugsnag notifier should send errors to. By default
|
||||
| this is set to 'https://notify.bugsnag.com', but for Bugsnag Enterprise
|
||||
| this should be the URL to your Bugsnag instance.
|
||||
|
|
||||
*/
|
||||
'endpoint' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Use this if you want to ensure you don't send sensitive data such as
|
||||
| passwords, and credit card numbers to our servers. Any keys which
|
||||
| contain these strings will be filtered.
|
||||
|
|
||||
*/
|
||||
'filters' => array('password'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Use this if you want to ensure you don't send sensitive data such as
|
||||
| passwords, and credit card numbers to our servers. Any keys which
|
||||
| contain these strings will be filtered.
|
||||
|
|
||||
*/
|
||||
'filters' => array('password'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Proxy
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your server is behind a proxy server, you can configure this as well.
|
||||
| Other than the host, none of these settings are mandatory.
|
||||
|
|
||||
| Note: Proxy configuration is only possible if the PHP cURL extension
|
||||
| is installed.
|
||||
|
|
||||
| Example:
|
||||
|
|
||||
| 'proxy' => array(
|
||||
| 'host' => 'bugsnag.com',
|
||||
| 'port' => 42,
|
||||
| 'user' => 'username',
|
||||
| 'password' => 'password123'
|
||||
| )
|
||||
|
|
||||
*/
|
||||
'proxy' => null
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Proxy
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your server is behind a proxy server, you can configure this as well.
|
||||
| Other than the host, none of these settings are mandatory.
|
||||
|
|
||||
| Note: Proxy configuration is only possible if the PHP cURL extension
|
||||
| is installed.
|
||||
|
|
||||
| Example:
|
||||
|
|
||||
| 'proxy' => array(
|
||||
| 'host' => 'bugsnag.com',
|
||||
| 'port' => 42,
|
||||
| 'user' => 'username',
|
||||
| 'password' => 'password123'
|
||||
| )
|
||||
|
|
||||
*/
|
||||
'proxy' => null,
|
||||
|
||||
);
|
||||
|
||||
8
vendor/bugsnag/bugsnag/.styleci.yml
vendored
8
vendor/bugsnag/bugsnag/.styleci.yml
vendored
@@ -1,8 +0,0 @@
|
||||
disabled:
|
||||
- align_double_arrow
|
||||
- phpdoc_align
|
||||
- short_array_syntax
|
||||
|
||||
enabled:
|
||||
- long_array_syntax
|
||||
- unalign_double_arrow
|
||||
7
vendor/bugsnag/bugsnag/circle.yml
vendored
7
vendor/bugsnag/bugsnag/circle.yml
vendored
@@ -1,7 +0,0 @@
|
||||
machine:
|
||||
php:
|
||||
version: 7.0.4
|
||||
|
||||
dependencies:
|
||||
cache_directories:
|
||||
- ~/.composer/cache
|
||||
8
vendor/bugsnag/bugsnag/composer.json
vendored
8
vendor/bugsnag/bugsnag/composer.json
vendored
@@ -14,7 +14,7 @@
|
||||
"php": ">=5.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.8|~5.0"
|
||||
"phpunit/phpunit": "^4.8|^5.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0" : {
|
||||
@@ -23,7 +23,9 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.8-dev"
|
||||
"dev-master": "2.9-dev"
|
||||
}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
||||
16
vendor/bugsnag/bugsnag/example/php/README.md
vendored
16
vendor/bugsnag/bugsnag/example/php/README.md
vendored
@@ -1,16 +0,0 @@
|
||||
- Install composer
|
||||
|
||||
<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
|
||||
```
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"require": {
|
||||
"bugsnag/bugsnag": "^2.7"
|
||||
}
|
||||
}
|
||||
6
vendor/bugsnag/bugsnag/example/php/index.php
vendored
6
vendor/bugsnag/bugsnag/example/php/index.php
vendored
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once '../../build/bugsnag.phar';
|
||||
|
||||
$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)));
|
||||
36
vendor/bugsnag/bugsnag/src/Bugsnag/Client.php
vendored
36
vendor/bugsnag/bugsnag/src/Bugsnag/Client.php
vendored
@@ -9,6 +9,13 @@ class Bugsnag_Client
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* The diagnostics instance.
|
||||
*
|
||||
* @var Bugsnag_Diagnostics
|
||||
*/
|
||||
private $diagnostics;
|
||||
|
||||
/**
|
||||
* The notification instance.
|
||||
*
|
||||
@@ -17,7 +24,7 @@ class Bugsnag_Client
|
||||
private $notification;
|
||||
|
||||
/**
|
||||
* Initialize Bugsnag.
|
||||
* Create a new client instance.
|
||||
*
|
||||
* @param string $apiKey your Bugsnag API key
|
||||
*
|
||||
@@ -89,7 +96,7 @@ class Bugsnag_Client
|
||||
/**
|
||||
* Set which release stages should be allowed to notify Bugsnag.
|
||||
*
|
||||
* Eg array("production", "development").
|
||||
* Eg array('production', 'development').
|
||||
*
|
||||
* @param array $notifyReleaseStages array of release stages to notify for
|
||||
*
|
||||
@@ -212,7 +219,7 @@ class Bugsnag_Client
|
||||
/**
|
||||
* Set the strings to filter out from metaData arrays before sending then.
|
||||
*
|
||||
* Eg. array("password", "credit_card").
|
||||
* Eg. array('password', 'credit_card').
|
||||
*
|
||||
* @param array $filters an array of metaData filters
|
||||
*
|
||||
@@ -301,9 +308,9 @@ class Bugsnag_Client
|
||||
*
|
||||
* @param array $metaData an array of arrays of custom data. Eg:
|
||||
* array(
|
||||
* "user" => array(
|
||||
* "name" => "James",
|
||||
* "email" => "james@example.com"
|
||||
* 'user' => array(
|
||||
* 'name' => 'James',
|
||||
* 'email' => 'james@example.com'
|
||||
* )
|
||||
* )
|
||||
* @param bool $merge optionally merge the meta data
|
||||
@@ -326,10 +333,10 @@ class Bugsnag_Client
|
||||
*
|
||||
* @param array $proxySettings an array with proxy settings. Eg:
|
||||
* array(
|
||||
* 'host' => "bugsnag.com",
|
||||
* 'host' => 'bugsnag.com',
|
||||
* 'port' => 42,
|
||||
* 'user' => "username"
|
||||
* 'password' => "password123"
|
||||
* 'user' => 'username'
|
||||
* 'password' => 'password123'
|
||||
* )
|
||||
*
|
||||
* @return $this
|
||||
@@ -367,12 +374,12 @@ class Bugsnag_Client
|
||||
* // Adding meta-data example
|
||||
* function before_bugsnag_notify($error) {
|
||||
* $error->addMetaData(array(
|
||||
* "user" => array(
|
||||
* "name" => "James"
|
||||
* 'user' => array(
|
||||
* 'name' => 'James'
|
||||
* )
|
||||
* ));
|
||||
* }
|
||||
* $bugsnag->setBeforeNotifyFunction("before_bugsnag_notify");
|
||||
* $bugsnag->setBeforeNotifyFunction('before_bugsnag_notify');
|
||||
*
|
||||
* @param callable $beforeNotifyFunction
|
||||
*
|
||||
@@ -590,11 +597,6 @@ class Bugsnag_Client
|
||||
* Called when the PHP process has finished running. Should only be called
|
||||
* internally by PHP's register_shutdown_function.
|
||||
*
|
||||
* @param int $errno the level of the error raised
|
||||
* @param string $errstr the error message
|
||||
* @param string $errfile the filename that the error was raised in
|
||||
* @param int $errline the line number the error was raised at
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function shutdownHandler()
|
||||
|
||||
@@ -18,7 +18,7 @@ class Bugsnag_Configuration
|
||||
public $proxySettings = array();
|
||||
public $notifier = array(
|
||||
'name' => 'Bugsnag PHP (Official)',
|
||||
'version' => '2.8.0',
|
||||
'version' => '2.9.2',
|
||||
'url' => 'https://bugsnag.com',
|
||||
);
|
||||
public $sendEnvironment = false;
|
||||
@@ -43,11 +43,21 @@ class Bugsnag_Configuration
|
||||
|
||||
public $debug = false;
|
||||
|
||||
/**
|
||||
* Create a new config instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->timeout = self::$DEFAULT_TIMEOUT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notify endpoint.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNotifyEndpoint()
|
||||
{
|
||||
if (is_null($this->endpoint)) {
|
||||
@@ -59,11 +69,23 @@ class Bugsnag_Configuration
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we notify?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldNotify()
|
||||
{
|
||||
return is_null($this->notifyReleaseStages) || (is_array($this->notifyReleaseStages) && in_array($this->releaseStage, $this->notifyReleaseStages));
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we ignore the given error code?
|
||||
*
|
||||
* @param int $code the error code
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldIgnoreErrorCode($code)
|
||||
{
|
||||
if (isset($this->errorReportingLevel)) {
|
||||
@@ -73,6 +95,13 @@ class Bugsnag_Configuration
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the project root.
|
||||
*
|
||||
* @param string $projectRoot the project root path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setProjectRoot($projectRoot)
|
||||
{
|
||||
$this->projectRoot = $projectRoot;
|
||||
@@ -82,12 +111,27 @@ class Bugsnag_Configuration
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the strip path.
|
||||
*
|
||||
* @param string $stripPath the absolute strip path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setStripPath($stripPath)
|
||||
{
|
||||
$this->stripPath = $stripPath;
|
||||
$this->stripPathRegex = '/'.preg_quote($stripPath, '/').'[\\/]?/i';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the given configuration.
|
||||
*
|
||||
* @param string $prop the property to get
|
||||
* @param mixed $default the value to fallback to
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($prop, $default = null)
|
||||
{
|
||||
$configured = $this->$prop;
|
||||
|
||||
@@ -2,13 +2,30 @@
|
||||
|
||||
class Bugsnag_Diagnostics
|
||||
{
|
||||
/**
|
||||
* The config instance.
|
||||
*
|
||||
* @var Bugsnag_Configuration
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* Create a new diagnostics instance.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the configuration instance
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Bugsnag_Configuration $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application information.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAppData()
|
||||
{
|
||||
$appData = array();
|
||||
@@ -28,18 +45,33 @@ class Bugsnag_Diagnostics
|
||||
return $appData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device information.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDeviceData()
|
||||
{
|
||||
return array(
|
||||
'hostname' => $this->config->get('hostname', gethostname()),
|
||||
'hostname' => $this->config->get('hostname', php_uname('n')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error context.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->config->get('context', Bugsnag_Request::getContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current user.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
$defaultUser = array();
|
||||
|
||||
170
vendor/bugsnag/bugsnag/src/Bugsnag/Error.php
vendored
170
vendor/bugsnag/bugsnag/src/Bugsnag/Error.php
vendored
@@ -15,13 +15,26 @@ class Bugsnag_Error
|
||||
/** @var Bugsnag_Stacktrace */
|
||||
public $stacktrace;
|
||||
public $metaData = array();
|
||||
public $user;
|
||||
public $config;
|
||||
public $diagnostics;
|
||||
/** @var Bugsnag_Error|null */
|
||||
public $previous;
|
||||
public $groupingHash;
|
||||
|
||||
// Static error creation methods, to ensure that Error object is always complete
|
||||
/**
|
||||
* Create a new error from a PHP error.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the config instance
|
||||
* @param Bugsnag_Diagnostics $diagnostics the diagnostics instance
|
||||
* @param int $code the error code
|
||||
* @param string $message the error message
|
||||
* @param string $file the error file
|
||||
* @param int $line the error line
|
||||
* @param bool $fatal if the error was fatal
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromPHPError(Bugsnag_Configuration $config, Bugsnag_Diagnostics $diagnostics, $code, $message, $file, $line, $fatal = false)
|
||||
{
|
||||
$error = new self($config, $diagnostics);
|
||||
@@ -30,14 +43,33 @@ class Bugsnag_Error
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new error from a PHP throwable.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the config instance
|
||||
* @param Bugsnag_Diagnostics $diagnostics the diagnostics instance
|
||||
* @param Throwable $throwable te he throwable instance
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromPHPThrowable(Bugsnag_Configuration $config, Bugsnag_Diagnostics $diagnostics, $throwable)
|
||||
{
|
||||
$error = new self($config, $diagnostics);
|
||||
$error->setPHPException($throwable);
|
||||
$error->setPHPThrowable($throwable);
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new error from a named error.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the config instance
|
||||
* @param Bugsnag_Diagnostics $diagnostics the diagnostics instance
|
||||
* @param string $name the error name
|
||||
* @param string|null $message the error message
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromNamedError(Bugsnag_Configuration $config, Bugsnag_Diagnostics $diagnostics, $name, $message = null)
|
||||
{
|
||||
$error = new self($config, $diagnostics);
|
||||
@@ -48,13 +80,31 @@ class Bugsnag_Error
|
||||
return $error;
|
||||
}
|
||||
|
||||
// Private constructor (for use only by the static methods above)
|
||||
/**
|
||||
* Create a new error instance.
|
||||
*
|
||||
* This is only for for use only by the static methods above.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the config instance
|
||||
* @param Bugsnag_Diagnostics $diagnostics the diagnostics instance
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct(Bugsnag_Configuration $config, Bugsnag_Diagnostics $diagnostics)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->diagnostics = $diagnostics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the error name.
|
||||
*
|
||||
* @param string $name the error name
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
if (is_scalar($name) || method_exists($name, '__toString')) {
|
||||
@@ -66,6 +116,15 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the error message.
|
||||
*
|
||||
* @param string|null $message the error message
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMessage($message)
|
||||
{
|
||||
if ($message === null) {
|
||||
@@ -79,6 +138,13 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the grouping hash.
|
||||
*
|
||||
* @param string $groupingHash the grouping hash
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setGroupingHash($groupingHash)
|
||||
{
|
||||
$this->groupingHash = $groupingHash;
|
||||
@@ -86,6 +152,13 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the bugsnag stacktrace.
|
||||
*
|
||||
* @param Bugsnag_Stacktrace $stacktrace the stacktrace instance
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStacktrace(Bugsnag_Stacktrace $stacktrace)
|
||||
{
|
||||
$this->stacktrace = $stacktrace;
|
||||
@@ -93,6 +166,13 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the error severity.
|
||||
*
|
||||
* @param int|null $severity the error severity
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSeverity($severity)
|
||||
{
|
||||
if (!is_null($severity)) {
|
||||
@@ -106,19 +186,40 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the PHP exception.
|
||||
*
|
||||
* @param Throwable $exception the throwable instance
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 2.9. Use setPHPThrowable instead.
|
||||
*/
|
||||
public function setPHPException($exception)
|
||||
{
|
||||
return $this->setPHPThrowable($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the PHP throwable.
|
||||
*
|
||||
* @param Throwable $exception the throwable instance
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPHPThrowable($exception)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
|
||||
if (!$exception instanceof Throwable) {
|
||||
error_log('Bugsnag Warning: The exception must implement Throwable.');
|
||||
|
||||
return;
|
||||
return $this;
|
||||
}
|
||||
} else {
|
||||
if (!$exception instanceof Exception) {
|
||||
error_log('Bugsnag Warning: The exception must be an Exception.');
|
||||
|
||||
return;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +234,17 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the PHP error.
|
||||
*
|
||||
* @param int $code the error code
|
||||
* @param string $message the error message
|
||||
* @param string $file the error file
|
||||
* @param int $line the error line
|
||||
* @param bool $fatal if the error was fatal
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPHPError($code, $message, $file, $line, $fatal = false)
|
||||
{
|
||||
if ($fatal) {
|
||||
@@ -155,6 +267,13 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the error meta data.
|
||||
*
|
||||
* @param array $metaData the error meta data
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMetaData($metaData)
|
||||
{
|
||||
if (is_array($metaData)) {
|
||||
@@ -164,6 +283,27 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current user.
|
||||
*
|
||||
* @param array|null $user the current user
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUser($user)
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the previous throwable.
|
||||
*
|
||||
* @param Throwable $exception the previous throwable
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPrevious($exception)
|
||||
{
|
||||
if ($exception) {
|
||||
@@ -173,12 +313,17 @@ class Bugsnag_Error
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
$errorArray = array(
|
||||
'app' => $this->diagnostics->getAppData(),
|
||||
'device' => $this->diagnostics->getDeviceData(),
|
||||
'user' => $this->diagnostics->getUser(),
|
||||
'user' => is_null($this->user) ? $this->diagnostics->getUser() : $this->user,
|
||||
'context' => $this->diagnostics->getContext(),
|
||||
'payloadVersion' => $this->payloadVersion,
|
||||
'severity' => $this->severity,
|
||||
@@ -193,6 +338,11 @@ class Bugsnag_Error
|
||||
return $errorArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the exception array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function exceptionArray()
|
||||
{
|
||||
if ($this->previous) {
|
||||
@@ -210,6 +360,14 @@ class Bugsnag_Error
|
||||
return $this->cleanupObj($exceptionArray, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup the given object.
|
||||
*
|
||||
* @param mixed $obj the data to cleanup
|
||||
* @param bool $isMetaData if it is meta data
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
private function cleanupObj($obj, $isMetaData)
|
||||
{
|
||||
if (is_null($obj)) {
|
||||
|
||||
@@ -81,11 +81,25 @@ class Bugsnag_ErrorTypes
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Is the given error code fatal?
|
||||
*
|
||||
* @param int $code the error code
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isFatal($code)
|
||||
{
|
||||
return self::getSeverity($code) == 'error';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the given error code.
|
||||
*
|
||||
* @param int $code the error code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getName($code)
|
||||
{
|
||||
if (array_key_exists($code, self::$ERROR_TYPES)) {
|
||||
@@ -95,6 +109,13 @@ class Bugsnag_ErrorTypes
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the severity of the given error code.
|
||||
*
|
||||
* @param int $code the error code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getSeverity($code)
|
||||
{
|
||||
if (array_key_exists($code, self::$ERROR_TYPES)) {
|
||||
@@ -104,6 +125,13 @@ class Bugsnag_ErrorTypes
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the the levels for the given severity.
|
||||
*
|
||||
* @param string $severity the given severity
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function getLevelsForSeverity($severity)
|
||||
{
|
||||
$levels = 0;
|
||||
|
||||
151
vendor/bugsnag/bugsnag/src/Bugsnag/Notification.php
vendored
151
vendor/bugsnag/bugsnag/src/Bugsnag/Notification.php
vendored
@@ -4,15 +4,40 @@ class Bugsnag_Notification
|
||||
{
|
||||
private static $CONTENT_TYPE_HEADER = 'Content-type: application/json';
|
||||
|
||||
/**
|
||||
* The config instance.
|
||||
*
|
||||
* @var Bugsnag_Configuration
|
||||
*/
|
||||
private $config;
|
||||
/** @var Bugsnag_Error[] */
|
||||
|
||||
/**
|
||||
* The queue of errors to send to Bugsnag.
|
||||
*
|
||||
* @var Bugsnag_Error[]
|
||||
*/
|
||||
private $errorQueue = array();
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the configuration instance
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Bugsnag_Configuration $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an error to the queue.
|
||||
*
|
||||
* @param Bugsnag_Error $config the bugsnag error instance
|
||||
* @param array $passedMetaData the associated meta data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function addError(Bugsnag_Error $error, $passedMetaData = array())
|
||||
{
|
||||
// Check if this error should be sent to Bugsnag
|
||||
@@ -61,6 +86,11 @@ class Bugsnag_Notification
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
$events = array();
|
||||
@@ -79,32 +109,117 @@ class Bugsnag_Notification
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deliver everything on the queue to Bugsnag.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deliver()
|
||||
{
|
||||
if (!empty($this->errorQueue)) {
|
||||
// Post the request to bugsnag
|
||||
$this->postJSON($this->config->getNotifyEndpoint(), $this->toArray());
|
||||
|
||||
// Clear the error queue
|
||||
$this->errorQueue = array();
|
||||
if (empty($this->errorQueue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Post the request to bugsnag
|
||||
$this->postJSON($this->config->getNotifyEndpoint(), $this->toArray());
|
||||
|
||||
// Clear the error queue
|
||||
$this->errorQueue = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Post the given data to Bugsnag in json form.
|
||||
*
|
||||
* @param string $url the url to hit
|
||||
* @param array $data the data send
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postJSON($url, $data)
|
||||
{
|
||||
$body = json_encode($data);
|
||||
// Try to send the whole lot, or without the meta data for the first
|
||||
// event. If failed, try to send the first event, and then the rest of
|
||||
// them, revursively. Decrease by a constant and concquer if you like.
|
||||
// Note that the base case is satisfied as soon as the payload is small
|
||||
// enought to send, or when it's simply discarded.
|
||||
try {
|
||||
$body = $this->encode($data);
|
||||
} catch (RuntimeException $e) {
|
||||
if (count($data['events']) > 1) {
|
||||
$event = array_shift($data['events']);
|
||||
$this->postJSON($url, array_merge($data, array('events' => array($event))));
|
||||
$this->postJSON($url, $data);
|
||||
} else {
|
||||
error_log('Bugsnag Warning: '.$e->getMessage());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Prefer cURL if it is installed, otherwise fall back to fopen()
|
||||
// cURL supports both timeouts and proxies
|
||||
if (function_exists('curl_version')) {
|
||||
$this->postWithCurl($url, $body);
|
||||
} elseif (ini_get('allow_url_fopen')) {
|
||||
$this->postWithFopen($url, $body);
|
||||
} else {
|
||||
error_log('Bugsnag Warning: Couldn\'t notify (neither cURL or allow_url_fopen are available on your PHP installation)');
|
||||
|
||||
try {
|
||||
if (function_exists('curl_version')) {
|
||||
$this->postWithCurl($url, $body);
|
||||
} elseif (ini_get('allow_url_fopen')) {
|
||||
$this->postWithFopen($url, $body);
|
||||
} else {
|
||||
error_log('Bugsnag Warning: Couldn\'t notify (neither cURL or allow_url_fopen are available on your PHP installation)');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
error_log('Bugsnag Warning: Couldn\'t notify. '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Json encode the given data.
|
||||
*
|
||||
* We will also strip out the meta data if it's too large.
|
||||
*
|
||||
* @param array $data the data to encode
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function encode(array $data)
|
||||
{
|
||||
$body = json_encode($data);
|
||||
|
||||
if ($this->length($body) > 500000) {
|
||||
unset($data['events'][0]['metaData']);
|
||||
}
|
||||
|
||||
$body = json_encode($data);
|
||||
|
||||
if ($this->length($body) > 500000) {
|
||||
throw new RuntimeException('Payload too large');
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of the given string in bytes.
|
||||
*
|
||||
* @param string $str the string to get the length of
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function length($str)
|
||||
{
|
||||
return function_exists('mb_strlen') ? mb_strlen($str, '8bit') : strlen($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post the given info to Bugsnag using cURL.
|
||||
*
|
||||
* @param string $url the url to hit
|
||||
* @param string $body the request body
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function postWithCurl($url, $body)
|
||||
{
|
||||
$http = curl_init($url);
|
||||
@@ -164,6 +279,14 @@ class Bugsnag_Notification
|
||||
curl_close($http);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post the given info to Bugsnag using fopen.
|
||||
*
|
||||
* @param string $url the url to hit
|
||||
* @param string $body the request body
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function postWithFopen($url, $body)
|
||||
{
|
||||
// Warn about lack of proxy support if we are using fopen()
|
||||
|
||||
59
vendor/bugsnag/bugsnag/src/Bugsnag/Request.php
vendored
59
vendor/bugsnag/bugsnag/src/Bugsnag/Request.php
vendored
@@ -2,13 +2,29 @@
|
||||
|
||||
class Bugsnag_Request
|
||||
{
|
||||
/**
|
||||
* Are we currently processing a request?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isRequest()
|
||||
{
|
||||
return isset($_SERVER['REQUEST_METHOD']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the request formatted as meta data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getRequestMetaData()
|
||||
{
|
||||
static $requestData;
|
||||
|
||||
if ($requestData !== null) {
|
||||
return $requestData;
|
||||
}
|
||||
|
||||
$requestData = array();
|
||||
|
||||
$methodsWithPayload = array('PUT');
|
||||
@@ -23,12 +39,14 @@ class Bugsnag_Request
|
||||
if (!empty($_POST)) {
|
||||
$requestData['request']['params'] = $_POST;
|
||||
} else {
|
||||
$input = file_get_contents('php://input');
|
||||
|
||||
if (isset($_SERVER['CONTENT_TYPE']) && stripos($_SERVER['CONTENT_TYPE'], 'application/json') === 0) {
|
||||
$requestData['request']['params'] = json_decode(file_get_contents('php://input'), true);
|
||||
$requestData['request']['params'] = json_decode($input, true);
|
||||
}
|
||||
|
||||
if (isset($_SERVER['REQUEST_METHOD']) && in_array(strtoupper($_SERVER['REQUEST_METHOD']), $methodsWithPayload)) {
|
||||
parse_str(file_get_contents('php://input'), $params);
|
||||
parse_str($input, $params);
|
||||
if (isset($requestData['request']['params']) && is_array($requestData['request']['params'])) {
|
||||
$requestData['request']['params'] = array_merge($requestData['request']['params'], $params);
|
||||
} else {
|
||||
@@ -50,42 +68,61 @@ class Bugsnag_Request
|
||||
return $requestData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the request context.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getContext()
|
||||
{
|
||||
if (self::isRequest() && isset($_SERVER['REQUEST_METHOD']) && isset($_SERVER['REQUEST_URI'])) {
|
||||
return $_SERVER['REQUEST_METHOD'].' '.strtok($_SERVER['REQUEST_URI'], '?');
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the request id.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getUserId()
|
||||
{
|
||||
if (self::isRequest()) {
|
||||
return self::getRequestIp();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the request url.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getCurrentUrl()
|
||||
{
|
||||
$schema = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)) ? 'https://' : 'http://';
|
||||
|
||||
return $schema.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
|
||||
|
||||
return $schema.$host.$_SERVER['REQUEST_URI'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the request ip.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getRequestIp()
|
||||
{
|
||||
return isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the request headers.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getRequestHeaders()
|
||||
{
|
||||
if (function_exists('getallheaders')) {
|
||||
return getallheaders();
|
||||
}
|
||||
|
||||
$headers = array();
|
||||
|
||||
foreach ($_SERVER as $name => $value) {
|
||||
|
||||
@@ -8,6 +8,13 @@ class Bugsnag_Stacktrace
|
||||
public $frames = array();
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* Generate a new stacktrace using the given config.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the configuration instance
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function generate($config)
|
||||
{
|
||||
// Reduce memory usage by omitting args and objects from backtrace
|
||||
@@ -22,6 +29,15 @@ class Bugsnag_Stacktrace
|
||||
return self::fromBacktrace($config, $backtrace, '[generator]', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new stacktrace instance from a frame.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the configuration instance
|
||||
* @param string $file the associated file
|
||||
* @param int $line the line number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromFrame($config, $file, $line)
|
||||
{
|
||||
$stacktrace = new self($config);
|
||||
@@ -30,6 +46,16 @@ class Bugsnag_Stacktrace
|
||||
return $stacktrace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new stacktrace instance from a backtrace.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the configuration instance
|
||||
* @param array $backtrace the associated backtrace
|
||||
* @param int $topFile the top file to use
|
||||
* @param int $topLine the top line to use
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromBacktrace($config, $backtrace, $topFile, $topLine)
|
||||
{
|
||||
$stacktrace = new self($config);
|
||||
@@ -60,21 +86,50 @@ class Bugsnag_Stacktrace
|
||||
return $stacktrace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the given frame internally belong to bugsnag.
|
||||
*
|
||||
* @param array $frame the given frame to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function frameInsideBugsnag($frame)
|
||||
{
|
||||
return isset($frame['class']) && strpos($frame['class'], 'Bugsnag_') === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new stacktrace instance.
|
||||
*
|
||||
* @param Bugsnag_Configuration $config the configuration instance
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return $this->frames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given frame to the stacktrace.
|
||||
*
|
||||
* @param string $file the associated file
|
||||
* @param int $line the line number
|
||||
* @param string $method the method called
|
||||
* @param string|null $class the associated class
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addFrame($file, $line, $method, $class = null)
|
||||
{
|
||||
// Account for special "filenames" in eval'd code
|
||||
@@ -108,6 +163,15 @@ class Bugsnag_Stacktrace
|
||||
$this->frames[] = $frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the code for the given file and lines.
|
||||
*
|
||||
* @param string $path the path to the file
|
||||
* @param int $line the line to centre about
|
||||
* @param string $numLines the number of lines to fetch
|
||||
*
|
||||
* @return string[]|null
|
||||
*/
|
||||
private function getCode($path, $line, $numLines)
|
||||
{
|
||||
if (empty($path) || empty($line) || !file_exists($path)) {
|
||||
|
||||
Reference in New Issue
Block a user