You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
security #cve-2019-10910 [DI] Check service IDs are valid (nicolas-grekas)
This PR was merged into the 2.8 branch.
Discussion
----------
[DI] Check service IDs are valid
Based on #87
Commits
-------
7fdfeefdfb [DI] Check service IDs are valid
@@ -609,6 +609,9 @@ private function addService($id, Definition $definition)
609
609
* Gets the $public '$id'$shared$autowired service.
610
610
*
611
611
* $return
612
+
EOF;
613
+
$code = str_replace('*/', '', $code).<<<EOF
614
+
612
615
*/
613
616
{$visibility} function get{$this->camelize($id)}Service($lazyInitialization)
614
617
{
@@ -620,15 +623,15 @@ private function addService($id, Definition $definition)
620
623
if (!\in_array($scope, array(ContainerInterface::SCOPE_CONTAINER, ContainerInterface::SCOPE_PROTOTYPE))) {
621
624
$code .= <<<EOF
622
625
if (!isset(\$this->scopedServices['$scope'])) {
623
-
throw new InactiveScopeException('$id', '$scope');
626
+
throw new InactiveScopeException({$this->export($id)}, '$scope');
624
627
}
625
628
626
629
627
630
EOF;
628
631
}
629
632
630
633
if ($definition->isSynthetic()) {
631
-
$code .= sprintf(" throw new RuntimeException('You have requested a synthetic service (\"%s\"). The DIC does not know how to construct this service.');\n }\n", $id);
634
+
$code .= sprintf(" throw new RuntimeException(%s);\n }\n", var_export("You have requested a synthetic service (\"$id\"). The DIC does not know how to construct this service.", true));
0 commit comments