Fixed bug that method ComponentTagCompiler::escapeSingleQuotesOutsideOfPhpBlocks() cannot work. (#4910)

This commit is contained in:
Wisp X 2022-07-08 11:55:04 +08:00 committed by GitHub
parent 8b67301dfb
commit 3f10e2ab33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -119,3 +119,4 @@ composer analyse
- [#4854](https://github.com/hyperf/hyperf/pull/4854) Fixed bug that the `socket-io` client always reconnect when using coroutine style server.
- [#4885](https://github.com/hyperf/hyperf/pull/4885) Fixed bug that `ProxyTrait::__getParamsMap` can not work when using trait alias.
- [#4892](https://github.com/hyperf/hyperf/pull/4892) [#4895](https://github.com/hyperf/hyperf/pull/4895) Fixed bug that `RedisAdapter::mixSubscribe` cannot work cased by redis prefix when using `socketio-server`.
- [#4910](https://github.com/hyperf/hyperf/pull/4910) Fixed bug that method `ComponentTagCompiler::escapeSingleQuotesOutsideOfPhpBlocks()` cannot work.

View File

@ -481,14 +481,8 @@ class ComponentTagCompiler
*/
protected function escapeSingleQuotesOutsideOfPhpBlocks(string $value): string
{
return collect(\PhpToken::tokenize($value))->map(function ($token) {
if (! is_array($token)) {
return $token;
}
return $token[0] === T_INLINE_HTML
? str_replace("'", "\\'", $token[1])
: $token[1];
return collect(\PhpToken::tokenize($value))->map(function (\PhpToken $token) {
return $token->id === T_INLINE_HTML ? str_replace("'", "\\'", $token->text) : $token->text;
})->implode('');
}