Skip to content

Commit ff45992

Browse files
committed
bug symfony#24570 [Debug] Fix same vendor detection in class loader (Jean-Beru)
This PR was merged into the 2.7 branch. Discussion ---------- [Debug] Fix same vendor detection in class loader | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Fix about same vendor detection in ClassLoader. Actually, detected namespace for `Doctrine\ORM\Configuration` is `Doctrine\ORM` instead of `Doctrine\`. So deprecations are triggered for classes in same namespace. Commits ------- d2ab0d8 [Debug] Fix same vendor detection in class loader
2 parents 7dac168 + d2ab0d8 commit ff45992

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,11 @@ public function loadClass($class)
203203
} elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
204204
self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
205205
} else {
206-
if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) {
206+
if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
207207
$len = 0;
208208
$ns = '';
209209
} else {
210-
switch ($ns = substr($name, 0, $len)) {
211-
case 'Symfony\Bridge\\':
212-
case 'Symfony\Bundle\\':
213-
case 'Symfony\Component\\':
214-
$ns = 'Symfony\\';
215-
$len = strlen($ns);
216-
break;
217-
}
210+
$ns = substr($name, 0, $len);
218211
}
219212
$parent = get_parent_class($class);
220213

0 commit comments

Comments
 (0)