Skip to content

Commit

Permalink
Merge pull request #25 from loadsys/b/emailtransport-fix
Browse files Browse the repository at this point in the history
Fix special key matching.
  • Loading branch information
beporter committed Jul 7, 2015
2 parents 4f43ac9 + 336ab1d commit 5c6ab1a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ The ConfigReadShell devotes about half of its codebase dealing with this for you

The "gotcha" here is that ConfigReadShell has to maintain a static list of Configure keys that are consumed, and how to access them in their new container. **If your app consumes a non-standard Configure key during bootstrapping, you will not be able to obtain it from the ConfigReadShell.**

An additionally exception is `EmailTransport`, which doesn't have a way of enumerating the named configs it is storing. Basically: `EmailTransport.default` will work, but just `EmailTransport` will not. (This caveat will no longer be an issue if cakephp/cakephp#6969 is merged.)


## Contributing

Expand Down
7 changes: 3 additions & 4 deletions src/Shell/ConfigReadShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected function configRead($key) {
protected function specialKey($search) {
$callable = false;
foreach ($this->specialKeys as $key => $call) {
if (strpos($search, $key) === 0) {
if (strpos("{$search}.", "{$key}.") === 0) {
$callable = $call;
}
}
Expand Down Expand Up @@ -281,11 +281,10 @@ protected function fetchSpecial($special) {
if (isset($special['arg'])) {
$set = call_user_func($special['callable'], $special['arg']);
} else {
$allConfigCallable = preg_replace(
'/::config$/',
$allConfigCallable = str_replace(
'::config',
'::configured',
$special['callable'],
-1,
$replaceCount
);

Expand Down

0 comments on commit 5c6ab1a

Please sign in to comment.