Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02da7da

Browse files
committed
merged branch fabpot/deic-fix (PR #7333)
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #7333). Commits ------- 6992a9e [DependencyInjection] fixed id case when setting a service (also slightly enhanced an error message) Discussion ---------- [DependencyInjection] fixed id case when setting a service (also slightly enhanced an error message) | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a
2 parents cf29581 + 639c30c commit 02da7da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,15 @@ public function getScopeChildren()
347347
*/
348348
public function set($id, $service, $scope = self::SCOPE_CONTAINER)
349349
{
350+
$id = strtolower($id);
351+
350352
if ($this->isFrozen()) {
351353
// setting a synthetic service on a frozen container is alright
352354
if (!isset($this->definitions[$id]) || !$this->definitions[$id]->isSynthetic()) {
353-
throw new BadMethodCallException('Setting service on a frozen container is not allowed');
355+
throw new BadMethodCallException(sprintf('Setting service "%s" on a frozen container is not allowed.', $id));
354356
}
355357
}
356358

357-
$id = strtolower($id);
358-
359359
unset($this->definitions[$id], $this->aliases[$id]);
360360

361361
parent::set($id, $service, $scope);

0 commit comments

Comments
 (0)