diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 6dacc36e25515b81b8d2a145cb93aed97cdce5e5..35fe9647c63f341bfa365b38fc900f645183c9a4 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -3919,66 +3919,6 @@ "whoops" ] }, - { - "name": "ghislainf/zf2-whoops", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/ghislainf/zf2-whoops.git", - "reference": "2649cf7caf400409942ddc3f8fe15b89381fc74e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ghislainf/zf2-whoops/zipball/2649cf7caf400409942ddc3f8fe15b89381fc74e", - "reference": "2649cf7caf400409942ddc3f8fe15b89381fc74e", - "shasum": "" - }, - "require": { - "filp/whoops": "2.*", - "php": ">=5.3.3", - "zendframework/zend-config": "*", - "zendframework/zend-console": "*", - "zendframework/zend-eventmanager": "*", - "zendframework/zend-mvc": "*" - }, - "time": "2016-06-06T08:41:08+00:00", - "type": "module", - "installation-source": "dist", - "autoload": { - "psr-0": { - "zf2-whoops": "src/" - }, - "classmap": [ - "./Module.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Balázs Németh", - "email": "zsilbi@zsilbi.hu" - }, - { - "name": "Ghislain de Fontenay", - "homepage": "http://www.ghislainf.me/", - "role": "Developer" - }, - { - "name": "Filipe Dobreira", - "homepage": "https://github.com/filp" - }, - { - "name": "Andreas Frömer", - "homepage": "https://github.com/icanhazstring" - } - ], - "description": "PHP whoops error on ZF2 framework", - "homepage": "https://github.com/ghislainf/zf2-whoops" - }, { "name": "instaclick/php-webdriver", "version": "1.4.5", @@ -8456,5 +8396,65 @@ "archive", "tar" ] + }, + { + "name": "ghislainf/zf2-whoops", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://github.com/ghislainf/zf2-whoops.git", + "reference": "2649cf7caf400409942ddc3f8fe15b89381fc74e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ghislainf/zf2-whoops/zipball/2649cf7caf400409942ddc3f8fe15b89381fc74e", + "reference": "2649cf7caf400409942ddc3f8fe15b89381fc74e", + "shasum": "" + }, + "require": { + "filp/whoops": "2.*", + "php": ">=5.3.3", + "zendframework/zend-config": "*", + "zendframework/zend-console": "*", + "zendframework/zend-eventmanager": "*", + "zendframework/zend-mvc": "*" + }, + "time": "2016-06-06T08:41:08+00:00", + "type": "module", + "installation-source": "dist", + "autoload": { + "psr-0": { + "zf2-whoops": "src/" + }, + "classmap": [ + "./Module.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Balázs Németh", + "email": "zsilbi@zsilbi.hu" + }, + { + "name": "Ghislain de Fontenay", + "homepage": "http://www.ghislainf.me/", + "role": "Developer" + }, + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp" + }, + { + "name": "Andreas Frömer", + "homepage": "https://github.com/icanhazstring" + } + ], + "description": "PHP whoops error on ZF2 framework", + "homepage": "https://github.com/ghislainf/zf2-whoops" } ] diff --git a/vendor/ghislainf/zf2-whoops/.gitignore b/vendor/ghislainf/zf2-whoops/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..5e34a9c1be254e5a43359aea9f7a31c7a0d85a97 --- /dev/null +++ b/vendor/ghislainf/zf2-whoops/.gitignore @@ -0,0 +1,9 @@ +### JetBrains +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio +*.iml + +## Directory-based project format: +.idea/ + +### Composer +vendor/ diff --git a/vendor/ghislainf/zf2-whoops/Module.php b/vendor/ghislainf/zf2-whoops/Module.php new file mode 100644 index 0000000000000000000000000000000000000000..c143745daa914fa13cf57793ddf6c0ccc4c92227 --- /dev/null +++ b/vendor/ghislainf/zf2-whoops/Module.php @@ -0,0 +1,140 @@ +<?php +namespace Zf2Whoops; + +use Zend\EventManager\EventInterface; +use Zend\ModuleManager\Feature\BootstrapListenerInterface; +use Zend\Console\Request as ConsoleRequest; +use Zend\Stdlib\ResponseInterface as Response; +use Zend\Mvc\Application; +use Zend\Mvc\MvcEvent; +use Whoops\Run; +use Whoops\Handler\JsonResponseHandler; +use Whoops\Handler\PrettyPageHandler; +use Zend\Http\PhpEnvironment\Request; + +class Module implements BootstrapListenerInterface +{ + /** + * @var Run + */ + protected $run = null; + + /** + * @var array + */ + protected $noCatchExceptions = array(); + + /** + * {@inheritDoc} + */ + public function onBootstrap(EventInterface $e) + { + $config = $e->getTarget()->getServiceManager()->get('Config'); + $config = isset($config['view_manager']) ? $config['view_manager'] : array(); + $request = $e->getRequest(); + + if ($request instanceof ConsoleRequest || empty($config['display_exceptions'])) { + return; + } + + $this->run = new Run(); + + + if( $request instanceof Request && $request->isXmlHttpRequest() ) + { + $jsonHandler = new JsonResponseHandler(); + + if (!empty($config['json_exceptions']['show_trace'])) { + $jsonHandler->addTraceToOutput(true); + } + + $this->run->pushHandler($jsonHandler); + } + else + { + $prettyPageHandler = new PrettyPageHandler(); + + if( isset($config['editor']) ) + { + if( $config['editor'] == 'phpStorm' ) + { + $localPath = null; + if( isset($config['local_path']) ) + { + $localPath = $config['local_path']; + } + + $prettyPageHandler->setEditor( + function ( $file, $line ) use ( $localPath ) + { + if( $localPath ) + { + // if your development server is not local it's good to map remote files to local + $translations = array( '^' . __DIR__ => $config['editor_path'] ); // change to your path + + foreach( $translations as $from => $to ) + { + $file = preg_replace( '#' . $from . '#', $to, $file, 1 ); + } + } + + return "pstorm://$file:$line"; + } + ); + } + else + { + $prettyPageHandler->setEditor( $config['editor'] ); + } + } + $this->run->pushHandler($prettyPageHandler); + } + + if (!empty($config['whoops_no_catch'])) + { + $this->noCatchExceptions = $config['whoops_no_catch']; + } + + $this->run->register(); + + $eventManager = $e->getTarget()->getEventManager(); + $eventManager->attach(MvcEvent::EVENT_RENDER_ERROR, array($this, 'prepareException')); + $eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'prepareException')); + } + + /** + * Whoops handle exceptions + * @param MvcEvent $e + */ + public function prepareException(MvcEvent $e) + { + $error = $e->getError(); + if (!empty($error) && !$e->getResult() instanceof Response) { + switch ($error) { + case Application::ERROR_CONTROLLER_NOT_FOUND: + case Application::ERROR_CONTROLLER_INVALID: + case Application::ERROR_ROUTER_NO_MATCH: + // Specifically not handling these + return; + + case Application::ERROR_EXCEPTION: + default: + if (in_array(get_class($e->getParam('exception')), $this->noCatchExceptions)) { + // No catch this exception + return; + } + + $response = $e->getResponse(); + if (!$response || $response->getStatusCode() === 200) { + header('HTTP/1.0 500 Internal Server Error', true, 500); + } + + if (ob_get_length()) { + ob_clean(); + } + $this->run->handleException($e->getParam('exception')); + break; + } + } + } +} diff --git a/vendor/ghislainf/zf2-whoops/README.md b/vendor/ghislainf/zf2-whoops/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d91ef2e404fd2bff24f2584a8645d63e309ebb97 --- /dev/null +++ b/vendor/ghislainf/zf2-whoops/README.md @@ -0,0 +1,31 @@ +ZF2 module, integrated [whoops](https://github.com/filp/whoops) + +----- + + + +**whoops** is an error handler base/framework for PHP. Out-of-the-box, it provides a pretty +error interface that helps you debug your web projects, but at heart it's a simple yet +powerful stacked error handling system. + +## Module installation + 1. `cd my/project/directory` + 2. create a `composer.json` file with following contents: + + ```json + { + "require": { + "ghislainf/zf2-whoops": "dev-master" + } + } + ``` + 3. install composer via `curl -s http://getcomposer.org/installer | php` (on windows, download + http://getcomposer.org/installer and execute it with PHP) + 4. run `php composer.phar install` + 5. open `my/project/directory/configs/application.config.php` and add the following key to your `modules`, : + + ```php + 'Zf2Whoops', // must be added as the first module + ``` + 6. copy `config/zf2-whoops.local.php` in `my/project/directory/config/autoload` + 7. edit `my/project/directory/config/autoload/zf2-whoops.local.php` diff --git a/vendor/ghislainf/zf2-whoops/composer.json b/vendor/ghislainf/zf2-whoops/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..c1a2115463c518ef5ce18877b6c36217e1f280b5 --- /dev/null +++ b/vendor/ghislainf/zf2-whoops/composer.json @@ -0,0 +1,48 @@ +{ + "name": "ghislainf/zf2-whoops", + "description": "PHP whoops error on ZF2 framework", + "version": "1.0.0", + "type": "module", + "license": "MIT", + "tags": [ + "zend framework", + "zf2", + "whoops" + ], + "homepage": "https://github.com/ghislainf/zf2-whoops", + "authors": [ + { + "name": "Ghislain de Fontenay", + "homepage": "http://www.ghislainf.me/", + "role": "Developer" + }, + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp" + }, + { + "name": "Balázs Németh", + "email": "zsilbi@zsilbi.hu" + }, + { + "name": "Andreas Frömer", + "homepage": "https://github.com/icanhazstring" + } + ], + "require": { + "php": ">=5.3.3", + "zendframework/zend-eventmanager": "*", + "zendframework/zend-config": "*", + "zendframework/zend-mvc": "*", + "zendframework/zend-console": "*", + "filp/whoops": "2.*" + }, + "autoload": { + "psr-0": { + "zf2-whoops": "src/" + }, + "classmap": [ + "./Module.php" + ] + } +} diff --git a/vendor/ghislainf/zf2-whoops/config/zf2-whoops.local.php b/vendor/ghislainf/zf2-whoops/config/zf2-whoops.local.php new file mode 100644 index 0000000000000000000000000000000000000000..6d8aa86bdd75059b0dbad05cb87609bfa80e8ae6 --- /dev/null +++ b/vendor/ghislainf/zf2-whoops/config/zf2-whoops.local.php @@ -0,0 +1,16 @@ +<?php +return array( + 'view_manager' => array( + 'editor' => 'sublime', + 'display_not_found_reason' => true, + 'display_exceptions' => true, + 'json_exceptions' => array( + 'display' => true, + 'ajax_only' => true, + 'show_trace' => true + ), + 'whoops_no_catch' => array( + 'BjyAuthorize\Exception\UnAuthorizedException' + ) + ), +);