849 Commits

Author SHA1 Message Date
2d28b585a0 Merge branch 'master' into 13614-add-a-failing-test-for-url-rule 2017-04-27 22:07:55 +02:00
94eda9bd52 Add phpdoc. [skip ci] 2017-04-26 20:24:07 +02:00
705dae9964 Fixes #14052: Fixed processing parse errors on PHP 7 since these are instances of \ParseError 2017-04-26 12:56:54 +03:00
6792099bcc Fixes #13689: Fixed handling of errors in closures 2017-04-26 03:34:25 +03:00
339c7663eb Fixes #10346: Fixed "DOMException: Invalid Character Error" in yii\web\XmlResponseFormatter::buildXml() 2017-04-26 02:06:36 +03:00
4af62a6bd7 improve session PHPdoc 2017-04-25 23:02:19 +02:00
8eabff0698 #13975: make documentation of current behaviour more clear [skip ci] 2017-04-16 00:55:35 +03:00
b04ff959ce Fixed misleading docs about encoded URIs [skip ci] 2017-04-07 15:59:59 +03:00
5bbf372f85 cleanup some phpdoc 2017-04-04 10:33:30 +02:00
43edf24123 Eliminated else branches in yii\web\Request 2017-04-02 02:15:39 +03:00
8ae207c3a1 Fixes #13837: Refactored masking of CSRF tokens 2017-04-02 02:10:16 +03:00
a626440761 Reverted #13822, clarified exception descriptions 2017-03-30 16:50:18 +03:00
6da1ec6fb2 Fixes #13845: mt_rand() is not used instead of rand() in yii\captcha\CaptchaAction + minor code improvements 2017-03-24 13:50:13 +03:00
ea75068a92 Fixes #13813: Fixed PHP 7 compatibiltiy by adding support for passing instances of Error to the yii\web\Response::setStatusCodeByException() 2017-03-23 01:20:42 +03:00
7a2f04ae32 Fixes #13822: Fixed yii\web\User::loginRequired() to throw an UnauthorizedHttpException instead of a ForbiddenHttpException 2017-03-23 00:18:39 +03:00
0770863209 Fixes #13820: Add new HTTP status code 451 2017-03-22 13:29:40 +03:00
bc59d5da85 Fixes #13707: Fixed \yii\web\ErrorHandler and \yii\web\ErrorAction not setting correct response code to response object before rendering error view 2017-03-16 12:03:23 +03:00
a6d266405d Fixes #13671: Fixed error handler trace to work correctly with XDebug 2017-03-06 15:24:18 +03:00
0b3c066bd2 Fixes #13695: \yii\web\Response::setStatusCode() method now returns the Response object itself 2017-03-04 18:55:17 +03:00
c8a323af81 Remove UrlRule::$trailingSlashForDefaults property. 2017-03-01 12:12:37 +01:00
a79e4e8128 Merge branch 'master' into 13614-add-a-failing-test-for-url-rule 2017-03-01 12:09:13 +01:00
a182ce57fc Fixes for issues found with Static Code Analysis with Php Inspections (EA Extended) (#13606)
* Php Inspections (EA Extended): language level migration fixes
* Php Inspections (EA Extended): instanceof a trait always return false
* Php Inspections (EA Extended): fixed preg_quote (/ is not escaped by default)
* Php Inspections (EA Extended): fixed a greedy regex
* Php Inspections (EA Extended): refereted instanceof self in a trait
* Php Inspections (EA Extended): revert language level changes in requirements checker
* Php Inspections (EA Extended): revert language level changes in requirements checker
* Php Inspections (EA Extended): more greedy regexes fixed
2017-02-22 17:07:52 +03:00
ecefc2bdfb Fixed typo in CacheSession::destroySession() 2017-02-20 23:13:44 +02:00
f496567735 Fixed yii\web\CacheSession::destroySession() to work correctly when session is not written yet
Fixes #13537
2017-02-20 22:34:40 +02:00
ab36cb29e1 Updated PHPDocs: marked session-handling methods as internal 2017-02-20 22:13:12 +02:00
bf841b926d Additional tests. 2017-02-19 23:19:48 +01:00
8d4a197d19 Fix bug with creating URL in UrlRule with optional params at the beginning of pattern. 2017-02-19 22:51:02 +01:00
5d81af21fb Fix bug with optional params at the beginning of pattern in UrlRule. 2017-02-19 22:26:37 +01:00
323568c2e9 Remove trailing spaces from sources and tests (#13621) [skip ci] 2017-02-19 17:34:22 +03:00
e82b40abee avoid duplicate slashes on empty values
fixes #13522
close #13525
2017-02-08 09:41:04 +01:00
c19b2f7dc8 release version 2.0.11 2017-02-01 17:46:29 +01:00
2c5ab1e07b Used non-regex solution for trimming slashes 2017-01-31 13:42:38 +01:00
f9e83008f4 Prefer strpos to substr 2017-01-31 13:42:37 +01:00
c641513583 Implementation of support UrlRule with relative host definition
close #12697
fixes #12691
2017-01-31 13:42:31 +01:00
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
5609e918de Fixed some malformed @var tags (#13468) [skip ci] 2017-01-30 11:42:52 +03:00
be4ebdd049 Fixes #13134: Added logging URL rules (bashkarev) 2017-01-27 19:03:45 +03:00
37f19a0256 Fixes #13300, #13307, #13310, #13312
- Bug #13300: Allow pjax with "data-pjax" with no value in `yii.js`.
- Bug #13307: Preventing of race conditions in script filter in `yii.js` works incorrectly.
- Bug #13310: Handle relative and absolute URLs coincidence in CSS filter in `yii.js`.
- Bug #13312: `skipOuterContainers` option was incorrectly passed to pjax in `handleAction` in `yii.js`.
- Partially fixes #13299.

Adds tests for #8014, #11921, #10974, #11494, #10358, #10097.
2017-01-25 11:00:13 +03:00
4d7658ed71 Merge branch 'master' of git://github.com/yiisoft/yii2 into 13425-fix-url-rules-cache 2017-01-24 13:13:09 +00:00
eab3489ec7 Reverted #13393: Removed redundant call to yii\helpers\Url::to() in yii\web\Controller::redirect() (reverted from commit e5d169beb8257ba47654275cbee2e98fb910f5d5) 2017-01-24 13:09:57 +03:00
b2267b8442 Merge branch 'master' of git://github.com/yiisoft/yii2 into 13425-fix-url-rules-cache
Modify URL Rules caching #13425
2017-01-23 17:43:10 +00:00
46e7faddd0 Modify URL Rules caching #13425 2017-01-23 17:42:23 +00:00
c73de31a90 Fixed yii\web\MultipartFormDataParser adds an extra newline to every value 2017-01-23 13:18:31 +02:00
cc37cd626f Fixes #12599: Fixed MSSQL fail to work with nvarbinary. Enhanced SQL scripts compatibility with older versions 2017-01-23 10:31:52 +03:00
507cc52658 Allow omit default params on URL creation
Fixes #10970
2017-01-22 22:19:13 +02:00
307252a447 Merge branch 'master' of git://github.com/yiisoft/yii2 into 13425-fix-url-rules-cache
Cache dynamically added rules with `yii\web\UrlManager::addRules()`
2017-01-22 17:34:31 +00:00
6de6e0f895 Cache dynamically added rules with yii\web\UrlManager::addRules() #13425 2017-01-22 17:33:59 +00:00
21faee5504 Fixes #13212: Fixed DbSession::regenerateID() failure when session_regenerate_id() fails 2017-01-22 20:15:36 +03:00
e5d169beb8 Fixes #13393: Removed redundant call to yii\helpers\Url::to() in yii\web\Controller::redirect() 2017-01-22 11:56:52 +03:00
97171a0db7 Fixes #13401: Fixed lack of escaping of request dump at exception screens 2017-01-18 01:05:50 +03:00