Commit Graph

108 Commits

Author SHA1 Message Date
Bizley
a6dba47963 Fix #18590: Fix yii\web\UrlManager to instantiate cache only when it's actually needed 2021-04-10 13:02:23 +03:00
Bizley
03befccd48 Fix #18487: Allow creating URLs for non-GET-verb rules 2021-01-26 14:47:53 +03:00
Alexander Makarov
fbd7eded2d Bug #17933: Log warning instead of erroring when URLManager is unable to initialize cache 2020-03-26 23:21:35 +03:00
Robert Korulczyk
ec089fea5a Fix #16721: Use Instance::ensure() to initialize UrlManager::$cache 2020-02-23 16:02:27 +03:00
pdynarowski
c776cf6240 Update UrlManager.php (#17102)
change >>'POST <controller:[\w-]+>s' => '<controller>/create'<< to >>'POST <controller:[\w-]+>' => '<controller>/create'<<
In POST we don't have 's' so  '<controller>/create but not '<controller>s/create
2019-02-05 23:08:32 +03:00
Vladimir Reznichenko
1a74b3d4f8 [minor] SCA with Php Inspections (EA Ultimate) (#15871)
* Php Inspections (EA Ultimate): use type casting where applicable

* Php Inspections (EA Ultimate): use constants where applicable

* Php Inspections (EA Ultimate): CS

* Php Inspections (EA Ultimate): address some of one-time used variables

* Php Inspections (EA Ultimate): address some of performance-related findings

* Php Inspections (EA Ultimate): address some of performance-related findings

* Php Inspections (EA Ultimate): revert a constant usage

* Php Inspections (EA Ultimate): revert sequential assignments

* Php Inspections (EA Ultimate): build is green again

* Php Inspections (EA Ultimate): revert array_merge tweaks

* Php Inspections (EA Ultimate): revert BC-incompatible one-time used variable tweak

* Update description [skip ci]

* Php Inspections (EA Ultimate): CS
2018-03-12 01:37:19 +03:00
Carsten Brandt
ef8f6172bb Added a note about URLManager cache duration
https://github.com/yiisoft/yii2/pull/13426#issuecomment-366078957
issue #13426
2018-02-16 04:34:38 +01:00
SilverFire - Dmitry Naumenko
2e8b6e5c80 Added ruleConfig to UrlManager::setBuiltRulesCache() to fix tests 2018-02-16 00:12:14 +02:00
SilverFire - Dmitry Naumenko
9323817a53 Refactored code, added tests 2018-02-15 23:14:52 +02:00
SilverFire - Dmitry Naumenko
a2f9ff8aac Merge branch 'master' into yuriystovbur-13425-fix-url-rules-cache 2018-02-15 21:52:25 +02:00
Brandon Kelly
e6f5c46cdc Fixes #15633: Deprecate some things going away/changing in 2.1
- Deprecated `yii\base\BaseObject::className()` in favor of native PHP syntax `::class`, which does not trigger autoloading
- Deprecated XCache and Zend data cache support as caching backends
- Deprecated `yii\BaseYii::powered()` method
- Added `yii\base\InvalidArgumentException` and deprecated `yii\base\InvalidParamException`
- Added `yii\BaseYii::debug()` and deprecated `yii\BaseYii::trace()`
2018-02-11 01:48:29 +03:00
Yuriy Stovbur
87369f4e58 Conflict resolved 2017-11-03 19:01:22 +00:00
Robert Korulczyk
5a8c3d537b Enable phpdoc_summary rule in php-cs-fixer config (#14675)
* Enable `phpdoc_summary` rule in php-cs-fixer config.

* Fix case in "PHPDoc".
2017-08-21 11:19:35 +02:00
Robert Korulczyk
1501c659ac Add empty lines before return statements. (#14682) [skip ci] 2017-08-21 01:58:49 +03:00
Dmitry Dorogin
f7fb7cdd87 Fixes #14022: Added posibility to use aliases in yii\web\UrlManager::setBaseUrl() (#14540) 2017-07-31 13:32:08 +02:00
Dmitry Dorogin
6d2e0aff82 Fixes #14406: Fixed caching rules in yii\web\UrlManager with different ruleConfig configuration 2017-07-19 23:45:03 +03:00
Robert Korulczyk
fe8a0a6a2e Enable no_useless_else rule in php-cs-fixer (#14420) 2017-07-10 11:26:21 +03:00
SilverFire - Dmitry Naumenko
cb53b2feec Fixes #14081: Added yii\caching\CacheInterface to make custom cache extensions adoption easier 2017-06-11 19:18:33 +03:00
Robert Korulczyk
daa8b67c7b Fixes #13350, #14094, #11288
- Bug #13350: Fixed bug with incorrect caching of `yii\web\UrlRule::createUrl()` results in `yii\web\UrlManager`.
- Bug #14094: Fixed bug when single `yii\web\UrlManager::createUrl()` call my result multiple calls of `yii\web\UrlRule::createUrl()` for the same rule.
- Enh #11288: Added support for caching of `yii\web\UrlRule::createUrl()` results in `yii\web\UrlManager` for rules with defaults.
2017-05-10 12:30:43 +03:00
Carsten Brandt
e82b40abee avoid duplicate slashes on empty values
fixes #13522
close #13525
2017-02-08 09:41:04 +01:00
Carsten Brandt
c19b2f7dc8 release version 2.0.11 2017-02-01 17:46:29 +01:00
Alexander Makarov
f9e83008f4 Prefer strpos to substr 2017-01-31 13:42:37 +01:00
ErickSkrauch
c641513583 Implementation of support UrlRule with relative host definition
close #12697
fixes #12691
2017-01-31 13:42:31 +01:00
Carsten Brandt
8faedcbd7c Refactored UrlManagerTest to cover more use cases
UrlManager is a complex class with a large bunch of options that needs
to be tested
and we had a few regressions in the past even though there are already a
lot of tests
covering it. Test coverage measured by lines does not help us determine
how good it is tested,
we need test coverage for every major path through the code.

I have refactored the UrlManager tests to reflect the different options
and cases to
have a better overview of which cases are covered and which are not.

UrlManager has two main operation modes:

- "default" url format, which is the simple case. These are covered by
  methods in `UrlManagerTest`.

- "pretty" url format. This is the complex case, which involves UrlRules
  and url parsing.
  I have created two separate classes for this case:
  Url creation for "pretty" url format is covered by
`UrlManagerCreateUrlTest`.
  Url parsing for "pretty" url format is covered by
`UrlManagerParseUrlTest`.

Each of the test classes have a `getUrlManager` method that creates a
UrlManager instance
with a specific configuration and certain variations in options.
It is also tested that options that are not relevant in a certain
operation mode have no effect on the result.

To make sure to not remove tests that have existed before, here is a map
of where code has been moved.
The following test methods existed in the [old test
class](4187718c14/tests/framework/web/UrlManagerTest.php):

- `testCreateUrl()` split between UrlManagerTest and
  UrlManagerCreateUrlTest variations should all be covered by
`variationsProvider()`.
- `testCreateUrlWithNullParams()` covered by UrlManagerCreateUrlTest by
  `testWithNullParams()`
- `testCreateUrlWithEmptyPattern()`
- `testCreateAbsoluteUrl()` covered in UrlManagerCreateUrlTest by new
  tests via `variationsProvider()`.
- `testCreateAbsoluteUrlWithSuffix()` covered in UrlManagerCreateUrlTest
  by `testAbsolutePatterns`.

- `testParseRequest()` covered by UrlManagerParseUrlTest, UrlNormalizer
  related parts moved to UrlNormalizerTest.
- `testParseRESTRequest()` moved to UrlManagerParseUrlTest
- `testHash()` covered in different tests in UrlManagerCreateUrlTest.
- `testMultipleHostsRules($host)` kept as is.

Before:

    $ vendor/bin/phpunit tests/framework/web/UrlManagerTest.php
    ...
    OK (12 tests, 89 assertions)

After:

    $ vendor/bin/phpunit tests/framework/web/UrlManager*.php
    ...
    OK (72 tests, 648 assertions)
2017-01-31 02:38:35 +01:00
Dmitriy Bashkarev
be4ebdd049 Fixes #13134: Added logging URL rules (bashkarev) 2017-01-27 19:03:45 +03:00
Yuriy Stovbur
46e7faddd0 Modify URL Rules caching #13425 2017-01-23 17:42:23 +00:00
Yuriy Stovbur
6de6e0f895 Cache dynamically added rules with yii\web\UrlManager::addRules() #13425 2017-01-22 17:33:59 +00:00
Robert Korulczyk
2d91723934 Add support for creating protocol-relative URLs.
Improve phpdoc for protocol-relative URL creation.
Remove useless `is_string()` check.
2016-11-29 09:53:51 +02:00
Robert Korulczyk
4aa935e69e Fixes #12055: Changed boolean to bool and integer to int in phpdoc 2016-11-07 02:51:39 +03:00
Boudewijn Vahrmeijer
32f4dc8997 Fixes #5385: links created from classes to corresponding guide articles (#12920) 2016-11-04 18:55:14 +03:00
Klimov Paul
7ca2260702 UrlManager::normalizer creation fixed 2016-10-04 17:02:57 +03:00
Carsten Brandt
ee8a8e90f8 update urlnormalizer docs 2016-09-15 14:52:32 +02:00
Klimov Paul
bda1dbe004 Fix unit test 2016-09-13 12:33:07 +03:00
Klimov Paul
821f035c90 UrlManager::normalizer disabled by default 2016-09-13 12:21:40 +03:00
Robert Korulczyk
8142de23d4 Improve normalizer for URL manager 2016-08-30 21:25:23 +02:00
Cronfy
a7f63b6da3 Add normalizer for URL manager. 2016-08-30 21:22:58 +02:00
Carsten Brandt
731769241b release version 2.0.8 2016-04-28 16:50:20 +02:00
Juuso Leinonen
396bd9f714 Fixes #10309: Extracted yii\web\UrlManager rule cache key into $cacheKey protected property 2016-04-27 00:58:12 +03:00
Darking
f75f453ec4 Fixes #10475: Extracted getUrlFromCache() and setRuleToCache() protected methods from yii\web\UrlManager::createUrl() 2016-04-27 00:54:30 +03:00
Carsten Brandt
9c1fa3f745 allow resetting properties in UrlManager, same as Request
fixes #11336
2016-04-21 14:07:09 +02:00
Alexander Makarov
d3b5f4a284 Fixes #3656: Encode / in "r" query parameter in docs as it really is 2016-03-15 21:52:41 +03:00
Klimov Paul
e4d9ed5182 code style fix 2016-03-09 10:17:41 +02:00
Sam Mousa
c4e782725c Fixed cache key collision in yii\web\UrlManager::createUrl()
Closes #10935
2016-03-09 00:01:31 +02:00
Andrew Nester
fecd4dcfa5 10739 - Multiple slashes at the end of route should not be accepted as valid url 2016-02-05 16:38:49 +03:00
Ruslan Bat
4a1a0fb4d8 FIX rule for camelCase controllerName
<controller:\w+>s
if use this variant of rule  you cant get controller with camelCase name as  camel-case
2015-12-09 23:57:01 +02:00
SilverFire - Dmitry Naumenko
cd87d67f34 Global DOCS update: ~~~ replaced with ``` 2015-12-02 23:15:28 +02:00
bpteam
703f374a85 Fixes #9596: Fixed \yii\web\UrlManager::createAbsoluteUrl(['site/index', '#' => 'testHash']) losing hash 2015-09-05 11:40:45 +03:00
Carsten Brandt
854e186210 fixed caching issue with UrlManager::createUrl
this fix will skip the cache in case we encounter a situation which can
not easily be cached.

fixes #9091
2015-08-03 00:31:59 +02:00
Qiang Xue
ebc089e6c2 Fixes #8194: Caching of the matched rules added to yii\web\UrlManager::createUrl() 2015-05-03 22:03:42 -04:00
Carsten Brandt
792746883e urlManager: ensure route is trimmed by / on empty pattern
fixes #6717
2015-01-01 17:06:12 +01:00