Skip to content

Commit

Permalink
fix: php8 Compilation failed: unrecognized character
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed May 1, 2021
1 parent e658da8 commit cbd4ba5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/aop/src/Aop.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use function count;
use function explode;
use function preg_match;
use function preg_quote;
use function strpos;

/**
* Class AopRegister
Expand Down Expand Up @@ -161,6 +163,12 @@ private static function isExecution(string $class, string $method, array $execut
// Class
[$executionClass, $executionMethod] = $executionAry;

// fix: php8 Compilation failed: unrecognized character follows \
if (strpos($executionClass, '\\\\') === false) {
// convert 'SwoftTest\Component\Testing\Aop\ZeroAop' to 'SwoftTest\\Component\\Testing\\Aop\\ZeroAop'
$executionClass = preg_quote($executionClass);
}

// Class reg
$classReg = '/' . $executionClass . '/';

Expand Down

0 comments on commit cbd4ba5

Please sign in to comment.