Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f8358e

Browse filesBrowse files
committed
[Bridge\ProxyManager] isProxyCandidate() does not take into account interfaces
When using factories it's common best practice to use interface as class name, especially in cases where you know impl can differ. Before this fix ProxyManager did not allow these to be lazy. In our case this has lead several to hard to debug issues on classes we need to mark as lazyi and often a need to add lazy on decorators if there are any or other workarounds. As we have had this issue, and still have on both 2.8 and 3.4 this is opened against 2.8.
1 parent 78d86f8 commit 9f8358e
Copy full SHA for 9f8358e

File tree

2 files changed

+2
-1
lines changed
Filter options

2 files changed

+2
-1
lines changed

‎src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($salt = '')
4444
*/
4545
public function isProxyCandidate(Definition $definition)
4646
{
47-
return $definition->isLazy() && ($class = $definition->getClass()) && class_exists($class);
47+
return $definition->isLazy() && ($class = $definition->getClass()) && (class_exists($class) || interface_exists($class));
4848
}
4949

5050
/**

‎src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public function getProxyCandidates()
8787
$definitions = array(
8888
array(new Definition(__CLASS__), true),
8989
array(new Definition('stdClass'), true),
90+
array(new Definition('Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface'), true),
9091
array(new Definition(uniqid('foo', true)), false),
9192
array(new Definition(), false),
9293
);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.