Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request zendframework/zendframework#1985 from weierophinne…
Browse files Browse the repository at this point in the history
…y/feature/controller-loader-security

Feature/controller loader security
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/AbstractPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ abstract class AbstractPluginManager extends ServiceManager implements ServiceLo
*/
protected $allowOverride = true;

/**
* Whether or not to auto-add a class as an invokable class if it exists
*
* @var bool
*/
protected $autoAddInvokableClass = true;

/**
* @var mixed Options to use when creating an instance
*/
Expand Down Expand Up @@ -93,7 +100,7 @@ abstract public function validatePlugin($plugin);
public function get($name, $options = array(), $usePeeringServiceManagers = true)
{
// Allow specifying a class name directly; registers as an invokable class
if (!$this->has($name) && class_exists($name)) {
if (!$this->has($name) && $this->autoAddInvokableClass && class_exists($name)) {
$this->setInvokableClass($name, $name);
}

Expand Down
1 change: 1 addition & 0 deletions src/ServiceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ public function create($name)
$cName = $this->canonicalizeName($rName);
}


if (isset($this->factories[$cName])) {
$instance = $this->createFromFactory($cName, $rName);
}
Expand Down

0 comments on commit d95b25a

Please sign in to comment.