-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URL rules and Grid search error #1248
Comments
What is the complete error call stack? |
url rules:
|
This error results from creating an url with nested array parameters. We shoud add a check for array() in UrlRule::291 to fix this. |
yes, nedd a check for array fix to permit the pretty url with grid. |
* master: Fixes #1248: url manager didn't handle array parameters well. travis: speed up composer fixes #1306 fixed travis and composer issue fixed array helper test fixed Sort test some clarification on model docs fixed Sort::params to be retrieved from Request instead of $_GET revokeAll() implementation for PhpManager revokeAll() implementation for DbManager added abstract function revokeAll() indentation fix fixes #1303: Security::decrypt now returns null w/o error when null is passed as $data Added link to new RBAC page added link to forum thread Basic information about RBAC RBAC documentation added revokeAll() test refactored redis AR Query::scalar() Conflicts: .travis.yml
not working jet. if i insert some var it not get errors but i have not a pretty url. if i insert two parameters in url i get an error Url rules:
'operators/<id:\d+>/get/<ViewUserAgenzia[nome_indirizzo]:\w+>/agency/<ViewUserAgenzia[comune]:\w+>/comune'=>'Operators/operators/view', // view Error Warning – yii\base\ErrorException
preg_match(): Compilation failed: two named subpatterns have the same name at offset 87
1. in /var/www/payfolder/vendor/yiisoft/yii2/yii/web/UrlRule.php at line 215
210211212213214215216217218219220
if ($this->host !== null) {
$pathInfo = strtolower($request->getHostInfo()) . '/' . $pathInfo;
}
if (!preg_match($this->pattern, $pathInfo, $matches)) {
return false;
}
foreach ($this->defaults as $name => $value) {
if (!isset($matches[$name]) || $matches[$name] === '') {
$matches[$name] = $value;
2. yii\base\Application::handleError()
3. in /var/www/payfolder/vendor/yiisoft/yii2/yii/web/UrlRule.php – preg_match() at line 215
4. in /var/www/payfolder/vendor/yiisoft/yii2/yii/web/UrlManager.php – yii\web\UrlRule::parseRequest() at line 190
5. in /var/www/payfolder/vendor/yiisoft/yii2/yii/web/Request.php – yii\web\UrlManager::parseRequest() at line 136
6. in /var/www/payfolder/vendor/yiisoft/yii2/yii/web/Application.php – yii\web\Request::resolve() at line 69
7. in /var/www/payfolder/vendor/yiisoft/yii2/yii/base/Application.php – yii\web\Application::handleRequest() at line 288
8. in /var/www/payfolder/frontend/web/index.php – yii\base\Application::run() at line 18
131415161718
require(__DIR__ . '/../config/main.php'),
require(__DIR__ . '/../config/main-local.php')
);
$application = new yii\web\Application($config);
$application->run();
|
Could you show what is |
the line is: 'operators/<id:\d+>/get/<ViewUserAgenzia[nome_indirizzo]:\w+>/agency/<ViewUserAgenzia[comune]:\w+>/comune'=>'Operators/operators/view', // view |
Nope, I'm asking about the value at line 215, not the one you initially set it. They are different. |
it's difficult now reconstruct the line 215 because i create the UrlRule.php dinamically. |
just log a message before line 215... |
this is the log of $this->pattern at line 215 of urlRule.php
|
i think the problem is this.
so i send ViewAgenzia>[nome] and ViewAgenzia[id] |
the generated regex includes |
As @cebe said, you should not use square brackets in the parameter names. Only word characters are allowed. |
i create a grid with filter in a view.
grid and filter work good.
when i enter some dato in filter search, i can see the get string in url bar somthink like this:
http://mysite.com?modelname[field]=value& ecc eccc
this work.
Now i need to change the url rules to display a pretty url.
if i add somthink like this:
'mystring/< modelname[field]\d+ >/cod'=>'controller/view',
i receive an exception:
Warning – yii\base\ErrorException
preg_match() expects parameter 2 to be string, array given
the problem is in the parsing "[]" in Url rules.
I think this need to be solved in the parsing.
The text was updated successfully, but these errors were encountered: