Navigation Menu

Skip to content

Commit

Permalink
Fixed to account for keys including numeric values above 9
Browse files Browse the repository at this point in the history
  • Loading branch information
lilHermit committed Aug 7, 2017
1 parent a33a035 commit c956a92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/View/Form/ArrayContext.php
Expand Up @@ -299,6 +299,6 @@ public function error($field)
*/
protected function stripNesting($field)
{
return preg_replace('/\.\d\./', '.', $field);
return preg_replace('/\.\d*\./', '.', $field);
}
}
3 changes: 2 additions & 1 deletion tests/TestCase/View/Form/ArrayContextTest.php
Expand Up @@ -185,7 +185,8 @@ public function testValDefault()

$this->assertEquals('Default value', $context->val('title'));
$this->assertEquals('common1', $context->val('users.0.tags'));
$this->assertEquals('common2', $context->val('users.0.9tags'));
$this->assertEquals('common1', $context->val('users.99.tags'));
$this->assertEquals('common2', $context->val('users.9.9tags'));
$result = $context->val('title', ['default' => 'explicit default']);
$this->assertEquals('explicit default', $result);
}
Expand Down

0 comments on commit c956a92

Please sign in to comment.