ComposerUpdate

This commit is contained in:
Anyon 2020-05-27 13:53:27 +08:00
parent 53a48bce3a
commit 4b8d70d7b3
8 changed files with 53 additions and 40 deletions

10
composer.lock generated
View File

@ -223,16 +223,16 @@
}, },
{ {
"name": "opis/closure", "name": "opis/closure",
"version": "3.5.2", "version": "3.5.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/opis/closure.git", "url": "https://github.com/opis/closure.git",
"reference": "2e3299cea6f485ca64d19c540f46d7896c512ace" "reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/2e3299cea6f485ca64d19c540f46d7896c512ace", "url": "https://api.github.com/repos/opis/closure/zipball/cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
"reference": "2e3299cea6f485ca64d19c540f46d7896c512ace", "reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -286,7 +286,7 @@
"serialization", "serialization",
"serialize" "serialize"
], ],
"time": "2020-05-21T20:09:36+00:00" "time": "2020-05-25T09:32:45+00:00"
}, },
{ {
"name": "psr/cache", "name": "psr/cache",

View File

@ -30,6 +30,8 @@ ThinkAdmin 非常适用快速二次开发,默认集成 微信开发组件,
本地开发命令`php think run`,使用`http://127.0.0.1:8000`访问项目。 本地开发命令`php think run`,使用`http://127.0.0.1:8000`访问项目。
官方地址及开发指南https://thinkadmin.top
PHP 开发技术交流( QQ 群 513350915 PHP 开发技术交流( QQ 群 513350915
[![PHP微信开发群 (SDK)](http://pub.idqqimg.com/wpa/images/group.png)](http://shang.qq.com/wpa/qunwpa?idkey=ae25cf789dafbef62e50a980ffc31242f150bc61a61164458216dd98c411832a) [![PHP微信开发群 (SDK)](http://pub.idqqimg.com/wpa/images/group.png)](http://shang.qq.com/wpa/qunwpa?idkey=ae25cf789dafbef62e50a980ffc31242f150bc61a61164458216dd98c411832a)

View File

@ -222,17 +222,17 @@
}, },
{ {
"name": "opis/closure", "name": "opis/closure",
"version": "3.5.2", "version": "3.5.3",
"version_normalized": "3.5.2.0", "version_normalized": "3.5.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/opis/closure.git", "url": "https://github.com/opis/closure.git",
"reference": "2e3299cea6f485ca64d19c540f46d7896c512ace" "reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/2e3299cea6f485ca64d19c540f46d7896c512ace", "url": "https://api.github.com/repos/opis/closure/zipball/cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
"reference": "2e3299cea6f485ca64d19c540f46d7896c512ace", "reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -248,7 +248,7 @@
"jeremeamia/superclosure": "^2.0", "jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
}, },
"time": "2020-05-21T20:09:36+00:00", "time": "2020-05-25T09:32:45+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {

View File

@ -1,5 +1,10 @@
CHANGELOG CHANGELOG
--------- ---------
### v3.5.3, 2020.05.25
- Improved parser
- The class scope optimisation is no longer used. We always bind now to the closure's original class scope.
If the class scope was `null`, then the optimisation didn't work as expected and kept the `SerializableClosure` scope.
### v3.5.2, 2020.05.21 ### v3.5.2, 2020.05.21

View File

@ -26,12 +26,17 @@ function serialize($data)
* Unserialize * Unserialize
* *
* @param $data * @param $data
* @param $options
* @return mixed * @return mixed
*/ */
function unserialize($data) function unserialize($data, array $options = null)
{ {
SerializableClosure::enterContext(); SerializableClosure::enterContext();
if ($options === null || PHP_MAJOR_VERSION < 7) {
$data = \unserialize($data); $data = \unserialize($data);
} else {
$data = \unserialize($data, $options);
}
SerializableClosure::unwrapClosures($data); SerializableClosure::unwrapClosures($data);
SerializableClosure::exitContext(); SerializableClosure::exitContext();
return $data; return $data;

View File

@ -107,6 +107,8 @@ class ReflectionClosure extends ReflectionFunction
$fn = PHP_MINOR_VERSION === 4; $fn = PHP_MINOR_VERSION === 4;
} }
$class_keywords = ['self', 'static', 'parent'];
$ns = $this->getNamespaceName(); $ns = $this->getNamespaceName();
$nsf = $ns == '' ? '' : ($ns[0] == '\\' ? $ns : '\\' . $ns); $nsf = $ns == '' ? '' : ($ns[0] == '\\' ? $ns : '\\' . $ns);
@ -207,11 +209,6 @@ class ReflectionClosure extends ReflectionFunction
$state = 'closure'; $state = 'closure';
} }
break; break;
case '=':
$code .= $token;
$lastState = 'closure_args';
$state = 'ignore_next';
break;
case ':': case ':':
$code .= ':'; $code .= ':';
$state = 'return'; $state = 'return';
@ -331,13 +328,13 @@ class ReflectionClosure extends ReflectionFunction
$code .= $_namespace; $code .= $_namespace;
break; break;
case T_CLASS_C: case T_CLASS_C:
$code .= $_class; $code .= $inside_anonymous ? $token[1] : $_class;
break; break;
case T_FUNC_C: case T_FUNC_C:
$code .= $_function; $code .= $inside_anonymous ? $token[1] : $_function;
break; break;
case T_METHOD_C: case T_METHOD_C:
$code .= $_method; $code .= $inside_anonymous ? $token[1] : $_method;
break; break;
case T_COMMENT: case T_COMMENT:
if (substr($token[1], 0, 8) === '#trackme') { if (substr($token[1], 0, 8) === '#trackme') {
@ -359,7 +356,9 @@ class ReflectionClosure extends ReflectionFunction
$code .= $token[1]; $code .= $token[1];
break; break;
case T_STATIC: case T_STATIC:
if (!$inside_anonymous) {
$isUsingScope = true; $isUsingScope = true;
}
$code .= $token[1]; $code .= $token[1];
break; break;
case T_NS_SEPARATOR: case T_NS_SEPARATOR:
@ -384,6 +383,7 @@ class ReflectionClosure extends ReflectionFunction
$lastState = 'closure'; $lastState = 'closure';
break; break;
case T_INSTANCEOF: case T_INSTANCEOF:
case T_INSTEADOF:
$code .= $token[1]; $code .= $token[1];
$context = 'instanceof'; $context = 'instanceof';
$state = 'id_start'; $state = 'id_start';
@ -501,7 +501,7 @@ class ReflectionClosure extends ReflectionFunction
$open++; $open++;
} }
if($context === 'new' || false !== strpos($id_name, '\\')){ if($context === 'new' || false !== strpos($id_name, '\\')){
if($id_start !== '\\'){ if($id_start !== '\\' && !in_array($id_start_ci, $class_keywords)){
if ($classes === null) { if ($classes === null) {
$classes = $this->getClasses(); $classes = $this->getClasses();
} }
@ -529,7 +529,9 @@ class ReflectionClosure extends ReflectionFunction
case T_DOUBLE_COLON: case T_DOUBLE_COLON:
if($id_start !== '\\') { if($id_start !== '\\') {
if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){ if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){
if (!$inside_anonymous) {
$isUsingScope = true; $isUsingScope = true;
}
} elseif (!($php7 && in_array($id_start_ci, $php7_types))){ } elseif (!($php7 && in_array($id_start_ci, $php7_types))){
if ($classes === null) { if ($classes === null) {
$classes = $this->getClasses(); $classes = $this->getClasses();
@ -546,15 +548,23 @@ class ReflectionClosure extends ReflectionFunction
$state = $token[0] === T_DOUBLE_COLON ? 'ignore_next' : $lastState; $state = $token[0] === T_DOUBLE_COLON ? 'ignore_next' : $lastState;
break; break;
default: default:
if($id_start !== '\\'){ if($id_start !== '\\' && !defined($id_start)){
if($context === 'use' || if($constants === null){
$constants = $this->getConstants();
}
if(isset($constants[$id_start])){
$id_start = $constants[$id_start];
} elseif($context === 'use' ||
$context === 'instanceof' || $context === 'instanceof' ||
$context === 'args' || $context === 'args' ||
$context === 'return_type' || $context === 'return_type' ||
$context === 'extends' $context === 'extends' ||
$context === 'root'
){ ){
if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){ if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){
if (!$inside_anonymous) {
$isUsingScope = true; $isUsingScope = true;
}
} elseif (!($php7 && in_array($id_start_ci, $php7_types))){ } elseif (!($php7 && in_array($id_start_ci, $php7_types))){
if($classes === null){ if($classes === null){
$classes = $this->getClasses(); $classes = $this->getClasses();
@ -566,13 +576,6 @@ class ReflectionClosure extends ReflectionFunction
$id_start = $nsf . '\\' . $id_start; $id_start = $nsf . '\\' . $id_start;
} }
} }
} else {
if($constants === null){
$constants = $this->getConstants();
}
if(isset($constants[$id_start])){
$id_start = $constants[$id_start];
}
} }
} }
$code .= $id_start . $id_name; $code .= $id_start . $id_name;

View File

@ -132,7 +132,7 @@ class SerializableClosure implements Serializable
if($scope = $reflector->getClosureScopeClass()){ if($scope = $reflector->getClosureScopeClass()){
$scope = $scope->name; $scope = $scope->name;
} }
} elseif($reflector->isScopeRequired()) { } else {
if($scope = $reflector->getClosureScopeClass()){ if($scope = $reflector->getClosureScopeClass()){
$scope = $scope->name; $scope = $scope->name;
} }
@ -260,9 +260,7 @@ class SerializableClosure implements Serializable
$this->code['this'] = null; $this->code['this'] = null;
} }
if ($this->code['scope'] !== null || $this->code['this'] !== null) {
$this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']); $this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']);
}
if(!empty($this->code['objects'])){ if(!empty($this->code['objects'])){
foreach ($this->code['objects'] as $item){ foreach ($this->code['objects'] as $item){

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-05-22 11:46:04 // This file is automatically generated at:2020-05-27 13:52:14
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',