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.7 branch.
Discussion
----------
[DI] Check service IDs are valid
Based on symfony#87
Commits
-------
0671884f41 [DI] Check service IDs are valid
@@ -598,6 +598,9 @@ private function addService($id, Definition $definition)
598
598
* Gets the $public '$id'$shared service.
599
599
*
600
600
* $return
601
+
EOF;
602
+
$code = str_replace('*/', '', $code).<<<EOF
603
+
601
604
*/
602
605
{$visibility} function get{$this->camelize($id)}Service($lazyInitialization)
603
606
{
@@ -609,15 +612,15 @@ private function addService($id, Definition $definition)
609
612
if (!in_array($scope, array(ContainerInterface::SCOPE_CONTAINER, ContainerInterface::SCOPE_PROTOTYPE))) {
610
613
$code .= <<<EOF
611
614
if (!isset(\$this->scopedServices['$scope'])) {
612
-
throw new InactiveScopeException('$id', '$scope');
615
+
throw new InactiveScopeException({$this->export($id)}, '$scope');
613
616
}
614
617
615
618
616
619
EOF;
617
620
}
618
621
619
622
if ($definition->isSynthetic()) {
620
-
$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);
623
+
$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));
621
624
} else {
622
625
$code .=
623
626
$this->addServiceInclude($definition).
@@ -691,10 +694,11 @@ private function addServiceSynchronizer($id, Definition $definition)
0 commit comments