Skip to content

Commit

Permalink
Merge pull request #4 from bzeron/master
Browse files Browse the repository at this point in the history
fix ltrim error
  • Loading branch information
sh7ning authored Feb 6, 2020
2 parents e284240 + 2983b8c commit 57b43e2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Basic/Ctx.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ protected function init()
*/
final protected function loadC($class, ...$args)
{
if (! empty($this->modName)) {
$childClassPrefix = '\\' . $this->namespace . '\Service\\' . $this->modName . '\\Child\\';
$class = ltrim($class, $childClassPrefix);
$className = $childClassPrefix . $class;
if (!empty($this->modName)) {
$childClassPrefix = $this->namespace . '\\Service\\' . $this->modName . '\\Child';
if (strpos($class, $childClassPrefix) === 0) {
$className = $class;
} else {
$className = $childClassPrefix . '\\' . $class;
}

$subObj = new $className(...$args); //since php 5.6
if ($subObj instanceof self) {
Expand Down

0 comments on commit 57b43e2

Please sign in to comment.