From 41de2ee9b14fe601e6aaf80a30d11da03efbd2c1 Mon Sep 17 00:00:00 2001 From: Simon Asika Date: Sat, 6 May 2017 22:09:43 +0800 Subject: [PATCH] Update Windwalker --- .../default/administrator/config.xml | 452 +++++++++--------- .../default/administrator/helper/helper.php | 58 +++ .../tmpl/edit.php | 2 +- .../tmpl/default.php | 3 +- .../model/{{controller.list.name.lower}}.php | 10 +- .../component/default/site/router.php | 2 + .../tmpl/default.xml | 12 +- .../{{controller.list.name.lower}}/html.php | 3 + .../tmpl/default.xml | 89 +++- windwalker/composer.lock | 108 +++-- .../windwalker/frontend/page/heading.php | 2 +- windwalker/src/Component/Component.php | 6 + .../src/Console/Application/Console.php | 9 + .../Admin/AbstractAdminController.php | 4 +- .../Batch/AbstractBatchController.php | 5 + .../src/Controller/Batch/CopyController.php | 2 + .../src/Controller/Batch/MoveController.php | 2 + .../src/Controller/Edit/ApplyController.php | 14 +- .../Controller/Edit/Save2copyController.php | 10 + .../Controller/Edit/Save2newController.php | 13 +- .../Controller/State/ReorderController.php | 2 +- windwalker/src/Elfinder/View/DisplayView.php | 4 +- windwalker/src/Form/Fields/finder.php | 4 +- .../src/Form/Forms/quickadd/category.xml | 18 +- windwalker/src/Helper/CurlHelper.php | 2 +- windwalker/src/Helper/ModalHelper.php | 10 +- windwalker/src/Image/Thumb.php | 13 +- windwalker/src/Model/CrudModel.php | 2 +- windwalker/src/Model/ListModel.php | 2 +- windwalker/src/Table/Table.php | 28 +- windwalker/vendor/autoload.php | 2 +- windwalker/vendor/composer/ClassLoader.php | 58 ++- windwalker/vendor/composer/LICENSE | 2 +- windwalker/vendor/composer/autoload_psr4.php | 1 + windwalker/vendor/composer/autoload_real.php | 2 +- .../vendor/composer/autoload_static.php | 8 + windwalker/vendor/composer/installed.json | 311 +++++++----- windwalker/vendor/filp/whoops/composer.json | 12 +- .../whoops/src/Whoops/Exception/Formatter.php | 10 +- .../whoops/src/Whoops/Exception/Frame.php | 37 +- .../src/Whoops/Exception/FrameCollection.php | 12 + .../whoops/src/Whoops/Exception/Inspector.php | 20 +- .../whoops/src/Whoops/Handler/Handler.php | 10 +- .../src/Whoops/Handler/HandlerInterface.php | 6 +- .../Whoops/Handler/JsonResponseHandler.php | 43 +- .../src/Whoops/Handler/PlainTextHandler.php | 38 +- .../src/Whoops/Handler/PrettyPageHandler.php | 280 ++++++++--- .../src/Whoops/Handler/XmlResponseHandler.php | 12 +- .../src/Whoops/Resources/css/whoops.base.css | 75 ++- .../src/Whoops/Resources/js/whoops.base.js | 130 ++++- .../Resources/views/frame_code.html.php | 25 +- .../Resources/views/frame_list.html.php | 14 +- .../Resources/views/frames_container.html.php | 3 + .../views/frames_description.html.php | 20 + .../Resources/views/header_outer.html.php | 3 + .../Whoops/Resources/views/layout.html.php | 20 +- .../Resources/views/panel_details.html.php | 2 + .../views/panel_details_outer.html.php | 3 + .../Resources/views/panel_left.html.php | 3 + .../Resources/views/panel_left_outer.html.php | 3 + .../vendor/filp/whoops/src/Whoops/Run.php | 42 +- .../whoops/src/Whoops/Util/TemplateHelper.php | 80 +++- windwalker/vendor/index.html | 1 + windwalker/vendor/psr/log/.gitignore | 1 + windwalker/vendor/psr/log/LICENSE | 19 + .../vendor/psr/log/Psr/Log/AbstractLogger.php | 128 +++++ .../log/Psr/Log/InvalidArgumentException.php | 7 + .../vendor/psr/log/Psr/Log/LogLevel.php | 18 + .../psr/log/Psr/Log/LoggerAwareInterface.php | 18 + .../psr/log/Psr/Log/LoggerAwareTrait.php | 26 + .../psr/log/Psr/Log/LoggerInterface.php | 123 +++++ .../vendor/psr/log/Psr/Log/LoggerTrait.php | 140 ++++++ .../vendor/psr/log/Psr/Log/NullLogger.php | 28 ++ .../log/Psr/Log/Test/LoggerInterfaceTest.php | 140 ++++++ windwalker/vendor/psr/log/README.md | 45 ++ windwalker/vendor/psr/log/composer.json | 26 + windwalker/vendor/symfony/yaml/Dumper.php | 4 +- windwalker/vendor/symfony/yaml/Escaper.php | 14 +- .../symfony/yaml/Exception/ParseException.php | 10 +- windwalker/vendor/symfony/yaml/Inline.php | 92 ++-- windwalker/vendor/symfony/yaml/LICENSE | 2 +- windwalker/vendor/symfony/yaml/Parser.php | 281 ++++++----- .../vendor/symfony/yaml/Tests/DumperTest.php | 39 +- .../yaml/Tests/Fixtures/sfMergeKey.yml | 10 +- .../vendor/symfony/yaml/Tests/InlineTest.php | 84 +++- .../symfony/yaml/Tests/ParseExceptionTest.php | 3 +- .../vendor/symfony/yaml/Tests/ParserTest.php | 227 +++++++-- .../vendor/symfony/yaml/Tests/YamlTest.php | 3 +- windwalker/vendor/symfony/yaml/Unescaper.php | 8 +- windwalker/vendor/symfony/yaml/Yaml.php | 12 +- .../vendor/symfony/yaml/phpunit.xml.dist | 2 + windwalker/windwalker.xml | 5 +- 92 files changed, 2765 insertions(+), 929 deletions(-) create mode 100644 windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frames_container.html.php create mode 100644 windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php create mode 100644 windwalker/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php create mode 100644 windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php create mode 100644 windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php create mode 100644 windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php create mode 100644 windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php create mode 100644 windwalker/vendor/index.html create mode 100644 windwalker/vendor/psr/log/.gitignore create mode 100644 windwalker/vendor/psr/log/LICENSE create mode 100644 windwalker/vendor/psr/log/Psr/Log/AbstractLogger.php create mode 100644 windwalker/vendor/psr/log/Psr/Log/InvalidArgumentException.php create mode 100644 windwalker/vendor/psr/log/Psr/Log/LogLevel.php create mode 100644 windwalker/vendor/psr/log/Psr/Log/LoggerAwareInterface.php create mode 100644 windwalker/vendor/psr/log/Psr/Log/LoggerAwareTrait.php create mode 100644 windwalker/vendor/psr/log/Psr/Log/LoggerInterface.php create mode 100644 windwalker/vendor/psr/log/Psr/Log/LoggerTrait.php create mode 100644 windwalker/vendor/psr/log/Psr/Log/NullLogger.php create mode 100644 windwalker/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php create mode 100644 windwalker/vendor/psr/log/README.md create mode 100644 windwalker/vendor/psr/log/composer.json diff --git a/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/config.xml b/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/config.xml index 5d25771..8622d2e 100644 --- a/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/config.xml +++ b/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/config.xml @@ -1,228 +1,244 @@ -
- - - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ > trigger('onAfterAddSubmenu', array('{{extension.element.lower}}', $vName)); } + /** + * Adds Count Items for Category Manager. + * + * @param stdClass[] &$items The banner category objects + * + * @return stdClass[] + * + * @throws \RuntimeException + * + * @since 1.0 + */ + public static function countItems(&$items) + { + $db = JFactory::getDbo(); + + foreach ($items as $item) + { + $item->count_trashed = 0; + $item->count_archived = 0; + $item->count_unpublished = 0; + $item->count_published = 0; + + $query = $db->getQuery(true); + + $query->select('state, count(*) AS count') + ->from($query->quoteName('#__{{extension.name.lower}}_{{controller.list.name.lower}}')) + ->where('catid = ' . (int) $item->id) + ->group('state'); + + $db->setQuery($query); + + $elements = (array) $db->loadObjectList(); + + foreach ($elements as $element) + { + switch ($element->state) { + case 0: + $item->count_unpublished = $element->count; + break; + + case 1: + $item->count_published = $element->count; + break; + + case 2: + $item->count_archived = $element->count; + break; + + case -2: + $item->count_trashed = $element->count; + break; + } + } + } + + return $items; + } + /** * Gets a list of the actions that can be performed. * diff --git a/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/view/{{controller.item.name.lower}}/tmpl/edit.php b/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/view/{{controller.item.name.lower}}/tmpl/edit.php index feaf74f..849bd73 100644 --- a/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/view/{{controller.item.name.lower}}/tmpl/edit.php +++ b/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/view/{{controller.item.name.lower}}/tmpl/edit.php @@ -44,7 +44,7 @@
-
'tab_basic')); ?> diff --git a/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/view/{{controller.list.name.lower}}/tmpl/default.php b/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/view/{{controller.list.name.lower}}/tmpl/default.php index 1f41acf..8f0d48d 100644 --- a/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/view/{{controller.list.name.lower}}/tmpl/default.php +++ b/windwalker/bundles/GeneratorBundle/Template/component/default/administrator/view/{{controller.list.name.lower}}/tmpl/default.php @@ -24,9 +24,8 @@ */ $container = $this->getContainer(); ?> -
- + data->sidebar)): ?>
diff --git a/windwalker/bundles/GeneratorBundle/Template/component/default/site/model/{{controller.list.name.lower}}.php b/windwalker/bundles/GeneratorBundle/Template/component/default/site/model/{{controller.list.name.lower}}.php index d40f28f..d9464c9 100644 --- a/windwalker/bundles/GeneratorBundle/Template/component/default/site/model/{{controller.list.name.lower}}.php +++ b/windwalker/bundles/GeneratorBundle/Template/component/default/site/model/{{controller.list.name.lower}}.php @@ -183,9 +183,15 @@ protected function populateState($ordering = null, $direction = null) // Limitstart // ===================================================================================== - $this->set('list.start', $input->getInt('limitstart', 0)); - $this->set('list.limit', $params->get('num_intro_articles', 15)); + // Simple fix for current Joomla + // @see https://github.com/ventoviro/windwalker-joomla-rad/issues/203 + $this->set('list.start', $input->getInt('start', $input->getInt('limitstart', 0))); + $this->set( + 'list.limit', + $params->get('num_leading_articles', 0) + + $params->get('num_intro_articles', 15) + ); } /** diff --git a/windwalker/bundles/GeneratorBundle/Template/component/default/site/router.php b/windwalker/bundles/GeneratorBundle/Template/component/default/site/router.php index c73b489..d66d538 100644 --- a/windwalker/bundles/GeneratorBundle/Template/component/default/site/router.php +++ b/windwalker/bundles/GeneratorBundle/Template/component/default/site/router.php @@ -92,6 +92,8 @@ public function build(&$query) if (!empty($query['_resource'])) { $segments = $this->router->generate($query['_resource'], $query); + + unset($query['view'], $query['_rawRoute']); } else { diff --git a/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.item.name.lower}}/tmpl/default.xml b/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.item.name.lower}}/tmpl/default.xml index 60d742f..5ba0aad 100644 --- a/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.item.name.lower}}/tmpl/default.xml +++ b/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.item.name.lower}}/tmpl/default.xml @@ -4,7 +4,7 @@ option="{{extension.element.lower}}_{{controller.item.name.lower}}_view_default_option"> + /> @@ -20,7 +20,7 @@ label="{{extension.element.upper}}_SELECT_{{controller.item.name.upper}}" required="true" description="C{{extension.element.upper}}_SELECT_{{controller.item.name.upper}}_DESC" - /> + />
@@ -44,7 +44,7 @@ type="list" description="JGLOBAL_LINKED_TITLES_DESC" label="JGLOBAL_LINKED_TITLES_LABEL" - > + > @@ -54,7 +54,7 @@ type="list" description="{{extension.element.upper}}_LINKED_TITLES_IN_LIST_DESC" label="{{extension.element.upper}}_LINKED_TITLES_IN_LIST" - > + > @@ -64,7 +64,7 @@ type="list" description="JGLOBAL_SHOW_INTRO_DESC" label="JGLOBAL_SHOW_INTRO_LABEL" - > + > @@ -74,7 +74,7 @@ type="list" description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC" label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL" - > + > diff --git a/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.list.name.lower}}/html.php b/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.list.name.lower}}/html.php index b8345fa..ab266db 100644 --- a/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.list.name.lower}}/html.php +++ b/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.list.name.lower}}/html.php @@ -68,6 +68,9 @@ protected function prepareData() $this['params'] = $this->get('Params'); $this['category'] = $this->get('Category'); + // Uncomment this to fix Joomla pagination routing + // $this['pagination']->setAdditionalUrlParam('_resource', '{{controller.list.name.lower}}'); + // Set Data // ===================================================================================== foreach ($this->data->items as &$item) diff --git a/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.list.name.lower}}/tmpl/default.xml b/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.list.name.lower}}/tmpl/default.xml index 5062437..b12d20f 100644 --- a/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.list.name.lower}}/tmpl/default.xml +++ b/windwalker/bundles/GeneratorBundle/Template/component/default/site/view/{{controller.list.name.lower}}/tmpl/default.xml @@ -4,7 +4,7 @@ option="{{extension.element.upper}}_{{controller.list.name.upper}}_VIEW_DEFAULT_OPTION"> + /> @@ -13,7 +13,7 @@
+ > + >
@@ -39,13 +39,13 @@ view="{{controller.list.name.lower}}" label="JFIELD_ALT_LAYOUT" description="JGLOBAL_FIELD_LAYOUT_DESC" - /> + /> + > @@ -55,7 +55,7 @@ type="list" description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC" label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL" - > + > @@ -65,7 +65,7 @@ type="list" description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC" label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL" - > + > @@ -75,7 +75,7 @@ type="list" description="JGLOBAL_MAXLEVEL_DESC" label="JGLOBAL_MAXLEVEL_LABEL" - > + > @@ -90,18 +90,55 @@ description="JGLOBAL_SUBHEADING_DESC" label="JGLOBAL_SUBHEADING_LABEL" size="20" - /> + /> + + + + + + + + + + + + + +
- + /> + > @@ -161,7 +198,7 @@ + > @@ -171,7 +208,7 @@ type="list" description="JGLOBAL_PAGINATION_DESC" label="JGLOBAL_PAGINATION_LABEL" - > + > @@ -197,7 +234,7 @@ type="list" description="JGLOBAL_LINKED_TITLES_DESC" label="JGLOBAL_LINKED_TITLES_LABEL" - > + > @@ -207,7 +244,7 @@ type="list" description="{{extension.element.upper}}_LINKED_TITLES_IN_LIST_DESC" label="{{extension.element.upper}}_LINKED_TITLES_IN_LIST" - > + > @@ -217,7 +254,7 @@ type="list" description="JGLOBAL_SHOW_INTRO_DESC" label="JGLOBAL_SHOW_INTRO_LABEL" - > + > @@ -227,7 +264,7 @@ type="list" description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC" label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL" - > + > @@ -235,13 +272,13 @@
+ > + > @@ -251,7 +288,7 @@ type="list" description="JGLOBAL_FEED_SUMMARY_DESC" label="JGLOBAL_FEED_SUMMARY_LABEL" - > + > diff --git a/windwalker/composer.lock b/windwalker/composer.lock index 3df4a2a..1d6b858 100644 --- a/windwalker/composer.lock +++ b/windwalker/composer.lock @@ -4,7 +4,6 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "23e214c9b614c88d1a59da08de2be874", "content-hash": "4c18d6e53acc5e325ca5011ea4b007ed", "packages": [ { @@ -56,29 +55,30 @@ "scaffold", "scaffolding" ], - "time": "2016-03-23 12:47:07" + "time": "2016-03-23T12:47:07+00:00" }, { "name": "filp/whoops", - "version": "2.1.2", + "version": "2.1.8", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "d13505b240a6f580bc75ba591da30299d6cb0eec" + "reference": "f2950be7da8b8d6c4e77821b6c9d486e36cdc4f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/d13505b240a6f580bc75ba591da30299d6cb0eec", - "reference": "d13505b240a6f580bc75ba591da30299d6cb0eec", + "url": "https://api.github.com/repos/filp/whoops/zipball/f2950be7da8b8d6c4e77821b6c9d486e36cdc4f3", + "reference": "f2950be7da8b8d6c4e77821b6c9d486e36cdc4f3", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9 || ^7.0", + "psr/log": "^1.0.1" }, "require-dev": { "mockery/mockery": "0.9.*", "phpunit/phpunit": "^4.8 || ^5.0", - "symfony/var-dumper": "~3.0" + "symfony/var-dumper": "^2.6 || ^3.0" }, "suggest": { "symfony/var-dumper": "Pretty print complex values better with var-dumper available", @@ -107,7 +107,7 @@ } ], "description": "php error handling for cool kids", - "homepage": "https://github.com/filp/whoops", + "homepage": "https://filp.github.io/whoops/", "keywords": [ "error", "exception", @@ -116,20 +116,67 @@ "whoops", "zf2" ], - "time": "2016-04-07 06:16:25" + "time": "2017-03-07T09:04:45+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.6", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e4fbcc65f90909c999ac3b4dfa699ee6563a9940" + "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e4fbcc65f90909c999ac3b4dfa699ee6563a9940", - "reference": "e4fbcc65f90909c999ac3b4dfa699ee6563a9940", + "url": "https://api.github.com/repos/symfony/yaml/zipball/93ccdde79f4b079c7558da4656a3cb1c50c68e02", + "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02", "shasum": "" }, "require": { @@ -165,7 +212,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-03-29 19:00:15" + "time": "2017-05-01T14:31:55+00:00" }, { "name": "windwalker/cache", @@ -209,7 +256,7 @@ "framework", "windwalker" ], - "time": "2016-02-12 15:36:22" + "time": "2016-02-12T15:36:22+00:00" }, { "name": "windwalker/compare", @@ -253,7 +300,7 @@ "framework", "windwalker" ], - "time": "2016-02-12 15:36:22" + "time": "2016-02-12T15:36:22+00:00" }, { "name": "windwalker/console", @@ -299,7 +346,7 @@ "framework", "windwalker" ], - "time": "2016-04-02 04:13:51" + "time": "2016-04-02T04:13:51+00:00" }, { "name": "windwalker/data", @@ -343,7 +390,7 @@ "framework", "windwalker" ], - "time": "2016-02-12 15:36:22" + "time": "2016-02-12T15:36:22+00:00" }, { "name": "windwalker/datamapper", @@ -396,7 +443,7 @@ "framework", "windwalker" ], - "time": "2016-03-21 06:58:16" + "time": "2016-03-21T06:58:16+00:00" }, { "name": "windwalker/dom", @@ -440,7 +487,7 @@ "framework", "windwalker" ], - "time": "2016-02-12 15:36:22" + "time": "2016-02-12T15:36:22+00:00" }, { "name": "windwalker/filesystem", @@ -484,7 +531,7 @@ "framework", "windwalker" ], - "time": "2016-03-23 15:01:32" + "time": "2016-03-23T15:01:32+00:00" }, { "name": "windwalker/html", @@ -529,7 +576,7 @@ "html", "windwalker" ], - "time": "2016-02-12 15:36:22" + "time": "2016-02-12T15:36:22+00:00" }, { "name": "windwalker/io", @@ -577,7 +624,7 @@ "io", "windwalker" ], - "time": "2016-03-08 11:38:11" + "time": "2016-03-08T11:38:11+00:00" }, { "name": "windwalker/registry", @@ -625,7 +672,8 @@ "registry", "windwalker" ], - "time": "2016-03-07 10:02:08" + "abandoned": "windwalker/structure", + "time": "2016-03-07T10:02:08+00:00" }, { "name": "windwalker/router", @@ -670,7 +718,7 @@ "router", "windwalker" ], - "time": "2016-03-21 07:58:51" + "time": "2016-03-21T07:58:51+00:00" }, { "name": "windwalker/string", @@ -718,7 +766,7 @@ "string", "windwalker" ], - "time": "2016-03-23 15:03:50" + "time": "2016-03-23T15:03:50+00:00" }, { "name": "windwalker/utilities", @@ -766,7 +814,7 @@ "utilities", "windwalker" ], - "time": "2016-02-12 15:36:22" + "time": "2016-02-12T15:36:22+00:00" } ], "packages-dev": [ @@ -812,7 +860,7 @@ "framework", "windwalker" ], - "time": "2016-02-12 15:36:22" + "time": "2016-02-12T15:36:22+00:00" }, { "name": "windwalker/test", @@ -854,7 +902,7 @@ "test", "windwalker" ], - "time": "2016-02-12 15:36:22" + "time": "2016-02-12T15:36:22+00:00" } ], "aliases": [], diff --git a/windwalker/resource/layouts/windwalker/frontend/page/heading.php b/windwalker/resource/layouts/windwalker/frontend/page/heading.php index c4258ca..9d224ff 100644 --- a/windwalker/resource/layouts/windwalker/frontend/page/heading.php +++ b/windwalker/resource/layouts/windwalker/frontend/page/heading.php @@ -14,7 +14,7 @@ * @var $this \Windwalker\View\Engine\PhpEngine */ ?> -params->get('show_page_heading', 1)) : ?> +params->get('show_page_heading')) : ?>

escape($data->params->get('page_heading')); ?>

diff --git a/windwalker/src/Component/Component.php b/windwalker/src/Component/Component.php index 1b423e3..51b910b 100644 --- a/windwalker/src/Component/Component.php +++ b/windwalker/src/Component/Component.php @@ -259,6 +259,12 @@ public function init() $this->input->set('controller', $task); } + // Load JFormFieldList to fix 3.7 FormHelper bugs + if (version_compare(JVERSION, '3.7', '>=')) + { + \JFormHelper::loadFieldClass('list'); + } + // Register form and fields \JForm::addFieldPath(WINDWALKER_SOURCE . '/Form/Fields'); \JForm::addFormPath(WINDWALKER_SOURCE . '/Form/Forms'); diff --git a/windwalker/src/Console/Application/Console.php b/windwalker/src/Console/Application/Console.php index 7c541d3..8f29fa3 100644 --- a/windwalker/src/Console/Application/Console.php +++ b/windwalker/src/Console/Application/Console.php @@ -81,6 +81,15 @@ public function __construct(IOInterface $io = null, \Windwalker\Registry\Registr $descriptorHelper->setOptionDescriptor(new OptionDescriptor) ->setCommandDescriptor(new CommandDescriptor); + + /* + * Note: The below code CANNOT change from instantiating a session via JFactory until there is a proper dependency injection container supported + * by the application. The current default behaviours result in this method being called each time an application class is instantiated. + * https://github.com/joomla/joomla-cms/issues/12108 explains why things will crash and burn if you ever attempt to make this change + * without a proper dependency injection container. + */ + $session = \JFactory::getSession(); + $session->initialise(new \JInput, $this->dispatcher); $this->loadFirstlevelCommands(); } diff --git a/windwalker/src/Controller/Admin/AbstractAdminController.php b/windwalker/src/Controller/Admin/AbstractAdminController.php index 42a7c59..a216e24 100644 --- a/windwalker/src/Controller/Admin/AbstractAdminController.php +++ b/windwalker/src/Controller/Admin/AbstractAdminController.php @@ -104,8 +104,8 @@ protected function prepareExecute() $this->user = $this->container->get('user'); $this->lang = $this->container->get('language'); - $this->model = $this->getModel($this->viewItem); - $this->table = $this->model->getTable($this->viewItem, $this->prefix . 'Table'); + $this->model = $this->getModel(); + $this->table = $this->model->getTable(); // Determine model if (!($this->model instanceof CrudModel)) diff --git a/windwalker/src/Controller/Batch/AbstractBatchController.php b/windwalker/src/Controller/Batch/AbstractBatchController.php index d0be599..ede0eff 100644 --- a/windwalker/src/Controller/Batch/AbstractBatchController.php +++ b/windwalker/src/Controller/Batch/AbstractBatchController.php @@ -153,6 +153,11 @@ abstract protected function save($pk, $data); */ protected function postExecute($result = null) { + if ($result === false) + { + return false; + } + if (!is_array($result)) { $result = array($result); diff --git a/windwalker/src/Controller/Batch/CopyController.php b/windwalker/src/Controller/Batch/CopyController.php index 4ecfee7..e214306 100644 --- a/windwalker/src/Controller/Batch/CopyController.php +++ b/windwalker/src/Controller/Batch/CopyController.php @@ -85,6 +85,8 @@ protected function save($pk, $data) // Unset the primary key so that we can copy it. unset($item[$this->urlVar]); + $this->model->set($this->model->getName() . '.id', null); + return $this->model->save($item); } } diff --git a/windwalker/src/Controller/Batch/MoveController.php b/windwalker/src/Controller/Batch/MoveController.php index b8d8366..b7cd5c9 100644 --- a/windwalker/src/Controller/Batch/MoveController.php +++ b/windwalker/src/Controller/Batch/MoveController.php @@ -32,6 +32,8 @@ protected function save($pk, $data) return false; } + $this->model->set($this->model->getName() . '.id', null); + return $this->model->save($data); } } diff --git a/windwalker/src/Controller/Edit/ApplyController.php b/windwalker/src/Controller/Edit/ApplyController.php index 376d3d0..4e83db4 100644 --- a/windwalker/src/Controller/Edit/ApplyController.php +++ b/windwalker/src/Controller/Edit/ApplyController.php @@ -8,13 +8,25 @@ namespace Windwalker\Controller\Edit; +use Windwalker\Controller\Admin\AbstractItemController; + /** * Apply Controller. * * @since 2.0 */ -class ApplyController extends SaveController +class ApplyController extends AbstractItemController { + /** + * Method to run this controller. + * + * @return mixed + */ + protected function doExecute() + { + return $this->fetch($this->prefix, $this->name . '.edit.save'); + } + /** * Pose execute hook. * diff --git a/windwalker/src/Controller/Edit/Save2copyController.php b/windwalker/src/Controller/Edit/Save2copyController.php index fa14396..cc8649b 100644 --- a/windwalker/src/Controller/Edit/Save2copyController.php +++ b/windwalker/src/Controller/Edit/Save2copyController.php @@ -17,6 +17,16 @@ */ class Save2copyController extends SaveController { + /** + * Method to run this controller. + * + * @return mixed + */ + protected function doExecute() + { + return $this->fetch($this->prefix, $this->name . '.edit.save'); + } + /** * Pose execute hook. * diff --git a/windwalker/src/Controller/Edit/Save2newController.php b/windwalker/src/Controller/Edit/Save2newController.php index 3b66ad5..19e689c 100644 --- a/windwalker/src/Controller/Edit/Save2newController.php +++ b/windwalker/src/Controller/Edit/Save2newController.php @@ -8,9 +8,6 @@ namespace Windwalker\Controller\Edit; -use Windwalker\Controller\Admin\AbstractItemController; -use Windwalker\Model\Exception\ValidateFailException; - /** * Save2new Controller * @@ -18,6 +15,16 @@ */ class Save2newController extends SaveController { + /** + * Method to run this controller. + * + * @return mixed + */ + protected function doExecute() + { + return $this->fetch($this->prefix, $this->name . '.edit.save'); + } + /** * Set redirect URL for action success. * diff --git a/windwalker/src/Controller/State/ReorderController.php b/windwalker/src/Controller/State/ReorderController.php index 7314cef..2d6577b 100644 --- a/windwalker/src/Controller/State/ReorderController.php +++ b/windwalker/src/Controller/State/ReorderController.php @@ -131,7 +131,7 @@ public function doUpdate() * * @return void */ - public function redirect($url, $message = null, $type = Message::MESSAGE_GREEN) + public function redirect($url = null, $message = null, $type = Message::MESSAGE_GREEN) { if (!$message && $redirect = $this->getRedirect(true)) { diff --git a/windwalker/src/Elfinder/View/DisplayView.php b/windwalker/src/Elfinder/View/DisplayView.php index ebfb308..e953c1a 100644 --- a/windwalker/src/Elfinder/View/DisplayView.php +++ b/windwalker/src/Elfinder/View/DisplayView.php @@ -1,6 +1,6 @@ get('toolbar', $this->defaultToolbar); $toolbar = json_encode($toolbar); - $onlymimes = $config->get('onlymimes', $input->get('onlymimes', null)); + $onlymimes = $config->get('onlymimes', $input->getString('onlymimes', null)); if ($onlymimes) { diff --git a/windwalker/src/Form/Fields/finder.php b/windwalker/src/Form/Fields/finder.php index 7b30d30..172e9b3 100644 --- a/windwalker/src/Form/Fields/finder.php +++ b/windwalker/src/Form/Fields/finder.php @@ -151,7 +151,9 @@ public function getPreview() if ($showPreview) { - if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) + $value = urldecode($this->value); + + if ($value && (is_file(JPATH_ROOT . '/' . $value) || is_file(JPATH_ROOT . '/' . $this->value))) { $src = JURI::root() . $this->value; } diff --git a/windwalker/src/Form/Forms/quickadd/category.xml b/windwalker/src/Form/Forms/quickadd/category.xml index 66434f1..49971a3 100644 --- a/windwalker/src/Form/Forms/quickadd/category.xml +++ b/windwalker/src/Form/Forms/quickadd/category.xml @@ -3,16 +3,16 @@
+ > + /> + /> + /> + + + > diff --git a/windwalker/src/Helper/CurlHelper.php b/windwalker/src/Helper/CurlHelper.php index 4e9a5ba..58009b9 100644 --- a/windwalker/src/Helper/CurlHelper.php +++ b/windwalker/src/Helper/CurlHelper.php @@ -113,7 +113,7 @@ public static function download($url, $path = null, $option = array()) \JFolder::create($folder_path); } - $fp = fopen($file_path, 'w+'); + $fp = fopen($file_path, 'wb+'); $ch = curl_init(); $options = array( diff --git a/windwalker/src/Helper/ModalHelper.php b/windwalker/src/Helper/ModalHelper.php index 28b79a4..7eb35f7 100644 --- a/windwalker/src/Helper/ModalHelper.php +++ b/windwalker/src/Helper/ModalHelper.php @@ -102,17 +102,21 @@ public static function renderModal($selector = 'modal', $content = '', $option = } // Box - $html = << {$header} {$footer} -MODAL; +HTML; return $html; } diff --git a/windwalker/src/Image/Thumb.php b/windwalker/src/Image/Thumb.php index 5bf6516..769d322 100644 --- a/windwalker/src/Image/Thumb.php +++ b/windwalker/src/Image/Thumb.php @@ -96,10 +96,14 @@ public function resize($url = null, $width = 100, $height = 100, $method = \JIma { $img = new \JImage; - if (\JFile::exists($path)) + if (is_file($path)) { $img->loadFile($path); } + elseif (is_file(urldecode($path))) + { + $img->loadFile(urldecode($path)); + } else { return $this->getDefaultImage($width, $height, $method, $q, $file_type); @@ -206,7 +210,12 @@ public function getImagePath($url, $hash = null) if (!is_file($path)) { - CurlHelper::download((string) $url, $path); + $options = array( + CURLOPT_CONNECTTIMEOUT => $this->config->get('timeout', 10), + CURLOPT_TIMEOUT => $this->config->get('timeout', 10), + ); + + CurlHelper::download((string) $url, $path, $options); } } diff --git a/windwalker/src/Model/CrudModel.php b/windwalker/src/Model/CrudModel.php index 9e6399c..1e46783 100644 --- a/windwalker/src/Model/CrudModel.php +++ b/windwalker/src/Model/CrudModel.php @@ -125,7 +125,7 @@ public function save($data) } $key = $table->getKeyName(); - $pk = ArrayHelper::getValue($data, $key, $this->getState($this->getName() . '.id')); + $pk = ArrayHelper::getValue($data, $key, $this->get($this->getName() . '.id')); $isNew = true; diff --git a/windwalker/src/Model/ListModel.php b/windwalker/src/Model/ListModel.php index d30a5bc..ddc7523 100644 --- a/windwalker/src/Model/ListModel.php +++ b/windwalker/src/Model/ListModel.php @@ -997,7 +997,7 @@ public function getUserStateFromRequest($key, $request, $default = null, $type = } // Now compare them, and set start to 0 if there has any differences. - if ($newState && ($currentState != $newState) && ($resetPage)) + if ($request !== 'limitstart' && $newState && ($currentState != $newState) && ($resetPage)) { $input->set('limitstart', 0); } diff --git a/windwalker/src/Table/Table.php b/windwalker/src/Table/Table.php index e0f4719..300fd99 100644 --- a/windwalker/src/Table/Table.php +++ b/windwalker/src/Table/Table.php @@ -8,7 +8,6 @@ namespace Windwalker\Table; -use JTable; use Windwalker\DI\Container; use Windwalker\Relation\Observer\RelationObserver; use Windwalker\Relation\Relation; @@ -166,14 +165,37 @@ public function __get($name) /** * Get the columns from database table. * + * @param bool $reload flag to reload cache + * * @return mixed An array of the field names, or false if an error occurs. * * @since 11.1 * @throws \UnexpectedValueException */ - public function getFields() + public function getFields($reload = false) { - return TableHelper::getFields($this); + if (version_compare(JVERSION, '3.7', '<')) + { + return TableHelper::getFields($this); + } + + static $cache = null; + + if ($cache === null || $reload) + { + // Lookup the fields for this table only once. + $name = $this->_tbl; + $fields = $this->_db->getTableColumns($name, false); + + if (empty($fields)) + { + throw new \UnexpectedValueException(sprintf('No columns found for %s table', $name)); + } + + $cache = $fields; + } + + return $cache; } /** diff --git a/windwalker/vendor/autoload.php b/windwalker/vendor/autoload.php index 3f19ec9..4862bf2 100644 --- a/windwalker/vendor/autoload.php +++ b/windwalker/vendor/autoload.php @@ -2,6 +2,6 @@ // autoload.php @generated by Composer -require_once __DIR__ . '/composer' . '/autoload_real.php'; +require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit6114c587bed3d40fef82253b91842863::getLoader(); diff --git a/windwalker/vendor/composer/ClassLoader.php b/windwalker/vendor/composer/ClassLoader.php index ff6ecfb..2c72175 100644 --- a/windwalker/vendor/composer/ClassLoader.php +++ b/windwalker/vendor/composer/ClassLoader.php @@ -53,8 +53,9 @@ class ClassLoader private $useIncludePath = false; private $classMap = array(); - private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; public function getPrefixes() { @@ -271,6 +272,26 @@ public function isClassMapAuthoritative() return $this->classMapAuthoritative; } + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + /** * Registers this instance as an autoloader. * @@ -313,29 +334,34 @@ public function loadClass($class) */ public function findFile($class) { - // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 - if ('\\' == $class[0]) { - $class = substr($class, 1); - } - // class map lookup if (isset($this->classMap[$class])) { return $this->classMap[$class]; } - if ($this->classMapAuthoritative) { + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { return false; } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } $file = $this->findFileWithExtension($class, '.php'); // Search for Hack files if we are running on HHVM - if ($file === null && defined('HHVM_VERSION')) { + if (false === $file && defined('HHVM_VERSION')) { $file = $this->findFileWithExtension($class, '.hh'); } - if ($file === null) { + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { // Remember that this class does not exist. - return $this->classMap[$class] = false; + $this->missingClasses[$class] = true; } return $file; @@ -348,9 +374,13 @@ private function findFileWithExtension($class, $ext) $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + foreach ($this->prefixDirsPsr4[$search] as $dir) { + $length = $this->prefixLengthsPsr4[$first][$search]; if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } @@ -399,6 +429,8 @@ private function findFileWithExtension($class, $ext) if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { return $file; } + + return false; } } diff --git a/windwalker/vendor/composer/LICENSE b/windwalker/vendor/composer/LICENSE index 1a28124..f27399a 100644 --- a/windwalker/vendor/composer/LICENSE +++ b/windwalker/vendor/composer/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) 2016 Nils Adermann, Jordi Boggiano +Copyright (c) Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/windwalker/vendor/composer/autoload_psr4.php b/windwalker/vendor/composer/autoload_psr4.php index 46e96f8..418a26c 100644 --- a/windwalker/vendor/composer/autoload_psr4.php +++ b/windwalker/vendor/composer/autoload_psr4.php @@ -24,5 +24,6 @@ 'Windwalker\\' => array($baseDir . '/src'), 'Whoops\\' => array($vendorDir . '/filp/whoops/src/Whoops'), 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), + 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), '' => array($baseDir . '/../../cli/windwalker'), ); diff --git a/windwalker/vendor/composer/autoload_real.php b/windwalker/vendor/composer/autoload_real.php index 0ba1971..6ca25a0 100644 --- a/windwalker/vendor/composer/autoload_real.php +++ b/windwalker/vendor/composer/autoload_real.php @@ -23,7 +23,7 @@ public static function getLoader() self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit6114c587bed3d40fef82253b91842863', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); + $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; diff --git a/windwalker/vendor/composer/autoload_static.php b/windwalker/vendor/composer/autoload_static.php index 208c630..bec9135 100644 --- a/windwalker/vendor/composer/autoload_static.php +++ b/windwalker/vendor/composer/autoload_static.php @@ -35,6 +35,10 @@ class ComposerStaticInit6114c587bed3d40fef82253b91842863 array ( 'Symfony\\Component\\Yaml\\' => 23, ), + 'P' => + array ( + 'Psr\\Log\\' => 8, + ), ); public static $prefixDirsPsr4 = array ( @@ -111,6 +115,10 @@ class ComposerStaticInit6114c587bed3d40fef82253b91842863 array ( 0 => __DIR__ . '/..' . '/symfony/yaml', ), + 'Psr\\Log\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', + ), ); public static $fallbackDirsPsr4 = array ( diff --git a/windwalker/vendor/composer/installed.json b/windwalker/vendor/composer/installed.json index f3d30da..184f659 100644 --- a/windwalker/vendor/composer/installed.json +++ b/windwalker/vendor/composer/installed.json @@ -24,7 +24,7 @@ "suggest": { "windwalker/utilities": "Install 2.* if you want to use StringHelper::parseVariable() tmpl engine." }, - "time": "2016-03-23 15:03:50", + "time": "2016-03-23T15:03:50+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -71,7 +71,7 @@ "require-dev": { "windwalker/test": "~2.0" }, - "time": "2016-02-12 15:36:22", + "time": "2016-02-12T15:36:22+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -124,7 +124,7 @@ "suggest": { "symfony/yaml": "Install 2.* if you require YAML support." }, - "time": "2016-03-07 10:02:08", + "time": "2016-03-07T10:02:08+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -147,7 +147,8 @@ "framework", "registry", "windwalker" - ] + ], + "abandoned": "windwalker/structure" }, { "name": "windwalker/filesystem", @@ -170,7 +171,7 @@ "require-dev": { "windwalker/test": "~2.0" }, - "time": "2016-03-23 15:01:32", + "time": "2016-03-23T15:01:32+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -219,7 +220,7 @@ "windwalker/console": "~2.0", "windwalker/database": "~2.0" }, - "time": "2016-03-23 12:47:07", + "time": "2016-03-23T12:47:07+00:00", "type": "framework", "installation-source": "dist", "autoload": { @@ -248,119 +249,6 @@ "scaffolding" ] }, - { - "name": "filp/whoops", - "version": "2.1.2", - "version_normalized": "2.1.2.0", - "source": { - "type": "git", - "url": "https://github.com/filp/whoops.git", - "reference": "d13505b240a6f580bc75ba591da30299d6cb0eec" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/d13505b240a6f580bc75ba591da30299d6cb0eec", - "reference": "d13505b240a6f580bc75ba591da30299d6cb0eec", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "mockery/mockery": "0.9.*", - "phpunit/phpunit": "^4.8 || ^5.0", - "symfony/var-dumper": "~3.0" - }, - "suggest": { - "symfony/var-dumper": "Pretty print complex values better with var-dumper available", - "whoops/soap": "Formats errors as SOAP responses" - }, - "time": "2016-04-07 06:16:25", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Whoops\\": "src/Whoops/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Filipe Dobreira", - "homepage": "https://github.com/filp", - "role": "Developer" - } - ], - "description": "php error handling for cool kids", - "homepage": "https://github.com/filp/whoops", - "keywords": [ - "error", - "exception", - "handling", - "library", - "whoops", - "zf2" - ] - }, - { - "name": "symfony/yaml", - "version": "v2.8.6", - "version_normalized": "2.8.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "e4fbcc65f90909c999ac3b4dfa699ee6563a9940" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e4fbcc65f90909c999ac3b4dfa699ee6563a9940", - "reference": "e4fbcc65f90909c999ac3b4dfa699ee6563a9940", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "time": "2016-03-29 19:00:15", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com" - }, { "name": "windwalker/cache", "version": "2.1.9", @@ -382,7 +270,7 @@ "require-dev": { "windwalker/test": "~2.0" }, - "time": "2016-02-12 15:36:22", + "time": "2016-02-12T15:36:22+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -428,7 +316,7 @@ "require-dev": { "windwalker/test": "~2.0" }, - "time": "2016-02-12 15:36:22", + "time": "2016-02-12T15:36:22+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -478,7 +366,7 @@ "suggest": { "windwalker/filter": "Install 2.* if you require filter support." }, - "time": "2016-03-08 11:38:11", + "time": "2016-03-08T11:38:11+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -526,7 +414,7 @@ "require-dev": { "windwalker/test": "~2.0" }, - "time": "2016-04-02 04:13:51", + "time": "2016-04-02T04:13:51+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -572,7 +460,7 @@ "require-dev": { "windwalker/test": "~2.0" }, - "time": "2016-02-12 15:36:22", + "time": "2016-02-12T15:36:22+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -627,7 +515,7 @@ "windwalker/database": "Install 2.* if you want Windwalker Database.", "windwalker/event": "Install 2.* if you want to use hooks." }, - "time": "2016-03-21 06:58:16", + "time": "2016-03-21T06:58:16+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -673,7 +561,7 @@ "require-dev": { "windwalker/test": "~2.0" }, - "time": "2016-02-12 15:36:22", + "time": "2016-02-12T15:36:22+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -720,7 +608,7 @@ "require-dev": { "windwalker/test": "~2.0" }, - "time": "2016-02-12 15:36:22", + "time": "2016-02-12T15:36:22+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -767,7 +655,7 @@ "windwalker/test": "~2.0", "windwalker/uri": "~2.0" }, - "time": "2016-03-21 07:58:51", + "time": "2016-03-21T07:58:51+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -813,7 +701,7 @@ "require-dev": { "windwalker/test": "~2.0" }, - "time": "2016-02-12 15:36:22", + "time": "2016-02-12T15:36:22+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -857,7 +745,7 @@ "php": ">=5.3.10", "windwalker/environment": "~2.0" }, - "time": "2016-02-12 15:36:22", + "time": "2016-02-12T15:36:22+00:00", "type": "windwalker-package", "extra": { "branch-alias": { @@ -881,5 +769,168 @@ "test", "windwalker" ] + }, + { + "name": "symfony/yaml", + "version": "v2.8.20", + "version_normalized": "2.8.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/93ccdde79f4b079c7558da4656a3cb1c50c68e02", + "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "time": "2017-05-01T14:31:55+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com" + }, + { + "name": "psr/log", + "version": "1.0.2", + "version_normalized": "1.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-10-10T12:19:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ] + }, + { + "name": "filp/whoops", + "version": "2.1.8", + "version_normalized": "2.1.8.0", + "source": { + "type": "git", + "url": "https://github.com/filp/whoops.git", + "reference": "f2950be7da8b8d6c4e77821b6c9d486e36cdc4f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filp/whoops/zipball/f2950be7da8b8d6c4e77821b6c9d486e36cdc4f3", + "reference": "f2950be7da8b8d6c4e77821b6c9d486e36cdc4f3", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0", + "psr/log": "^1.0.1" + }, + "require-dev": { + "mockery/mockery": "0.9.*", + "phpunit/phpunit": "^4.8 || ^5.0", + "symfony/var-dumper": "^2.6 || ^3.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "time": "2017-03-07T09:04:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "description": "php error handling for cool kids", + "homepage": "https://filp.github.io/whoops/", + "keywords": [ + "error", + "exception", + "handling", + "library", + "whoops", + "zf2" + ] } ] diff --git a/windwalker/vendor/filp/whoops/composer.json b/windwalker/vendor/filp/whoops/composer.json index 85d6fc2..0b07c9a 100644 --- a/windwalker/vendor/filp/whoops/composer.json +++ b/windwalker/vendor/filp/whoops/composer.json @@ -3,7 +3,7 @@ "license": "MIT", "description": "php error handling for cool kids", "keywords": ["library", "error", "handling", "exception", "whoops", "zf2"], - "homepage": "https://github.com/filp/whoops", + "homepage": "https://filp.github.io/whoops/", "authors": [ { "name": "Filipe Dobreira", @@ -12,12 +12,13 @@ } ], "require": { - "php": ">=5.5.9" + "php": "^5.5.9 || ^7.0", + "psr/log": "^1.0.1" }, "require-dev": { "phpunit/phpunit": "^4.8 || ^5.0", "mockery/mockery": "0.9.*", - "symfony/var-dumper": "~3.0" + "symfony/var-dumper": "^2.6 || ^3.0" }, "suggest": { "symfony/var-dumper": "Pretty print complex values better with var-dumper available", @@ -28,6 +29,11 @@ "Whoops\\": "src/Whoops/" } }, + "autoload-dev": { + "psr-4": { + "Whoops\\": "tests/Whoops/" + } + }, "extra": { "branch-alias": { "dev-master": "2.0-dev" diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Exception/Formatter.php b/windwalker/vendor/filp/whoops/src/Whoops/Exception/Formatter.php index f14b8e2..343fbc6 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Exception/Formatter.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Exception/Formatter.php @@ -19,26 +19,26 @@ class Formatter public static function formatExceptionAsDataArray(Inspector $inspector, $shouldAddTrace) { $exception = $inspector->getException(); - $response = array( + $response = [ 'type' => get_class($exception), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), - ); + ]; if ($shouldAddTrace) { $frames = $inspector->getFrames(); - $frameData = array(); + $frameData = []; foreach ($frames as $frame) { /** @var Frame $frame */ - $frameData[] = array( + $frameData[] = [ 'file' => $frame->getFile(), 'line' => $frame->getLine(), 'function' => $frame->getFunction(), 'class' => $frame->getClass(), 'args' => $frame->getArgs(), - ); + ]; } $response['trace'] = $frameData; diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Exception/Frame.php b/windwalker/vendor/filp/whoops/src/Whoops/Exception/Frame.php index 5aecd37..ca8f262 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Exception/Frame.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Exception/Frame.php @@ -24,7 +24,12 @@ class Frame implements Serializable /** * @var array[] */ - protected $comments = array(); + protected $comments = []; + + /** + * @var bool + */ + protected $application; /** * @param array[] @@ -58,7 +63,9 @@ public function getFile($shortened = false) if ($shortened && is_string($file)) { // Replace the part of the path that all frames have in common, and add 'soft hyphens' for smoother line-breaks. $dirname = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))); - $file = str_replace($dirname, "…", $file); + if ($dirname !== '/') { + $file = str_replace($dirname, "…", $file); + } $file = str_replace("/", "/­", $file); } @@ -94,7 +101,7 @@ public function getFunction() */ public function getArgs() { - return isset($this->frame['args']) ? (array) $this->frame['args'] : array(); + return isset($this->frame['args']) ? (array) $this->frame['args'] : []; } /** @@ -136,10 +143,10 @@ public function getFileContents() */ public function addComment($comment, $context = 'global') { - $this->comments[] = array( + $this->comments[] = [ 'comment' => $comment, 'context' => $context, - ); + ]; } /** @@ -266,4 +273,24 @@ public function equals(Frame $frame) } return $frame->getFile() === $this->getFile() && $frame->getLine() === $this->getLine(); } + + /** + * Returns whether this frame belongs to the application or not. + * + * @return boolean + */ + public function isApplication() + { + return $this->application; + } + + /** + * Mark as an frame belonging to the application. + * + * @param boolean $application + */ + public function setApplication($application) + { + $this->application = $application; + } } diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php b/windwalker/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php index 47fffb6..3da618b 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php @@ -139,6 +139,18 @@ public function count() return count($this->frames); } + /** + * Count the frames that belongs to the application. + * + * @return int + */ + public function countIsApplication() + { + return count(array_filter($this->frames, function(Frame $f) { + return $f->isApplication(); + })); + } + /** * @see Serializable::serialize * @return string diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Exception/Inspector.php b/windwalker/vendor/filp/whoops/src/Whoops/Exception/Inspector.php index 218bec2..43ff754 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Exception/Inspector.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Exception/Inspector.php @@ -102,7 +102,7 @@ public function getFrames() $file = '[internal]'; $line = 0; - $next_frame = !empty($frames[$k + 1]) ? $frames[$k + 1] : array(); + $next_frame = !empty($frames[$k + 1]) ? $frames[$k + 1] : []; if ($this->isValidNextFrame($next_frame)) { $file = $next_frame['file']; @@ -153,7 +153,7 @@ public function getFrames() } /** - * Gets the backgrace from an exception. + * Gets the backtrace from an exception. * * If xdebug is installed * @@ -174,7 +174,7 @@ protected function getTrace($e) } if (!extension_loaded('xdebug') || !xdebug_is_enabled()) { - return array(); + return []; } // Use xdebug to get the full stack trace and remove the shutdown handler stack trace @@ -193,14 +193,14 @@ protected function getTrace($e) */ protected function getFrameFromException($exception) { - return array( + return [ 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'class' => get_class($exception), - 'args' => array( + 'args' => [ $exception->getMessage(), - ), - ); + ], + ]; } /** @@ -211,12 +211,12 @@ protected function getFrameFromException($exception) */ protected function getFrameFromError(ErrorException $exception) { - return array( + return [ 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'class' => null, - 'args' => array(), - ); + 'args' => [], + ]; } /** diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Handler/Handler.php b/windwalker/vendor/filp/whoops/src/Whoops/Handler/Handler.php index b4ae4f9..78bad01 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Handler/Handler.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Handler/Handler.php @@ -7,7 +7,7 @@ namespace Whoops\Handler; use Whoops\Exception\Inspector; -use Whoops\Run; +use Whoops\RunInterface; /** * Abstract implementation of a Handler. @@ -24,7 +24,7 @@ abstract class Handler implements HandlerInterface const QUIT = 0x30; /** - * @var Run + * @var RunInterface */ private $run; @@ -39,15 +39,15 @@ abstract class Handler implements HandlerInterface private $exception; /** - * @param Run $run + * @param RunInterface $run */ - public function setRun(Run $run) + public function setRun(RunInterface $run) { $this->run = $run; } /** - * @return Run + * @return RunInterface */ protected function getRun() { diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php b/windwalker/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php index 4f8a555..0265a85 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php @@ -7,7 +7,7 @@ namespace Whoops\Handler; use Whoops\Exception\Inspector; -use Whoops\Run; +use Whoops\RunInterface; interface HandlerInterface { @@ -17,10 +17,10 @@ interface HandlerInterface public function handle(); /** - * @param Run $run + * @param RunInterface $run * @return void */ - public function setRun(Run $run); + public function setRun(RunInterface $run); /** * @param \Throwable $exception diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php b/windwalker/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php index 7da3112..f3559a7 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php @@ -20,6 +20,22 @@ class JsonResponseHandler extends Handler */ private $returnFrames = false; + /** + * @var bool + */ + private $jsonApi = false; + + /** + * Returns errors[[]] instead of error[] to be in compliance with the json:api spec + * @param bool $jsonApi Default is false + * @return $this + */ + public function setJsonApi($jsonApi = false) + { + $this->jsonApi = (bool) $jsonApi; + return $this; + } + /** * @param bool|null $returnFrames * @return bool|$this @@ -39,19 +55,34 @@ public function addTraceToOutput($returnFrames = null) */ public function handle() { - $response = array( + if ($this->jsonApi === true) { + $response = [ + 'errors' => [ + Formatter::formatExceptionAsDataArray( + $this->getInspector(), + $this->addTraceToOutput() + ), + ] + ]; + } else { + $response = [ 'error' => Formatter::formatExceptionAsDataArray( $this->getInspector(), $this->addTraceToOutput() ), - ); - - if (\Whoops\Util\Misc::canSendHeaders()) { - header('Content-Type: application/json'); - } + ]; + } echo json_encode($response, defined('JSON_PARTIAL_OUTPUT_ON_ERROR') ? JSON_PARTIAL_OUTPUT_ON_ERROR : 0); return Handler::QUIT; } + + /** + * @return string + */ + public function contentType() + { + return 'application/json'; + } } diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php b/windwalker/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php index 896e6ab..334c679 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php @@ -128,6 +128,22 @@ public function setTraceFunctionArgsOutputLimit($traceFunctionArgsOutputLimit) $this->traceFunctionArgsOutputLimit = (integer) $traceFunctionArgsOutputLimit; } + /** + * Create plain text response and return it as a string + * @return string + */ + public function generateResponse() + { + $exception = $this->getException(); + return sprintf("%s: %s in file %s on line %d%s\n", + get_class($exception), + $exception->getMessage(), + $exception->getFile(), + $exception->getLine(), + $this->getTraceOutput() + ); + } + /** * Get the size limit in bytes of frame arguments var_dump output. * If the limit is reached, the var_dump output is discarded. @@ -240,15 +256,7 @@ private function getTraceOutput() */ public function handle() { - $exception = $this->getException(); - - $response = sprintf("%s: %s in file %s on line %d%s\n", - get_class($exception), - $exception->getMessage(), - $exception->getFile(), - $exception->getLine(), - $this->getTraceOutput() - ); + $response = $this->generateResponse(); if ($this->getLogger()) { $this->getLogger()->error($response); @@ -258,12 +266,16 @@ public function handle() return Handler::DONE; } - if (\Whoops\Util\Misc::canSendHeaders()) { - header('Content-Type: text/plain'); - } - echo $response; return Handler::QUIT; } + + /** + * @return string + */ + public function contentType() + { + return 'text/plain'; + } } diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php b/windwalker/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php index d8b8b57..55f511c 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php @@ -23,14 +23,14 @@ class PrettyPageHandler extends Handler * * @var array */ - private $searchPaths = array(); + private $searchPaths = []; /** * Fast lookup cache for known resource locations. * * @var array */ - private $resourceCache = array(); + private $resourceCache = []; /** * The name of the custom css file. @@ -42,7 +42,7 @@ class PrettyPageHandler extends Handler /** * @var array[] */ - private $extraTables = array(); + private $extraTables = []; /** * @var bool @@ -54,6 +54,24 @@ class PrettyPageHandler extends Handler */ private $pageTitle = "Whoops! There was an error."; + /** + * @var array[] + */ + private $applicationPaths; + + /** + * @var array[] + */ + private $blacklist = [ + '_GET' => [], + '_POST' => [], + '_FILES' => [], + '_COOKIE' => [], + '_SESSION' => [], + '_SERVER' => [], + '_ENV' => [], + ]; + /** * A string identifier for a known IDE/text editor, or a closure * that resolves a string that can be used to open a given file @@ -70,13 +88,19 @@ class PrettyPageHandler extends Handler * A list of known editor strings * @var array */ - protected $editors = array( + protected $editors = [ "sublime" => "subl://open?url=file://%file&line=%line", "textmate" => "txmt://open?url=file://%file&line=%line", "emacs" => "emacs://open?url=file://%file&line=%line", "macvim" => "mvim://open/?url=file://%file&line=%line", "phpstorm" => "phpstorm://open?file=%file&line=%line", - ); + "idea" => "idea://open?file=%file&line=%line", + ]; + + /** + * @var TemplateHelper + */ + private $templateHelper; /** * Constructor. @@ -86,12 +110,36 @@ public function __construct() if (ini_get('xdebug.file_link_format') || extension_loaded('xdebug')) { // Register editor using xdebug's file_link_format option. $this->editors['xdebug'] = function ($file, $line) { - return str_replace(array('%f', '%l'), array($file, $line), ini_get('xdebug.file_link_format')); + return str_replace(['%f', '%l'], [$file, $line], ini_get('xdebug.file_link_format')); }; } // Add the default, local resource search path: $this->searchPaths[] = __DIR__ . "/../Resources"; + + // blacklist php provided auth based values + $this->blacklist('_SERVER', 'PHP_AUTH_PW'); + + $this->templateHelper = new TemplateHelper(); + + if (class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) { + $cloner = new VarCloner(); + // Only dump object internals if a custom caster exists. + $cloner->addCasters(['*' => function ($obj, $a, $stub, $isNested, $filter = 0) { + $class = $stub->class; + $classes = [$class => $class] + class_parents($class) + class_implements($class); + + foreach ($classes as $class) { + if (isset(AbstractCloner::$defaultCasters[$class])) { + return $a; + } + } + + // Remove all internals + return []; + }]); + $this->templateHelper->setCloner($cloner); + } } /** @@ -116,28 +164,6 @@ public function handle() } } - // @todo: Make this more dynamic - $helper = new TemplateHelper(); - - if (class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) { - $cloner = new VarCloner(); - // Only dump object internals if a custom caster exists. - $cloner->addCasters(['*' => function ($obj, $a, $stub, $isNested, $filter = 0) { - $class = $stub->class; - $classes = [$class => $class] + class_parents($class) + class_implements($class); - - foreach ($classes as $class) { - if (isset(AbstractCloner::$defaultCasters[$class])) { - return $a; - } - } - - // Remove all internals - return []; - }]); - $helper->setCloner($cloner); - } - $templateFile = $this->getResource("views/layout.html.php"); $cssFile = $this->getResource("css/whoops.base.css"); $zeptoFile = $this->getResource("js/zepto.min.js"); @@ -158,8 +184,21 @@ public function handle() $code = Misc::translateErrorCode($inspector->getException()->getSeverity()); } + // Detect frames that belong to the application. + if ($this->applicationPaths) { + /* @var \Whoops\Exception\Frame $frame */ + foreach ($frames as $frame) { + foreach ($this->applicationPaths as $path) { + if (substr($frame->getFile(), 0, strlen($path)) === $path) { + $frame->setApplication(true); + break; + } + } + } + } + // List of variables that will be passed to the layout template. - $vars = array( + $vars = [ "page_title" => $this->getPageTitle(), // @todo: Asset compiler @@ -169,10 +208,17 @@ public function handle() "javascript" => file_get_contents($jsFile), // Template paths: - "header" => $this->getResource("views/header.html.php"), - "frame_list" => $this->getResource("views/frame_list.html.php"), - "frame_code" => $this->getResource("views/frame_code.html.php"), - "env_details" => $this->getResource("views/env_details.html.php"), + "header" => $this->getResource("views/header.html.php"), + "header_outer" => $this->getResource("views/header_outer.html.php"), + "frame_list" => $this->getResource("views/frame_list.html.php"), + "frames_description" => $this->getResource("views/frames_description.html.php"), + "frames_container" => $this->getResource("views/frames_container.html.php"), + "panel_details" => $this->getResource("views/panel_details.html.php"), + "panel_details_outer" => $this->getResource("views/panel_details_outer.html.php"), + "panel_left" => $this->getResource("views/panel_left.html.php"), + "panel_left_outer" => $this->getResource("views/panel_left_outer.html.php"), + "frame_code" => $this->getResource("views/frame_code.html.php"), + "env_details" => $this->getResource("views/env_details.html.php"), "title" => $this->getPageTitle(), "name" => explode("\\", $inspector->getExceptionName()), @@ -184,16 +230,19 @@ public function handle() "handler" => $this, "handlers" => $this->getRun()->getHandlers(), - "tables" => array( - "GET Data" => $_GET, - "POST Data" => $_POST, - "Files" => $_FILES, - "Cookies" => $_COOKIE, - "Session" => isset($_SESSION) ? $_SESSION : array(), - "Server/Request Data" => $_SERVER, - "Environment Variables" => $_ENV, - ), - ); + "active_frames_tab" => count($frames) && $frames->offsetGet(0)->isApplication() ? 'application' : 'all', + "has_frames_tabs" => $this->getApplicationPaths(), + + "tables" => [ + "GET Data" => $this->masked($_GET, '_GET'), + "POST Data" => $this->masked($_POST, '_POST'), + "Files" => isset($_FILES) ? $this->masked($_FILES, '_FILES') : [], + "Cookies" => $this->masked($_COOKIE, '_COOKIE'), + "Session" => isset($_SESSION) ? $this->masked($_SESSION, '_SESSION') : [], + "Server/Request Data" => $this->masked($_SERVER, '_SERVER'), + "Environment Variables" => $this->masked($_ENV, '_ENV'), + ], + ]; if (isset($customCssFile)) { $vars["stylesheet"] .= file_get_contents($customCssFile); @@ -201,21 +250,30 @@ public function handle() // Add extra entries list of data tables: // @todo: Consolidate addDataTable and addDataTableCallback - $extraTables = array_map(function ($table) { - return $table instanceof \Closure ? $table() : $table; + $extraTables = array_map(function ($table) use ($inspector) { + return $table instanceof \Closure ? $table($inspector) : $table; }, $this->getDataTables()); $vars["tables"] = array_merge($extraTables, $vars["tables"]); - if (\Whoops\Util\Misc::canSendHeaders()) { - header('Content-Type: text/html'); - } + $plainTextHandler = new PlainTextHandler(); + $plainTextHandler->setException($this->getException()); + $plainTextHandler->setInspector($this->getInspector()); + $vars["preface"] = ""; - $helper->setVariables($vars); - $helper->render($templateFile); + $this->templateHelper->setVariables($vars); + $this->templateHelper->render($templateFile); return Handler::QUIT; } + /** + * @return string + */ + public function contentType() + { + return 'text/html'; + } + /** * Adds an entry to the list of tables displayed in the template. * The expected data is a simple associative array. Any nested arrays @@ -244,15 +302,15 @@ public function addDataTableCallback($label, /* callable */ $callback) throw new InvalidArgumentException('Expecting callback argument to be callable'); } - $this->extraTables[$label] = function () use ($callback) { + $this->extraTables[$label] = function (\Whoops\Exception\Inspector $inspector = null) use ($callback) { try { - $result = call_user_func($callback); + $result = call_user_func($callback, $inspector); // Only return the result if it can be iterated over by foreach(). - return is_array($result) || $result instanceof \Traversable ? $result : array(); + return is_array($result) || $result instanceof \Traversable ? $result : []; } catch (\Exception $e) { // Don't allow failure to break the rendering of the original exception. - return array(); + return []; } }; } @@ -268,7 +326,7 @@ public function getDataTables($label = null) { if ($label !== null) { return isset($this->extraTables[$label]) ? - $this->extraTables[$label] : array(); + $this->extraTables[$label] : []; } return $this->extraTables; @@ -352,7 +410,7 @@ public function getEditorHref($filePath, $line) { $editor = $this->getEditor($filePath, $line); - if (!$editor) { + if (empty($editor)) { return false; } @@ -398,42 +456,44 @@ public function getEditorAjax($filePath, $line) * act as an Ajax request. The editor must be a * valid callable function/closure * - * @throws UnexpectedValueException If editor resolver does not return a boolean - * @param string $filePath - * @param int $line - * @return mixed + * @param string $filePath + * @param int $line + * @return array */ protected function getEditor($filePath, $line) { - if ($this->editor === null && !is_string($this->editor) && !is_callable($this->editor)) - { - return false; + if (!$this->editor || (!is_string($this->editor) && !is_callable($this->editor))) { + return []; } - else if(is_string($this->editor) && isset($this->editors[$this->editor]) && !is_callable($this->editors[$this->editor])) - { - return array( + + if (is_string($this->editor) && isset($this->editors[$this->editor]) && !is_callable($this->editors[$this->editor])) { + return [ 'ajax' => false, 'url' => $this->editors[$this->editor], - ); + ]; } - else if(is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) - { - if(is_callable($this->editor)) - { + + if (is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) { + if (is_callable($this->editor)) { $callback = call_user_func($this->editor, $filePath, $line); - } - else - { + } else { $callback = call_user_func($this->editors[$this->editor], $filePath, $line); } - return array( + if (is_string($callback)) { + return [ + 'ajax' => false, + 'url' => $callback, + ]; + } + + return [ 'ajax' => isset($callback['ajax']) ? $callback['ajax'] : false, - 'url' => (is_array($callback) ? $callback['url'] : $callback), - ); + 'url' => isset($callback['url']) ? $callback['url'] : $callback, + ]; } - return false; + return []; } /** @@ -457,7 +517,7 @@ public function getPageTitle() * Adds a path to the list of paths to be searched for * resources. * - * @throws InvalidArgumnetException If $path is not a valid directory + * @throws InvalidArgumentException If $path is not a valid directory * * @param string $path * @return void @@ -553,4 +613,66 @@ public function setResourcesPath($resourcesPath) { $this->addResourcePath($resourcesPath); } + + /** + * Return the application paths. + * + * @return array + */ + public function getApplicationPaths() + { + return $this->applicationPaths; + } + + /** + * Set the application paths. + * + * @param array $applicationPaths + */ + public function setApplicationPaths($applicationPaths) + { + $this->applicationPaths = $applicationPaths; + } + + /** + * Set the application root path. + * + * @param string $applicationRootPath + */ + public function setApplicationRootPath($applicationRootPath) + { + $this->templateHelper->setApplicationRootPath($applicationRootPath); + } + + /** + * blacklist a sensitive value within one of the superglobal arrays. + * + * @param $superGlobalName string the name of the superglobal array, e.g. '_GET' + * @param $key string the key within the superglobal + */ + public function blacklist($superGlobalName, $key) { + $this->blacklist[$superGlobalName][] = $key; + } + + /** + * Checks all values within the given superGlobal array. + * Blacklisted values will be replaced by a equal length string cointaining only '*' characters. + * + * We intentionally dont rely on $GLOBALS as it depends on 'auto_globals_jit' php.ini setting. + * + * @param $superGlobal array One of the superglobal arrays + * @param $superGlobalName string the name of the superglobal array, e.g. '_GET' + * @return array $values without sensitive data + */ + private function masked(array $superGlobal, $superGlobalName) { + $blacklisted = $this->blacklist[$superGlobalName]; + + $values = $superGlobal; + foreach($blacklisted as $key) { + if (isset($superGlobal[$key])) { + $values[$key] = str_repeat('*', strlen($superGlobal[$key])); + } + } + return $values; + } } diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php b/windwalker/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php index 61ee86c..f94497f 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php @@ -40,18 +40,26 @@ public function addTraceToOutput($returnFrames = null) */ public function handle() { - $response = array( + $response = [ 'error' => Formatter::formatExceptionAsDataArray( $this->getInspector(), $this->addTraceToOutput() ), - ); + ]; echo $this->toXml($response); return Handler::QUIT; } + /** + * @return string + */ + public function contentType() + { + return 'application/xml'; + } + /** * @param SimpleXMLElement $node Node to append data to, will be modified in place * @param array|Traversable $data diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css b/windwalker/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css index 7c11d52..545e7ab 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css @@ -1,4 +1,3 @@ -.cf:before, .cf:after {content: " ";display: table;} .cf:after {clear: both;} .cf {*zoom: 1;} body { font: 12px "Helvetica Neue", helvetica, arial, sans-serif; color: #131313; @@ -13,9 +12,10 @@ body { text-decoration: none; } -.container{ +.panel { + overflow-x: hidden; + overflow-y: scroll; height: 100%; - width: 100%; position: fixed; margin: 0; left: 0; @@ -41,9 +41,10 @@ header { padding: 35px 40px; max-height: 180px; overflow: hidden; + transition: 0.5s; } - header:hover { + header.header-expand { max-height: 1000px; } @@ -70,15 +71,8 @@ header { font-weight: 300; } -.stack-container { - height: 100%; - position: relative; -} - .details-container { - height: 100%; - overflow: auto; - float: right; + left: 30%; width: 70%; background: #fafafa; } @@ -115,9 +109,6 @@ header { } .left-panel { - height: 100%; - overflow: auto; - float: left; width: 30%; background: #ded8d8; } @@ -129,6 +120,27 @@ header { font-size: 11px; } + .frames-description.frames-description-application { + text-align: center; + font-size: 12px; + } + .frames-container.frames-container-application .frame:not(.frame-application) { + display: none; + } + + .frames-tab { + color: #a29d9d; + display: inline-block; + padding: 4px 8px; + margin: 0 2px; + border-radius: 3px; + } + + .frames-tab.frames-tab-active { + background-color: #2a2a2a; + color: #bebebe; + } + .frame { padding: 14px; cursor: pointer; @@ -156,6 +168,14 @@ header { font-size: 14px; } + .frame-index { + float: left; + } + + .frame-method-info { + margin-left: 24px; + } + .frame-index { font-size: 11px; color: #a29d9d; @@ -169,14 +189,18 @@ header { display: inline-block; } + .frame-application .frame-index { + background-color: #2a2a2a; + color: #bebebe; + } + .frame-file { font-family: "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace; - word-wrap: break-word; color: #a29d9d; } .frame-file .editor-link { - color: #272727; + color: #a29d9d; } .frame-line { @@ -205,12 +229,17 @@ header { } .code-block { + max-height: 345px; + overflow: hidden; padding: 10px; margin: 0; border-radius: 6px; box-shadow: 0 3px 0 rgba(0, 0, 0, .05), 0 10px 30px rgba(0, 0, 0, .05), inset 0 0 1px 0 rgba(255, 255, 255, .07); + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; } .linenums { @@ -257,6 +286,10 @@ header { color: white; } +.delimiter { + display: inline-block; +} + .data-table-container label { font-size: 16px; color: #303030; @@ -333,16 +366,16 @@ pre .xsl, code .xsl { color: #d0a0d0; } /* xslt tag */ pre .atn, code .atn { color: #ef7c61; font-weight: normal;} /* html/xml attribute name */ pre .atv, code .atv { color: #bcd42a; } /* html/xml attribute value */ pre .dec, code .dec { color: #606; } /* decimal */ -pre.prettyprint, code.prettyprint, .frame-args.prettyprint, .frame-args.prettyprint samp { +pre.code-block, code.code-block, .frame-args.code-block, .frame-args.code-block samp { font-family: "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace; background: #333; color: #e9e4e5; } - pre.prettyprint { + pre.code-block { white-space: pre-wrap; } - pre.prettyprint a, code.prettyprint a { + pre.code-block a, code.code-block a { text-decoration:none; } @@ -411,10 +444,10 @@ kbd { @media (min-width: 1000px) { .details, .frame-code { padding: 20px 40px; - margin-bottom: 60px; } .details-container { + left: 32%; width: 68%; } diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/js/whoops.base.js b/windwalker/vendor/filp/whoops/src/Whoops/Resources/js/whoops.base.js index ed3db16..9a9b8fe 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Resources/js/whoops.base.js +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/js/whoops.base.js @@ -1,4 +1,5 @@ Zepto(function($) { + // a jQuery.getScript() equivalent to asyncronously load javascript files // credits to http://stackoverflow.com/a/8812950/1597388 var getScript = function(src, func) { @@ -11,38 +12,88 @@ Zepto(function($) { document.getElementsByTagName('head')[0].appendChild( script ); }; - // load prettify asyncronously to speedup page rendering - getScript('//cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.js', function() { - prettyPrint(); - }); - + var $leftPanel = $('.left-panel'); var $frameContainer = $('.frames-container'); + var $appFramesTab = $('#application-frames-tab'); + var $allFramesTab = $('#all-frames-tab'); var $container = $('.details-container'); var $activeLine = $frameContainer.find('.frame.active'); var $activeFrame = $container.find('.frame-code.active'); var $ajaxEditors = $('.editor-link[data-ajax]'); - var headerHeight = $('header').height(); + var $header = $('header'); + + $header.on('mouseenter', function () { + if ($header.find('.exception').height() >= 145) { + $header.addClass('header-expand'); + } + }); + $header.on('mouseleave', function () { + $header.removeClass('header-expand'); + }); + + // load prettify asyncronously to speed up page rendering + getScript('//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.js', function () { + renderCurrentCodeblock(); + }); + + /* + * add prettyprint classes to our current active codeblock + * run prettyPrint() to highlight the active code + * scroll to the line when prettyprint is done + * highlight the current line + */ + var renderCurrentCodeblock = function(id) { + + // remove previous codeblocks so we only render the active one + $('.code-block').removeClass('prettyprint'); + + // pass the id in when we can for speed + if (typeof(id) === 'undefined' || typeof(id) === 'object') { + var id = /frame\-line\-([\d]*)/.exec($activeLine.attr('id'))[1]; + } + + $('#frame-code-linenums-' + id).addClass('prettyprint'); + $('#frame-code-args-' + id).addClass('prettyprint'); + + prettyPrint(highlightCurrentLine); + + } + + /* + * Highlight the active and neighboring lines for the current frame + * Adjust the offset to make sure that line is veritcally centered + */ var highlightCurrentLine = function() { - // Highlight the active and neighboring lines for this frame: var activeLineNumber = +($activeLine.find('.frame-line').text()); var $lines = $activeFrame.find('.linenums li'); var firstLine = +($lines.first().val()); + var $offset = $($lines[activeLineNumber - firstLine - 10]); + if ($offset.length > 0) { + $offset[0].scrollIntoView(); + } + $($lines[activeLineNumber - firstLine - 1]).addClass('current'); $($lines[activeLineNumber - firstLine]).addClass('current active'); $($lines[activeLineNumber - firstLine + 1]).addClass('current'); + + $container.scrollTop(0); + } - // Highlight the active for the first frame: - highlightCurrentLine(); + /* + * click handler for loading codeblocks + */ $frameContainer.on('click', '.frame', function() { + var $this = $(this); var id = /frame\-line\-([\d]*)/.exec($this.attr('id'))[1]; var $codeFrame = $('#frame-code-' + id); if ($codeFrame) { + $activeLine.removeClass('active'); $activeFrame.removeClass('active'); @@ -52,10 +103,10 @@ Zepto(function($) { $activeLine = $this; $activeFrame = $codeFrame; - highlightCurrentLine(); + renderCurrentCodeblock(id); - $container.scrollTop(0); } + }); var clipboard = new Clipboard('.clipboard'); @@ -94,24 +145,45 @@ Zepto(function($) { return actionMsg; } + function scrollIntoView($node, $parent) { + var nodeOffset = $node.offset(); + var nodeTop = nodeOffset.top; + var nodeBottom = nodeTop + nodeOffset.height; + var parentScrollTop = $parent.scrollTop(); + var parentHeight = $parent.height(); + + if (nodeTop < 0) { + $parent.scrollTop(parentScrollTop + nodeTop); + } else if (nodeBottom > parentHeight) { + $parent.scrollTop(parentScrollTop + nodeBottom - parentHeight); + } + } + $(document).on('keydown', function(e) { - if(e.ctrlKey) { - // CTRL+Arrow-UP/Arrow-Down support: + var applicationFrames = $frameContainer.hasClass('frames-container-application'), + frameClass = applicationFrames ? '.frame.frame-application' : '.frame'; + + if(e.ctrlKey || e.which === 74 || e.which === 75) { + // CTRL+Arrow-UP/k and Arrow-Down/j support: // 1) select the next/prev element // 2) make sure the newly selected element is within the view-scope // 3) focus the (right) container, so arrow-up/down (without ctrl) scroll the details - if (e.which === 38 /* arrow up */) { - $activeLine.prev('.frame').click(); - $activeLine[0].scrollIntoView(); + if (e.which === 38 /* arrow up */ || e.which === 75 /* k */) { + $activeLine.prev(frameClass).click(); + scrollIntoView($activeLine, $leftPanel); $container.focus(); e.preventDefault(); - } else if (e.which === 40 /* arrow down */) { - $activeLine.next('.frame').click(); - $activeLine[0].scrollIntoView(); + } else if (e.which === 40 /* arrow down */ || e.which === 74 /* j */) { + $activeLine.next(frameClass).click(); + scrollIntoView($activeLine, $leftPanel); $container.focus(); e.preventDefault(); } - } + } else if (e.which == 78 /* n */) { + if ($appFramesTab.length) { + setActiveFramesTab($('.frames-tab:not(.frames-tab-active)')); + } + } }); // Avoid to quit the page with some protocol (e.g. IntelliJ Platform REST API) @@ -125,4 +197,22 @@ Zepto(function($) { .removeClass('sf-dump-expanded') .addClass('sf-dump-compact'); $('.sf-dump-toggle span').html('▶'); + + // Make the given frames-tab active + function setActiveFramesTab($tab) { + $tab.addClass('frames-tab-active'); + + if ($tab.attr('id') == 'application-frames-tab') { + $frameContainer.addClass('frames-container-application'); + $allFramesTab.removeClass('frames-tab-active'); + } else { + $frameContainer.removeClass('frames-container-application'); + $appFramesTab.removeClass('frames-tab-active'); + } + } + + $('a.frames-tab').on('click', function(e) { + e.preventDefault(); + setActiveFramesTab($(this)); + }); }); diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php index 9bd1973..534f7c3 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php @@ -10,10 +10,10 @@ getEditorHref($filePath, (int) $line)): ?> Open: getEditorAjax($filePath, (int) $line) ? ' data-ajax' : '') ?>> - escape($filePath ?: '<#unknown>') ?> + breakOnDelimiter('/', $tpl->escape($filePath ?: '<#unknown>')) ?> - escape($filePath ?: '<#unknown>') ?> + breakOnDelimiter('/', $tpl->escape($filePath ?: '<#unknown>')) ?> getFileLines($line - 10, 20); + $range = $frame->getFileLines($line - 20, 40); // getFileLines can return null if there is no source code if ($range): @@ -29,21 +29,8 @@ $start = key($range) + 1; $code = join("\n", $range); ?> - -
escape($code) ?>
+
escape($code) ?>
+ @@ -52,7 +39,7 @@
Arguments
-
+
diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php index 004ed3a..7e8fa3d 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php @@ -2,16 +2,16 @@ clicking these links/buttons will display the code view for that particular frame */ ?> $frame): ?> -
+
+
- - escape($frame->getClass() ?: '') ?> - escape($frame->getFunction() ?: '') ?> + breakOnDelimiter('\\', $tpl->escape($frame->getClass() ?: '')) ?> + breakOnDelimiter('\\', $tpl->escape($frame->getFunction() ?: '')) ?>
- - getFile(true) ?: '<#unknown>') ?>getLine() ?> - +
diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frames_container.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frames_container.html.php new file mode 100644 index 0000000..47175df --- /dev/null +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frames_container.html.php @@ -0,0 +1,3 @@ +
+ render($frame_list) ?> +
\ No newline at end of file diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php new file mode 100644 index 0000000..ac53ca8 --- /dev/null +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php @@ -0,0 +1,20 @@ +
+ + + + Application frames (countIsApplication() ?>) + + + + Application frames (countIsApplication() ?>) + + + + All frames () + + + + Stack frames () + + +
\ No newline at end of file diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php new file mode 100644 index 0000000..f682cbb --- /dev/null +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php @@ -0,0 +1,3 @@ +
+ render($header) ?> +
diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php index d69c7a4..8756ab9 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php @@ -3,7 +3,7 @@ * Layout template file for Whoops's pretty error output. */ ?> - + @@ -15,23 +15,11 @@
-
-
- render($header) ?> -
-
- Stack frames (): -
+ render($panel_left_outer) ?> + + render($panel_details_outer) ?> -
- render($frame_list) ?> -
-
-
- render($frame_code) ?> - render($env_details) ?> -
diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php new file mode 100644 index 0000000..a85e451 --- /dev/null +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php @@ -0,0 +1,2 @@ +render($frame_code) ?> +render($env_details) ?> \ No newline at end of file diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php new file mode 100644 index 0000000..8162d8c --- /dev/null +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php @@ -0,0 +1,3 @@ +
+ render($panel_details) ?> +
\ No newline at end of file diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php new file mode 100644 index 0000000..3d96546 --- /dev/null +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php @@ -0,0 +1,3 @@ +render($header_outer) ?> +render($frames_description) ?> +render($frames_container) ?> \ No newline at end of file diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php new file mode 100644 index 0000000..77b575c --- /dev/null +++ b/windwalker/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php @@ -0,0 +1,3 @@ +
+ render($panel_left) ?> +
\ No newline at end of file diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Run.php b/windwalker/vendor/filp/whoops/src/Whoops/Run.php index ee97836..1d51f1c 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Run.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Run.php @@ -29,9 +29,9 @@ final class Run implements RunInterface /** * @var HandlerInterface[] */ - private $handlerStack = array(); + private $handlerStack = []; - private $silencedPatterns = array(); + private $silencedPatterns = []; private $system; @@ -91,7 +91,7 @@ public function getHandlers() */ public function clearHandlers() { - $this->handlerStack = array(); + $this->handlerStack = []; return $this; } @@ -118,9 +118,9 @@ class_exists("\\Whoops\\Exception\\FrameCollection"); class_exists("\\Whoops\\Exception\\Frame"); class_exists("\\Whoops\\Exception\\Inspector"); - $this->system->setErrorHandler(array($this, self::ERROR_HANDLER)); - $this->system->setExceptionHandler(array($this, self::EXCEPTION_HANDLER)); - $this->system->registerShutdownFunction(array($this, self::SHUTDOWN_HANDLER)); + $this->system->setErrorHandler([$this, self::ERROR_HANDLER]); + $this->system->setExceptionHandler([$this, self::EXCEPTION_HANDLER]); + $this->system->registerShutdownFunction([$this, self::SHUTDOWN_HANDLER]); $this->isRegistered = true; } @@ -170,10 +170,10 @@ public function silenceErrorsInPaths($patterns, $levels = 10240) $this->silencedPatterns, array_map( function ($pattern) use ($levels) { - return array( + return [ "pattern" => $pattern, "levels" => $levels, - ); + ]; }, (array) $patterns ) @@ -181,6 +181,17 @@ function ($pattern) use ($levels) { return $this; } + + /** + * Returns an array with silent errors in path configuration + * + * @return array + */ + public function getSilenceErrorsInPaths() + { + return $this->silencedPatterns; + } + /* * Should Whoops send HTTP error code to the browser if possible? * Whoops will by default send HTTP code 500, but you may wish to @@ -247,6 +258,7 @@ public function handleException($exception) // Just in case there are no handlers: $handlerResponse = null; + $handlerContentType = null; foreach (array_reverse($this->handlerStack) as $handler) { $handler->setRun($this); @@ -259,7 +271,10 @@ public function handleException($exception) // and removing it would be possibly breaking for users. $handlerResponse = $handler->handle($exception); - if (in_array($handlerResponse, array(Handler::LAST_HANDLER, Handler::QUIT))) { + // Collect the content type for possible sending in the headers. + $handlerContentType = method_exists($handler, 'contentType') ? $handler->contentType() : null; + + if (in_array($handlerResponse, [Handler::LAST_HANDLER, Handler::QUIT])) { // The Handler has handled the exception in some way, and // wishes to quit execution (Handler::QUIT), or skip any // other handlers (Handler::LAST_HANDLER). If $this->allowQuit @@ -277,12 +292,16 @@ public function handleException($exception) // it so that it may be used by the caller if ($this->writeToOutput()) { // @todo Might be able to clean this up a bit better - // If we're going to quit execution, cleanup all other output - // buffers before sending our own output: if ($willQuit) { + // Cleanup all other output buffers before sending our output: while ($this->system->getOutputBufferLevel() > 0) { $this->system->endOutputBuffering(); } + + // Send any headers if needed: + if (Misc::canSendHeaders() && $handlerContentType) { + header("Content-Type: {$handlerContentType}"); + } } $this->writeToOutputNow($output); @@ -320,6 +339,7 @@ public function handleError($level, $message, $file = null, $line = null) $levelMatches = $level & $entry["levels"]; if ($pathMatches && $levelMatches) { // Ignore the error, abort handling + // See https://github.com/filp/whoops/issues/418 return true; } } diff --git a/windwalker/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php b/windwalker/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php index 7df1307..c8e7f6b 100644 --- a/windwalker/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php +++ b/windwalker/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php @@ -21,7 +21,7 @@ class TemplateHelper * An array of variables to be passed to all templates * @var array */ - private $variables = array(); + private $variables = []; /** * @var HtmlDumper @@ -38,6 +38,17 @@ class TemplateHelper */ private $cloner; + /** + * @var string + */ + private $applicationRootPath; + + public function __construct() + { + // root path for ordinary composer projects + $this->applicationRootPath = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))); + } + /** * Escapes a string for output in an HTML document * @@ -60,6 +71,8 @@ public function escape($raw) $flags |= ENT_IGNORE; } + $raw = str_replace(chr(9), ' ', $raw); + return htmlspecialchars($raw, $flags, "UTF-8"); } @@ -79,6 +92,38 @@ public function escapeButPreserveUris($raw) ); } + /** + * Makes sure that the given string breaks on the delimiter. + * + * @param string $delimiter + * @param string $s + * @return string + */ + public function breakOnDelimiter($delimiter, $s) + { + $parts = explode($delimiter, $s); + foreach ($parts as &$part) { + $part = '
' . $part . '
'; + } + + return implode($delimiter, $parts); + } + + /** + * Replace the part of the path that all files have in common. + * + * @param string $path + * @return string + */ + public function shorten($path) + { + if ($this->applicationRootPath != "/") { + $path = str_replace($this->applicationRootPath, '…', $path); + } + + return $path; + } + private function getDumper() { if (!$this->htmlDumper && class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) { @@ -86,7 +131,7 @@ private function getDumper() // re-use the same var-dumper instance, so it won't re-render the global styles/scripts on each dump. $this->htmlDumper = new HtmlDumper($this->htmlDumperOutput); - $styles = array( + $styles = [ 'default' => 'color:#FFFFFF; line-height:normal; font:12px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace !important; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: normal', 'num' => 'color:#BCD42A', 'const' => 'color: #4bb1b1;', @@ -99,7 +144,7 @@ private function getDumper() 'meta' => 'color:#FFFFFF', 'key' => 'color:#BCD42A', 'index' => 'color:#ef7c61', - ); + ]; $this->htmlDumper->setStyles($styles); } @@ -119,8 +164,15 @@ public function dump($value) if ($dumper) { // re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump. // exclude verbose information (e.g. exception stack traces) + if (class_exists('Symfony\Component\VarDumper\Caster\Caster')) { + $cloneVar = $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE); + // Symfony VarDumper 2.6 Caster class dont exist. + } else { + $cloneVar = $this->getCloner()->cloneVar($value); + } + $dumper->dump( - $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE), + $cloneVar, $this->htmlDumperOutput ); @@ -276,4 +328,24 @@ public function getCloner() } return $this->cloner; } + + /** + * Set the application root path. + * + * @param string $applicationRootPath + */ + public function setApplicationRootPath($applicationRootPath) + { + $this->applicationRootPath = $applicationRootPath; + } + + /** + * Return the application root path. + * + * @return string + */ + public function getApplicationRootPath() + { + return $this->applicationRootPath; + } } diff --git a/windwalker/vendor/index.html b/windwalker/vendor/index.html new file mode 100644 index 0000000..2efb97f --- /dev/null +++ b/windwalker/vendor/index.html @@ -0,0 +1 @@ + diff --git a/windwalker/vendor/psr/log/.gitignore b/windwalker/vendor/psr/log/.gitignore new file mode 100644 index 0000000..22d0d82 --- /dev/null +++ b/windwalker/vendor/psr/log/.gitignore @@ -0,0 +1 @@ +vendor diff --git a/windwalker/vendor/psr/log/LICENSE b/windwalker/vendor/psr/log/LICENSE new file mode 100644 index 0000000..474c952 --- /dev/null +++ b/windwalker/vendor/psr/log/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/windwalker/vendor/psr/log/Psr/Log/AbstractLogger.php b/windwalker/vendor/psr/log/Psr/Log/AbstractLogger.php new file mode 100644 index 0000000..90e721a --- /dev/null +++ b/windwalker/vendor/psr/log/Psr/Log/AbstractLogger.php @@ -0,0 +1,128 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function alert($message, array $context = array()) + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function critical($message, array $context = array()) + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function error($message, array $context = array()) + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function warning($message, array $context = array()) + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function notice($message, array $context = array()) + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function info($message, array $context = array()) + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function debug($message, array $context = array()) + { + $this->log(LogLevel::DEBUG, $message, $context); + } +} diff --git a/windwalker/vendor/psr/log/Psr/Log/InvalidArgumentException.php b/windwalker/vendor/psr/log/Psr/Log/InvalidArgumentException.php new file mode 100644 index 0000000..67f852d --- /dev/null +++ b/windwalker/vendor/psr/log/Psr/Log/InvalidArgumentException.php @@ -0,0 +1,7 @@ +logger = $logger; + } +} diff --git a/windwalker/vendor/psr/log/Psr/Log/LoggerInterface.php b/windwalker/vendor/psr/log/Psr/Log/LoggerInterface.php new file mode 100644 index 0000000..5ea7243 --- /dev/null +++ b/windwalker/vendor/psr/log/Psr/Log/LoggerInterface.php @@ -0,0 +1,123 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function alert($message, array $context = array()) + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function critical($message, array $context = array()) + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function error($message, array $context = array()) + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function warning($message, array $context = array()) + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function notice($message, array $context = array()) + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function info($message, array $context = array()) + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function debug($message, array $context = array()) + { + $this->log(LogLevel::DEBUG, $message, $context); + } + + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * + * @return void + */ + abstract public function log($level, $message, array $context = array()); +} diff --git a/windwalker/vendor/psr/log/Psr/Log/NullLogger.php b/windwalker/vendor/psr/log/Psr/Log/NullLogger.php new file mode 100644 index 0000000..d8cd682 --- /dev/null +++ b/windwalker/vendor/psr/log/Psr/Log/NullLogger.php @@ -0,0 +1,28 @@ +logger) { }` + * blocks. + */ +class NullLogger extends AbstractLogger +{ + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * + * @return void + */ + public function log($level, $message, array $context = array()) + { + // noop + } +} diff --git a/windwalker/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php b/windwalker/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php new file mode 100644 index 0000000..a0391a5 --- /dev/null +++ b/windwalker/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php @@ -0,0 +1,140 @@ + ". + * + * Example ->error('Foo') would yield "error Foo". + * + * @return string[] + */ + abstract public function getLogs(); + + public function testImplements() + { + $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); + } + + /** + * @dataProvider provideLevelsAndMessages + */ + public function testLogsAtAllLevels($level, $message) + { + $logger = $this->getLogger(); + $logger->{$level}($message, array('user' => 'Bob')); + $logger->log($level, $message, array('user' => 'Bob')); + + $expected = array( + $level.' message of level '.$level.' with context: Bob', + $level.' message of level '.$level.' with context: Bob', + ); + $this->assertEquals($expected, $this->getLogs()); + } + + public function provideLevelsAndMessages() + { + return array( + LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), + LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), + LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), + LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), + LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), + LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), + LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), + LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), + ); + } + + /** + * @expectedException \Psr\Log\InvalidArgumentException + */ + public function testThrowsOnInvalidLevel() + { + $logger = $this->getLogger(); + $logger->log('invalid level', 'Foo'); + } + + public function testContextReplacement() + { + $logger = $this->getLogger(); + $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + + $expected = array('info {Message {nothing} Bob Bar a}'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testObjectCastToString() + { + if (method_exists($this, 'createPartialMock')) { + $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); + } else { + $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); + } + $dummy->expects($this->once()) + ->method('__toString') + ->will($this->returnValue('DUMMY')); + + $this->getLogger()->warning($dummy); + + $expected = array('warning DUMMY'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testContextCanContainAnything() + { + $context = array( + 'bool' => true, + 'null' => null, + 'string' => 'Foo', + 'int' => 0, + 'float' => 0.5, + 'nested' => array('with object' => new DummyTest), + 'object' => new \DateTime, + 'resource' => fopen('php://memory', 'r'), + ); + + $this->getLogger()->warning('Crazy context data', $context); + + $expected = array('warning Crazy context data'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testContextExceptionKeyCanBeExceptionOrOtherValues() + { + $logger = $this->getLogger(); + $logger->warning('Random message', array('exception' => 'oops')); + $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + + $expected = array( + 'warning Random message', + 'critical Uncaught Exception!' + ); + $this->assertEquals($expected, $this->getLogs()); + } +} + +class DummyTest +{ + public function __toString() + { + } +} diff --git a/windwalker/vendor/psr/log/README.md b/windwalker/vendor/psr/log/README.md new file mode 100644 index 0000000..574bc1c --- /dev/null +++ b/windwalker/vendor/psr/log/README.md @@ -0,0 +1,45 @@ +PSR Log +======= + +This repository holds all interfaces/classes/traits related to +[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). + +Note that this is not a logger of its own. It is merely an interface that +describes a logger. See the specification for more details. + +Usage +----- + +If you need a logger, you can use the interface like this: + +```php +logger = $logger; + } + + public function doSomething() + { + if ($this->logger) { + $this->logger->info('Doing work'); + } + + // do something useful + } +} +``` + +You can then pick one of the implementations of the interface to get a logger. + +If you want to implement the interface, you can require this package and +implement `Psr\Log\LoggerInterface` in your code. Please read the +[specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) +for details. diff --git a/windwalker/vendor/psr/log/composer.json b/windwalker/vendor/psr/log/composer.json new file mode 100644 index 0000000..87934d7 --- /dev/null +++ b/windwalker/vendor/psr/log/composer.json @@ -0,0 +1,26 @@ +{ + "name": "psr/log", + "description": "Common interface for logging libraries", + "keywords": ["psr", "psr-3", "log"], + "homepage": "https://github.com/php-fig/log", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": ">=5.3.0" + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/windwalker/vendor/symfony/yaml/Dumper.php b/windwalker/vendor/symfony/yaml/Dumper.php index 21351a5..05817f5 100644 --- a/windwalker/vendor/symfony/yaml/Dumper.php +++ b/windwalker/vendor/symfony/yaml/Dumper.php @@ -28,7 +28,7 @@ class Dumper /** * Sets the indentation. * - * @param int $num The amount of spaces to use for indentation of nested nodes. + * @param int $num The amount of spaces to use for indentation of nested nodes */ public function setIndentation($num) { @@ -58,7 +58,7 @@ public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = if ($inline <= 0 || !is_array($input) || empty($input)) { $output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport); } else { - $isAHash = array_keys($input) !== range(0, count($input) - 1); + $isAHash = Inline::isHash($input); foreach ($input as $key => $value) { $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value); diff --git a/windwalker/vendor/symfony/yaml/Escaper.php b/windwalker/vendor/symfony/yaml/Escaper.php index 7bac8dd..94bb392 100644 --- a/windwalker/vendor/symfony/yaml/Escaper.php +++ b/windwalker/vendor/symfony/yaml/Escaper.php @@ -33,24 +33,26 @@ class Escaper "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", + ); private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\N', '\\_', '\\L', '\\P'); + '\\N', '\\_', '\\L', '\\P', + ); /** * Determines if a PHP value would require double quoting in YAML. * * @param string $value A PHP value * - * @return bool True if the value would require double quotes. + * @return bool True if the value would require double quotes */ public static function requiresDoubleQuoting($value) { - return preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); + return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); } /** @@ -70,7 +72,7 @@ public static function escapeWithDoubleQuotes($value) * * @param string $value A PHP value * - * @return bool True if the value would require single quotes. + * @return bool True if the value would require single quotes */ public static function requiresSingleQuoting($value) { @@ -82,7 +84,7 @@ public static function requiresSingleQuoting($value) // Determines if the PHP value contains any single characters that would // cause it to require single quoting in YAML. - return preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value); + return 0 < preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value); } /** diff --git a/windwalker/vendor/symfony/yaml/Exception/ParseException.php b/windwalker/vendor/symfony/yaml/Exception/ParseException.php index b74eb91..74548df 100644 --- a/windwalker/vendor/symfony/yaml/Exception/ParseException.php +++ b/windwalker/vendor/symfony/yaml/Exception/ParseException.php @@ -26,11 +26,11 @@ class ParseException extends RuntimeException /** * Constructor. * - * @param string $message The error message - * @param int $parsedLine The line where the error occurred - * @param int $snippet The snippet of code near the problem - * @param string $parsedFile The file name where the error occurred - * @param \Exception $previous The previous exception + * @param string $message The error message + * @param int $parsedLine The line where the error occurred + * @param string|null $snippet The snippet of code near the problem + * @param string|null $parsedFile The file name where the error occurred + * @param \Exception|null $previous The previous exception */ public function __construct($message, $parsedLine = -1, $snippet = null, $parsedFile = null, \Exception $previous = null) { diff --git a/windwalker/vendor/symfony/yaml/Inline.php b/windwalker/vendor/symfony/yaml/Inline.php index bb2db36..dade755 100644 --- a/windwalker/vendor/symfony/yaml/Inline.php +++ b/windwalker/vendor/symfony/yaml/Inline.php @@ -21,14 +21,14 @@ */ class Inline { - const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; + const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')'; private static $exceptionOnInvalidType = false; private static $objectSupport = false; private static $objectForMap = false; /** - * Converts a YAML string to a PHP array. + * Converts a YAML string to a PHP value. * * @param string $value A YAML string * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise @@ -36,7 +36,7 @@ class Inline * @param bool $objectForMap true if maps should return a stdClass instead of array() * @param array $references Mapping of variable names to values * - * @return array A PHP array representing the YAML string + * @return mixed A PHP value * * @throws ParseException */ @@ -90,7 +90,7 @@ public static function parse($value, $exceptionOnInvalidType = false, $objectSup * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise * @param bool $objectSupport true if object support is enabled, false otherwise * - * @return string The YAML string representing the PHP array + * @return string The YAML string representing the PHP value * * @throws DumpException When trying to dump PHP resource */ @@ -149,14 +149,36 @@ public static function dump($value, $exceptionOnInvalidType = false, $objectSupp case Escaper::requiresDoubleQuoting($value): return Escaper::escapeWithDoubleQuotes($value); case Escaper::requiresSingleQuoting($value): - case preg_match(self::getHexRegex(), $value): - case preg_match(self::getTimestampRegex(), $value): + case Parser::preg_match(self::getHexRegex(), $value): + case Parser::preg_match(self::getTimestampRegex(), $value): return Escaper::escapeWithSingleQuotes($value); default: return $value; } } + /** + * Check if given array is hash or just normal indexed array. + * + * @internal + * + * @param array $value The PHP array to check + * + * @return bool true if value is hash array, false otherwise + */ + public static function isHash(array $value) + { + $expectedKey = 0; + + foreach ($value as $key => $val) { + if ($key !== $expectedKey++) { + return true; + } + } + + return false; + } + /** * Dumps a PHP array to a YAML string. * @@ -169,11 +191,7 @@ public static function dump($value, $exceptionOnInvalidType = false, $objectSupp private static function dumpArray($value, $exceptionOnInvalidType, $objectSupport) { // array - $keys = array_keys($value); - $keysCount = count($keys); - if ((1 === $keysCount && '0' == $keys[0]) - || ($keysCount > 1 && array_reduce($keys, function ($v, $w) { return (int) $v + $w; }, 0) === $keysCount * ($keysCount - 1) / 2) - ) { + if ($value && !self::isHash($value)) { $output = array(); foreach ($value as $val) { $output[] = self::dump($val, $exceptionOnInvalidType, $objectSupport); @@ -182,7 +200,7 @@ private static function dumpArray($value, $exceptionOnInvalidType, $objectSuppor return sprintf('[%s]', implode(', ', $output)); } - // mapping + // hash $output = array(); foreach ($value as $key => $val) { $output[] = sprintf('%s: %s', self::dump($key, $exceptionOnInvalidType, $objectSupport), self::dump($val, $exceptionOnInvalidType, $objectSupport)); @@ -192,16 +210,16 @@ private static function dumpArray($value, $exceptionOnInvalidType, $objectSuppor } /** - * Parses a scalar to a YAML string. + * Parses a YAML scalar. * - * @param string $scalar - * @param string $delimiters - * @param array $stringDelimiters - * @param int &$i - * @param bool $evaluate - * @param array $references + * @param string $scalar + * @param string[] $delimiters + * @param string[] $stringDelimiters + * @param int &$i + * @param bool $evaluate + * @param array $references * - * @return string A YAML string + * @return string * * @throws ParseException When malformed inline YAML string is parsed * @@ -226,14 +244,14 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter $i += strlen($output); // remove comments - if (preg_match('/[ \t]+#/', $output, $match, PREG_OFFSET_CAPTURE)) { + if (Parser::preg_match('/[ \t]+#/', $output, $match, PREG_OFFSET_CAPTURE)) { $output = substr($output, 0, $match[0][1]); } - } elseif (preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) { + } elseif (Parser::preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) { $output = $match[1]; $i += strlen($output); } else { - throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar)); + throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar)); } // a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >) @@ -253,19 +271,19 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter } /** - * Parses a quoted scalar to YAML. + * Parses a YAML quoted scalar. * * @param string $scalar * @param int &$i * - * @return string A YAML string + * @return string * * @throws ParseException When malformed inline YAML string is parsed */ private static function parseQuotedScalar($scalar, &$i) { - if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) { - throw new ParseException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i))); + if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) { + throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i))); } $output = substr($match[0], 1, strlen($match[0]) - 2); @@ -283,13 +301,13 @@ private static function parseQuotedScalar($scalar, &$i) } /** - * Parses a sequence to a YAML string. + * Parses a YAML sequence. * * @param string $sequence * @param int &$i * @param array $references * - * @return string A YAML string + * @return array * * @throws ParseException When malformed inline YAML string is parsed */ @@ -338,17 +356,17 @@ private static function parseSequence($sequence, &$i = 0, $references = array()) ++$i; } - throw new ParseException(sprintf('Malformed inline YAML string %s', $sequence)); + throw new ParseException(sprintf('Malformed inline YAML string: %s.', $sequence)); } /** - * Parses a mapping to a YAML string. + * Parses a YAML mapping. * * @param string $mapping * @param int &$i * @param array $references * - * @return string A YAML string + * @return array|\stdClass * * @throws ParseException When malformed inline YAML string is parsed */ @@ -426,7 +444,7 @@ private static function parseMapping($mapping, &$i = 0, $references = array()) } } - throw new ParseException(sprintf('Malformed inline YAML string %s', $mapping)); + throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping)); } /** @@ -435,7 +453,7 @@ private static function parseMapping($mapping, &$i = 0, $references = array()) * @param string $scalar * @param array $references * - * @return string A YAML string + * @return mixed The evaluated YAML string * * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved */ @@ -512,16 +530,16 @@ private static function evaluateScalar($scalar, $references = array()) return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw === (string) $cast) ? $cast : $raw); case is_numeric($scalar): - case preg_match(self::getHexRegex(), $scalar): + case Parser::preg_match(self::getHexRegex(), $scalar): return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar; case '.inf' === $scalarLower: case '.nan' === $scalarLower: return -log(0); case '-.inf' === $scalarLower: return log(0); - case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar): + case Parser::preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar): return (float) str_replace(',', '', $scalar); - case preg_match(self::getTimestampRegex(), $scalar): + case Parser::preg_match(self::getTimestampRegex(), $scalar): $timeZone = date_default_timezone_get(); date_default_timezone_set('UTC'); $time = strtotime($scalar); diff --git a/windwalker/vendor/symfony/yaml/LICENSE b/windwalker/vendor/symfony/yaml/LICENSE index 12a7453..17d16a1 100644 --- a/windwalker/vendor/symfony/yaml/LICENSE +++ b/windwalker/vendor/symfony/yaml/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2016 Fabien Potencier +Copyright (c) 2004-2017 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/windwalker/vendor/symfony/yaml/Parser.php b/windwalker/vendor/symfony/yaml/Parser.php index 41134e6..96a85a8 100644 --- a/windwalker/vendor/symfony/yaml/Parser.php +++ b/windwalker/vendor/symfony/yaml/Parser.php @@ -25,19 +25,26 @@ class Parser const FOLDED_SCALAR_PATTERN = self::BLOCK_SCALAR_HEADER_PATTERN; private $offset = 0; + private $totalNumberOfLines; private $lines = array(); private $currentLineNb = -1; private $currentLine = ''; private $refs = array(); + private $skippedLineNumbers = array(); + private $locallySkippedLineNumbers = array(); /** * Constructor. * - * @param int $offset The offset of YAML document (used for line numbers in error messages) + * @param int $offset The offset of YAML document (used for line numbers in error messages) + * @param int|null $totalNumberOfLines The overall number of lines being parsed + * @param int[] $skippedLineNumbers Number of comment lines that have been skipped by the parser */ - public function __construct($offset = 0) + public function __construct($offset = 0, $totalNumberOfLines = null, array $skippedLineNumbers = array()) { $this->offset = $offset; + $this->totalNumberOfLines = $totalNumberOfLines; + $this->skippedLineNumbers = $skippedLineNumbers; } /** @@ -54,22 +61,60 @@ public function __construct($offset = 0) */ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false) { - if (!preg_match('//u', $value)) { + if (false === preg_match('//u', $value)) { throw new ParseException('The YAML value does not appear to be valid UTF-8.'); } + + $this->refs = array(); + + $mbEncoding = null; + $e = null; + $data = null; + + if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) { + $mbEncoding = mb_internal_encoding(); + mb_internal_encoding('UTF-8'); + } + + try { + $data = $this->doParse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap); + } catch (\Exception $e) { + } catch (\Throwable $e) { + } + + if (null !== $mbEncoding) { + mb_internal_encoding($mbEncoding); + } + + $this->lines = array(); + $this->currentLine = ''; + $this->refs = array(); + $this->skippedLineNumbers = array(); + $this->locallySkippedLineNumbers = array(); + + if (null !== $e) { + throw $e; + } + + return $data; + } + + private function doParse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false) + { $this->currentLineNb = -1; $this->currentLine = ''; $value = $this->cleanup($value); $this->lines = explode("\n", $value); + $this->locallySkippedLineNumbers = array(); - if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('UTF-8'); + if (null === $this->totalNumberOfLines) { + $this->totalNumberOfLines = count($this->lines); } $data = array(); $context = null; $allowOverwrite = false; + while ($this->moveToNextLine()) { if ($this->isCurrentLineEmpty()) { continue; @@ -81,38 +126,31 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } $isRef = $mergeNode = false; - if (preg_match('#^\-((?P\s+)(?P.+?))?\s*$#u', $this->currentLine, $values)) { + if (self::preg_match('#^\-((?P\s+)(?P.+))?$#u', rtrim($this->currentLine), $values)) { if ($context && 'mapping' == $context) { - throw new ParseException('You cannot define a sequence item when in a mapping'); + throw new ParseException('You cannot define a sequence item when in a mapping', $this->getRealCurrentLineNb() + 1, $this->currentLine); } $context = 'sequence'; - if (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) { + if (isset($values['value']) && self::preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) { $isRef = $matches['ref']; $values['value'] = $matches['value']; } // array if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { - $c = $this->getRealCurrentLineNb() + 1; - $parser = new self($c); - $parser->refs = &$this->refs; - $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap); + $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap); } else { if (isset($values['leadspaces']) - && preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P.+?))?\s*$#u', $values['value'], $matches) + && self::preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P.+))?$#u', rtrim($values['value']), $matches) ) { // this is a compact notation element, add to next block and parse - $c = $this->getRealCurrentLineNb(); - $parser = new self($c); - $parser->refs = &$this->refs; - $block = $values['value']; if ($this->isNextLineIndented()) { $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + strlen($values['leadspaces']) + 1); } - $data[] = $parser->parse($block, $exceptionOnInvalidType, $objectSupport, $objectForMap); + $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $exceptionOnInvalidType, $objectSupport, $objectForMap); } else { $data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport, $objectForMap, $context); } @@ -120,9 +158,12 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = if ($isRef) { $this->refs[$isRef] = end($data); } - } elseif (preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))) { + } elseif ( + self::preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P.+))?$#u', rtrim($this->currentLine), $values) + && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'"))) + ) { if ($context && 'sequence' == $context) { - throw new ParseException('You cannot define a mapping item when in a sequence'); + throw new ParseException('You cannot define a mapping item when in a sequence', $this->currentLineNb + 1, $this->currentLine); } $context = 'mapping'; @@ -157,21 +198,14 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine); } - foreach ($refValue as $key => $value) { - if (!isset($data[$key])) { - $data[$key] = $value; - } - } + $data += $refValue; // array union } else { if (isset($values['value']) && $values['value'] !== '') { $value = $values['value']; } else { $value = $this->getNextEmbedBlock(); } - $c = $this->getRealCurrentLineNb() + 1; - $parser = new self($c); - $parser->refs = &$this->refs; - $parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap); + $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $exceptionOnInvalidType, $objectSupport, $objectForMap); if (!is_array($parsed)) { throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine); @@ -186,23 +220,15 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem); } - foreach ($parsedItem as $key => $value) { - if (!isset($data[$key])) { - $data[$key] = $value; - } - } + $data += $parsedItem; // array union } } else { // If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the // current mapping, unless the key already exists in it. - foreach ($parsed as $key => $value) { - if (!isset($data[$key])) { - $data[$key] = $value; - } - } + $data += $parsed; // array union } } - } elseif (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) { + } elseif (isset($values['value']) && self::preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) { $isRef = $matches['ref']; $values['value'] = $matches['value']; } @@ -219,10 +245,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $data[$key] = null; } } else { - $c = $this->getRealCurrentLineNb() + 1; - $parser = new self($c); - $parser->refs = &$this->refs; - $value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap); + $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap); // Spec: Keys MUST be unique; first one wins. // But overwriting is allowed when a merge node is used in current block. if ($allowOverwrite || !isset($data[$key])) { @@ -243,7 +266,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } else { // multiple documents are not supported if ('---' === $this->currentLine) { - throw new ParseException('Multiple documents are not supported.'); + throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine); } // 1-liner optionally followed by newline(s) @@ -257,52 +280,13 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = throw $e; } - if (is_array($value)) { - $first = reset($value); - if (is_string($first) && 0 === strpos($first, '*')) { - $data = array(); - foreach ($value as $alias) { - $data[] = $this->refs[substr($alias, 1)]; - } - $value = $data; - } - } - - if (isset($mbEncoding)) { - mb_internal_encoding($mbEncoding); - } - return $value; } - switch (preg_last_error()) { - case PREG_INTERNAL_ERROR: - $error = 'Internal PCRE error.'; - break; - case PREG_BACKTRACK_LIMIT_ERROR: - $error = 'pcre.backtrack_limit reached.'; - break; - case PREG_RECURSION_LIMIT_ERROR: - $error = 'pcre.recursion_limit reached.'; - break; - case PREG_BAD_UTF8_ERROR: - $error = 'Malformed UTF-8 data.'; - break; - case PREG_BAD_UTF8_OFFSET_ERROR: - $error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point.'; - break; - default: - $error = 'Unable to parse.'; - } - - throw new ParseException($error, $this->getRealCurrentLineNb() + 1, $this->currentLine); + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine); } } - if (isset($mbEncoding)) { - mb_internal_encoding($mbEncoding); - } - if ($objectForMap && !is_object($data) && 'mapping' === $context) { $object = new \stdClass(); @@ -316,6 +300,24 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = return empty($data) ? null : $data; } + private function parseBlock($offset, $yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap) + { + $skippedLineNumbers = $this->skippedLineNumbers; + + foreach ($this->locallySkippedLineNumbers as $lineNumber) { + if ($lineNumber < $offset) { + continue; + } + + $skippedLineNumbers[] = $lineNumber; + } + + $parser = new self($offset, $this->totalNumberOfLines, $skippedLineNumbers); + $parser->refs = &$this->refs; + + return $parser->doParse($yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap); + } + /** * Returns the current line number (takes the offset into account). * @@ -323,7 +325,17 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = */ private function getRealCurrentLineNb() { - return $this->currentLineNb + $this->offset; + $realCurrentLineNumber = $this->currentLineNb + $this->offset; + + foreach ($this->skippedLineNumbers as $skippedLineNumber) { + if ($skippedLineNumber > $realCurrentLineNumber) { + break; + } + + ++$realCurrentLineNumber; + } + + return $realCurrentLineNumber; } /** @@ -414,7 +426,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) $previousLineIndentation = $indent; - if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) { + if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) { $this->moveToPreviousLine(); break; } @@ -426,6 +438,14 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) // we ignore "comment" lines only when we are not inside a scalar block if (empty($blockScalarIndentations) && $this->isCurrentLineComment()) { + // remember ignored comment lines (they are used later in nested + // parser calls to determine real line numbers) + // + // CAUTION: beware to not populate the global property here as it + // will otherwise influence the getRealCurrentLineNb() call here + // for consecutive comment lines and subsequent embedded blocks + $this->locallySkippedLineNumbers[] = $this->getRealCurrentLineNb(); + continue; } @@ -461,10 +481,18 @@ private function moveToNextLine() /** * Moves the parser to the previous line. + * + * @return bool */ private function moveToPreviousLine() { + if ($this->currentLineNb < 1) { + return false; + } + $this->currentLine = $this->lines[--$this->currentLineNb]; + + return true; } /** @@ -490,13 +518,13 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $ob } if (!array_key_exists($value, $this->refs)) { - throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLine); + throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine); } return $this->refs[$value]; } - if (preg_match('/^'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) { + if (self::preg_match('/^'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) { $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : ''; return $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers)); @@ -551,7 +579,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) // determine indentation if not specified if (0 === $indentation) { - if (preg_match('/^ +/', $this->currentLine, $matches)) { + if (self::preg_match('/^ +/', $this->currentLine, $matches)) { $indentation = strlen($matches[0]); } } @@ -562,7 +590,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) while ( $notEOF && ( $isCurrentLineBlank || - preg_match($pattern, $this->currentLine, $matches) + self::preg_match($pattern, $this->currentLine, $matches) ) ) { if ($isCurrentLineBlank && strlen($this->currentLine) > $indentation) { @@ -585,6 +613,8 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) if ($notEOF) { $blockLines[] = ''; $this->moveToPreviousLine(); + } elseif (!$notEOF && !$this->isCurrentLineLastLineInDocument()) { + $blockLines[] = ''; } // folded style @@ -593,7 +623,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) $previousLineIndented = false; $previousLineBlank = false; - for ($i = 0; $i < count($blockLines); ++$i) { + for ($i = 0, $blockLinesCount = count($blockLines); $i < $blockLinesCount; ++$i) { if ('' === $blockLines[$i]) { $text .= "\n"; $previousLineIndented = false; @@ -648,10 +678,7 @@ private function isNextLineIndented() return false; } - $ret = false; - if ($this->getCurrentLineIndentation() > $currentIndentation) { - $ret = true; - } + $ret = $this->getCurrentLineIndentation() > $currentIndentation; $this->moveToPreviousLine(); @@ -691,6 +718,11 @@ private function isCurrentLineComment() return '' !== $ltrimmedLine && $ltrimmedLine[0] === '#'; } + private function isCurrentLineLastLineInDocument() + { + return ($this->offset + $this->currentLineNb) >= ($this->totalNumberOfLines - 1); + } + /** * Cleanups a YAML string to be parsed. * @@ -747,14 +779,7 @@ private function isNextLineUnIndentedCollection() return false; } - $ret = false; - if ( - $this->getCurrentLineIndentation() == $currentIndentation - && - $this->isStringUnIndentedCollectionItem() - ) { - $ret = true; - } + $ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem(); $this->moveToPreviousLine(); @@ -768,7 +793,7 @@ private function isNextLineUnIndentedCollection() */ private function isStringUnIndentedCollectionItem() { - return 0 === strpos($this->currentLine, '- '); + return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- '); } /** @@ -778,6 +803,48 @@ private function isStringUnIndentedCollectionItem() */ private function isBlockScalarHeader() { - return (bool) preg_match('~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~', $this->currentLine); + return (bool) self::preg_match('~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~', $this->currentLine); + } + + /** + * A local wrapper for `preg_match` which will throw a ParseException if there + * is an internal error in the PCRE engine. + * + * This avoids us needing to check for "false" every time PCRE is used + * in the YAML engine + * + * @throws ParseException on a PCRE internal error + * + * @see preg_last_error() + * + * @internal + */ + public static function preg_match($pattern, $subject, &$matches = null, $flags = 0, $offset = 0) + { + if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) { + switch (preg_last_error()) { + case PREG_INTERNAL_ERROR: + $error = 'Internal PCRE error.'; + break; + case PREG_BACKTRACK_LIMIT_ERROR: + $error = 'pcre.backtrack_limit reached.'; + break; + case PREG_RECURSION_LIMIT_ERROR: + $error = 'pcre.recursion_limit reached.'; + break; + case PREG_BAD_UTF8_ERROR: + $error = 'Malformed UTF-8 data.'; + break; + case PREG_BAD_UTF8_OFFSET_ERROR: + $error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point.'; + break; + default: + $error = 'Error.'; + } + + throw new ParseException($error); + } + + return $ret; } } diff --git a/windwalker/vendor/symfony/yaml/Tests/DumperTest.php b/windwalker/vendor/symfony/yaml/Tests/DumperTest.php index 84069d8..6a1b3ac 100644 --- a/windwalker/vendor/symfony/yaml/Tests/DumperTest.php +++ b/windwalker/vendor/symfony/yaml/Tests/DumperTest.php @@ -11,10 +11,11 @@ namespace Symfony\Component\Yaml\Tests; +use PHPUnit\Framework\TestCase; use Symfony\Component\Yaml\Parser; use Symfony\Component\Yaml\Dumper; -class DumperTest extends \PHPUnit_Framework_TestCase +class DumperTest extends TestCase { protected $parser; protected $dumper; @@ -209,23 +210,25 @@ public function testEscapedEscapeSequencesInQuotedScalar($input, $expected) public function getEscapeSequences() { return array( - 'null' => array("\t\\0", '"\t\\\\0"'), - 'bell' => array("\t\\a", '"\t\\\\a"'), - 'backspace' => array("\t\\b", '"\t\\\\b"'), - 'horizontal-tab' => array("\t\\t", '"\t\\\\t"'), - 'line-feed' => array("\t\\n", '"\t\\\\n"'), - 'vertical-tab' => array("\t\\v", '"\t\\\\v"'), - 'form-feed' => array("\t\\f", '"\t\\\\f"'), - 'carriage-return' => array("\t\\r", '"\t\\\\r"'), - 'escape' => array("\t\\e", '"\t\\\\e"'), - 'space' => array("\t\\ ", '"\t\\\\ "'), - 'double-quote' => array("\t\\\"", '"\t\\\\\\""'), - 'slash' => array("\t\\/", '"\t\\\\/"'), - 'backslash' => array("\t\\\\", '"\t\\\\\\\\"'), - 'next-line' => array("\t\\N", '"\t\\\\N"'), - 'non-breaking-space' => array("\t\\�", '"\t\\\\�"'), - 'line-separator' => array("\t\\L", '"\t\\\\L"'), - 'paragraph-separator' => array("\t\\P", '"\t\\\\P"'), + 'empty string' => array('', "''"), + 'null' => array("\x0", '"\\0"'), + 'bell' => array("\x7", '"\\a"'), + 'backspace' => array("\x8", '"\\b"'), + 'horizontal-tab' => array("\t", '"\\t"'), + 'line-feed' => array("\n", '"\\n"'), + 'vertical-tab' => array("\v", '"\\v"'), + 'form-feed' => array("\xC", '"\\f"'), + 'carriage-return' => array("\r", '"\\r"'), + 'escape' => array("\x1B", '"\\e"'), + 'space' => array(' ', "' '"), + 'double-quote' => array('"', "'\"'"), + 'slash' => array('/', '/'), + 'backslash' => array('\\', '\\'), + 'next-line' => array("\xC2\x85", '"\\N"'), + 'non-breaking-space' => array("\xc2\xa0", '"\\_"'), + 'line-separator' => array("\xE2\x80\xA8", '"\\L"'), + 'paragraph-separator' => array("\xE2\x80\xA9", '"\\P"'), + 'colon' => array(':', "':'"), ); } diff --git a/windwalker/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml b/windwalker/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml index 4b67d34..59f6125 100644 --- a/windwalker/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml +++ b/windwalker/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml @@ -10,9 +10,11 @@ yaml: | a: Steve b: Clark c: Brian + e: notnull bar: a: before d: other + e: ~ <<: *foo b: new x: Oren @@ -46,13 +48,13 @@ yaml: | <<: *nestedref php: | array( - 'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian'), - 'bar' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'), + 'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'), + 'bar' => array('a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'), 'duplicate' => array('foo' => 'bar'), 'foo2' => array('a' => 'Ballmer'), 'ding' => array('fi', 'fei', 'fo', 'fam'), - 'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'), - 'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam'), + 'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'), + 'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'), 'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)), 'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345)) ) diff --git a/windwalker/vendor/symfony/yaml/Tests/InlineTest.php b/windwalker/vendor/symfony/yaml/Tests/InlineTest.php index f0f9b96..7ca692d 100644 --- a/windwalker/vendor/symfony/yaml/Tests/InlineTest.php +++ b/windwalker/vendor/symfony/yaml/Tests/InlineTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Yaml\Tests; +use PHPUnit\Framework\TestCase; use Symfony\Component\Yaml\Inline; -class InlineTest extends \PHPUnit_Framework_TestCase +class InlineTest extends TestCase { /** * @dataProvider getTestsForParse @@ -192,27 +193,42 @@ public function testParseUnquotedAsteriskFollowedByAComment() /** * @group legacy - * @dataProvider getReservedIndicators + * @expectedDeprecation Not quoting the scalar "@foo " starting with "@" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0. * throws \Symfony\Component\Yaml\Exception\ParseException in 3.0 */ - public function testParseUnquotedScalarStartingWithReservedIndicator($indicator) + public function testParseUnquotedScalarStartingWithReservedAtIndicator() { - Inline::parse(sprintf('{ foo: %sfoo }', $indicator)); + Inline::parse('{ foo: @foo }'); } - public function getReservedIndicators() + /** + * @group legacy + * @expectedDeprecation Not quoting the scalar "`foo " starting with "`" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0. + * throws \Symfony\Component\Yaml\Exception\ParseException in 3.0 + */ + public function testParseUnquotedScalarStartingWithReservedBacktickIndicator() + { + Inline::parse('{ foo: `foo }'); + } + + /** + * @group legacy + * @expectedDeprecation Not quoting the scalar "|foo " starting with "|" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0. + * throws \Symfony\Component\Yaml\Exception\ParseException in 3.0 + */ + public function testParseUnquotedScalarStartingWithLiteralStyleIndicator() { - return array(array('@'), array('`')); + Inline::parse('{ foo: |foo }'); } /** * @group legacy - * @dataProvider getScalarIndicators + * @expectedDeprecation Not quoting the scalar ">foo " starting with ">" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0. * throws \Symfony\Component\Yaml\Exception\ParseException in 3.0 */ - public function testParseUnquotedScalarStartingWithScalarIndicator($indicator) + public function testParseUnquotedScalarStartingWithFoldedStyleIndicator() { - Inline::parse(sprintf('{ foo: %sfoo }', $indicator)); + Inline::parse('{ foo: >foo }'); } public function getScalarIndicators() @@ -220,6 +236,24 @@ public function getScalarIndicators() return array(array('|'), array('>')); } + /** + * @dataProvider getDataForIsHash + */ + public function testIsHash($array, $expected) + { + $this->assertSame($expected, Inline::isHash($array)); + } + + public function getDataForIsHash() + { + return array( + array(array(), false), + array(array(1, 2, 3), false), + array(array(2 => 1, 1 => 2, 0 => 3), true), + array(array('foo' => 1, 'bar' => 2), true), + ); + } + public function getTestsForParse() { return array( @@ -426,6 +460,38 @@ public function getTestsForDump() array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))), array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')), + + array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))), ); } + + /** + * @expectedException \Symfony\Component\Yaml\Exception\ParseException + * @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported}. + */ + public function testNotSupportedMissingValue() + { + Inline::parse('{this, is not, supported}'); + } + + public function testVeryLongQuotedStrings() + { + $longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000); + + $yamlString = Inline::dump(array('longStringWithQuotes' => $longStringWithQuotes)); + $arrayFromYaml = Inline::parse($yamlString); + + $this->assertEquals($longStringWithQuotes, $arrayFromYaml['longStringWithQuotes']); + } + + public function testBooleanMappingKeysAreConvertedToStrings() + { + $this->assertSame(array('false' => 'foo'), Inline::parse('{false: foo}')); + $this->assertSame(array('true' => 'foo'), Inline::parse('{true: foo}')); + } + + public function testTheEmptyStringIsAValidMappingKey() + { + $this->assertSame(array('' => 'foo'), Inline::parse('{ "": foo }')); + } } diff --git a/windwalker/vendor/symfony/yaml/Tests/ParseExceptionTest.php b/windwalker/vendor/symfony/yaml/Tests/ParseExceptionTest.php index e4eb9c9..4f01ab9 100644 --- a/windwalker/vendor/symfony/yaml/Tests/ParseExceptionTest.php +++ b/windwalker/vendor/symfony/yaml/Tests/ParseExceptionTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Yaml\Tests; +use PHPUnit\Framework\TestCase; use Symfony\Component\Yaml\Exception\ParseException; -class ParseExceptionTest extends \PHPUnit_Framework_TestCase +class ParseExceptionTest extends TestCase { public function testGetMessage() { diff --git a/windwalker/vendor/symfony/yaml/Tests/ParserTest.php b/windwalker/vendor/symfony/yaml/Tests/ParserTest.php index 8fea5e8..2c3a6e0 100644 --- a/windwalker/vendor/symfony/yaml/Tests/ParserTest.php +++ b/windwalker/vendor/symfony/yaml/Tests/ParserTest.php @@ -11,11 +11,13 @@ namespace Symfony\Component\Yaml\Tests; +use PHPUnit\Framework\TestCase; use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Parser; -class ParserTest extends \PHPUnit_Framework_TestCase +class ParserTest extends TestCase { + /** @var Parser */ protected $parser; protected function setUp() @@ -189,6 +191,22 @@ public function getBlockChompingTests() ); $tests['Literal block chomping clip with multiple trailing newlines'] = array($expected, $yaml); + $yaml = <<<'EOF' +foo: +- bar: | + one + + two +EOF; + $expected = array( + 'foo' => array( + array( + 'bar' => "one\n\ntwo", + ), + ), + ); + $tests['Literal block chomping clip with embedded blank line inside unindented collection'] = array($expected, $yaml); + $yaml = <<<'EOF' foo: | one @@ -421,13 +439,13 @@ public function testBlockLiteralWithLeadingNewlines() public function testObjectSupportEnabled() { - $input = <<assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, false, true), '->parse() is able to parse objects'); - $input = <<baz = 'foobar'; $tests['object-for-map-is-applied-after-parsing'] = array($yaml, $expected); - $yaml = <<array[1]->key = 'two'; $tests['nest-map-and-sequence'] = array($yaml, $expected); - $yaml = <<map->{2} = 'two'; $tests['numeric-keys'] = array($yaml, $expected); - $yaml = << array( + array( + 'b' => array( + array( + 'bar' => 'baz', + ), + ), + ), + 'foo', + ), + 'd' => 'e', + ); + + $this->assertSame($expected, $this->parser->parse($yaml)); + } + + public function testSequenceFollowedByCommentEmbeddedInMapping() + { + $yaml = <<<'EOT' +a: + b: + - c +# comment + d: e +EOT; + $expected = array( + 'a' => array( + 'b' => array('c'), + 'd' => 'e', + ), + ); + + $this->assertSame($expected, $this->parser->parse($yaml)); + } + /** * @expectedException \Symfony\Component\Yaml\Exception\ParseException */ @@ -647,7 +712,7 @@ public function testMappingInASequence() */ public function testScalarInSequence() { - Yaml::parse(<<parser->parse($yaml); - - restore_error_handler(); - - $this->assertCount(1, $deprecations); - $this->assertContains('Using a colon in the unquoted mapping value "bar: baz" in line 1 is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', $deprecations[0]); } public function testColonInMappingValueExceptionNotTriggeredByColonInComment() { - $yaml = << @@ -1021,7 +1072,7 @@ public function getCommentLikeStringInScalarBlockData() $expected = array( 'foo' => array( 'bar' => array( - 'scalar-block' => 'line1 line2>', + 'scalar-block' => "line1 line2>\n", ), 'baz' => array( 'foobar' => null, @@ -1051,7 +1102,7 @@ public function getCommentLikeStringInScalarBlockData() public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks() { - $yaml = <<

A heading

@@ -1063,7 +1114,7 @@ public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks() $this->assertSame( array( - 'test' => << <<<'EOT'

A heading

  • a list
  • may be a good example
EOT @@ -1075,7 +1126,7 @@ public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks() public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks() { - $yaml = <<

A heading

@@ -1087,7 +1138,7 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks() $this->assertSame( array( - 'test' => << <<<'EOT'

A heading

  • a list
  • @@ -1099,6 +1150,108 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks() $this->parser->parse($yaml) ); } + + /** + * @param $lineNumber + * @param $yaml + * @dataProvider parserThrowsExceptionWithCorrectLineNumberProvider + */ + public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yaml) + { + if (method_exists($this, 'expectException')) { + $this->expectException('\Symfony\Component\Yaml\Exception\ParseException'); + $this->expectExceptionMessage(sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber)); + } else { + $this->setExpectedException('\Symfony\Component\Yaml\Exception\ParseException', sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber)); + } + + $this->parser->parse($yaml); + } + + public function parserThrowsExceptionWithCorrectLineNumberProvider() + { + return array( + array( + 4, + <<<'YAML' +foo: + - + # bar + bar: "123", +YAML + ), + array( + 5, + <<<'YAML' +foo: + - + # bar + # bar + bar: "123", +YAML + ), + array( + 8, + <<<'YAML' +foo: + - + # foobar + baz: 123 +bar: + - + # bar + bar: "123", +YAML + ), + array( + 10, + <<<'YAML' +foo: + - + # foobar + # foobar + baz: 123 +bar: + - + # bar + # bar + bar: "123", +YAML + ), + ); + } + + public function testCanParseVeryLongValue() + { + $longStringWithSpaces = str_repeat('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ', 20000); + $trickyVal = array('x' => $longStringWithSpaces); + + $yamlString = Yaml::dump($trickyVal); + $arrayFromYaml = $this->parser->parse($yamlString); + + $this->assertEquals($trickyVal, $arrayFromYaml); + } + + /** + * @expectedException \Symfony\Component\Yaml\Exception\ParseException + * @expectedExceptionMessage Reference "foo" does not exist at line 2 + */ + public function testParserCleansUpReferencesBetweenRuns() + { + $yaml = <<parser->parse($yaml); + + $yaml = <<parser->parse($yaml); + } } class B diff --git a/windwalker/vendor/symfony/yaml/Tests/YamlTest.php b/windwalker/vendor/symfony/yaml/Tests/YamlTest.php index 883ee83..9e776ca 100644 --- a/windwalker/vendor/symfony/yaml/Tests/YamlTest.php +++ b/windwalker/vendor/symfony/yaml/Tests/YamlTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Yaml\Tests; +use PHPUnit\Framework\TestCase; use Symfony\Component\Yaml\Yaml; -class YamlTest extends \PHPUnit_Framework_TestCase +class YamlTest extends TestCase { public function testParseAndDump() { diff --git a/windwalker/vendor/symfony/yaml/Unescaper.php b/windwalker/vendor/symfony/yaml/Unescaper.php index bb33016..1e02cc9 100644 --- a/windwalker/vendor/symfony/yaml/Unescaper.php +++ b/windwalker/vendor/symfony/yaml/Unescaper.php @@ -39,9 +39,9 @@ class Unescaper /** * Unescapes a single quoted string. * - * @param string $value A single quoted string. + * @param string $value A single quoted string * - * @return string The unescaped string. + * @return string The unescaped string */ public function unescapeSingleQuotedString($value) { @@ -51,9 +51,9 @@ public function unescapeSingleQuotedString($value) /** * Unescapes a double quoted string. * - * @param string $value A double quoted string. + * @param string $value A double quoted string * - * @return string The unescaped string. + * @return string The unescaped string */ public function unescapeDoubleQuotedString($value) { diff --git a/windwalker/vendor/symfony/yaml/Yaml.php b/windwalker/vendor/symfony/yaml/Yaml.php index 3743654..6fc4e92 100644 --- a/windwalker/vendor/symfony/yaml/Yaml.php +++ b/windwalker/vendor/symfony/yaml/Yaml.php @@ -73,20 +73,20 @@ public static function parse($input, $exceptionOnInvalidType = false, $objectSup } /** - * Dumps a PHP array to a YAML string. + * Dumps a PHP value to a YAML string. * * The dump method, when supplied with an array, will do its best * to convert the array into friendly YAML. * - * @param array $array PHP array + * @param mixed $input The PHP value * @param int $inline The level where you switch to inline YAML - * @param int $indent The amount of spaces to use for indentation of nested nodes. + * @param int $indent The amount of spaces to use for indentation of nested nodes * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise * @param bool $objectSupport true if object support is enabled, false otherwise * - * @return string A YAML string representing the original PHP array + * @return string A YAML string representing the original PHP value */ - public static function dump($array, $inline = 2, $indent = 4, $exceptionOnInvalidType = false, $objectSupport = false) + public static function dump($input, $inline = 2, $indent = 4, $exceptionOnInvalidType = false, $objectSupport = false) { if ($indent < 1) { throw new \InvalidArgumentException('The indentation must be greater than zero.'); @@ -95,6 +95,6 @@ public static function dump($array, $inline = 2, $indent = 4, $exceptionOnInvali $yaml = new Dumper(); $yaml->setIndentation($indent); - return $yaml->dump($array, $inline, 0, $exceptionOnInvalidType, $objectSupport); + return $yaml->dump($input, $inline, 0, $exceptionOnInvalidType, $objectSupport); } } diff --git a/windwalker/vendor/symfony/yaml/phpunit.xml.dist b/windwalker/vendor/symfony/yaml/phpunit.xml.dist index 6bdbea1..7c732f8 100644 --- a/windwalker/vendor/symfony/yaml/phpunit.xml.dist +++ b/windwalker/vendor/symfony/yaml/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/windwalker/windwalker.xml b/windwalker/windwalker.xml index 3a07d9a..f8b2023 100644 --- a/windwalker/windwalker.xml +++ b/windwalker/windwalker.xml @@ -8,8 +8,8 @@ Asika asika32764@gmail.com http://lyrasoft.net - 4.1.6 - 2.1.6 + 4.1.9 + 2.1.9 LIB_WINDWALKER_XML_DESC @@ -38,4 +38,3 @@ https://raw.githubusercontent.com/ventoviro/windwalker-joomla-rad/staging/update.xml -