升级tp6.0.4核心

This commit is contained in:
toogee 2020-10-11 16:52:05 +08:00
parent 13ca055f74
commit 864f5a68fe
87 changed files with 774 additions and 3218 deletions

129
composer.lock generated
View File

@ -152,16 +152,16 @@
}, },
{ {
"name": "league/mime-type-detection", "name": "league/mime-type-detection",
"version": "1.4.0", "version": "1.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/mime-type-detection.git", "url": "https://github.com/thephpleague/mime-type-detection.git",
"reference": "fda190b62b962d96a069fcc414d781db66d65b69" "reference": "ea2fbfc988bade315acd5967e6d02274086d0f28"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/fda190b62b962d96a069fcc414d781db66d65b69", "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ea2fbfc988bade315acd5967e6d02274086d0f28",
"reference": "fda190b62b962d96a069fcc414d781db66d65b69", "reference": "ea2fbfc988bade315acd5967e6d02274086d0f28",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -195,87 +195,20 @@
} }
], ],
"description": "Mime-type detection for Flysystem", "description": "Mime-type detection for Flysystem",
"time": "2020-08-09T10:34:01+00:00" "time": "2020-09-21T18:10:53+00:00"
},
{
"name": "opis/closure",
"version": "3.5.7",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "4531e53afe2fc660403e76fb7644e95998bff7bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/4531e53afe2fc660403e76fb7644e95998bff7bf",
"reference": "4531e53afe2fc660403e76fb7644e95998bff7bf",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.4 || ^7.0"
},
"require-dev": {
"jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.5.x-dev"
}
},
"autoload": {
"psr-4": {
"Opis\\Closure\\": "src/"
},
"files": [
"functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marius Sarca",
"email": "marius.sarca@gmail.com"
},
{
"name": "Sorin Sarca",
"email": "sarca_sorin@hotmail.com"
}
],
"description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
"homepage": "https://opis.io/closure",
"keywords": [
"anonymous functions",
"closure",
"function",
"serializable",
"serialization",
"serialize"
],
"time": "2020-09-06T17:02:15+00:00"
}, },
{ {
"name": "phpmailer/phpmailer", "name": "phpmailer/phpmailer",
"version": "v6.1.7", "version": "v6.1.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git", "url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0" "reference": "917ab212fa00dc6eacbb26e8bc387ebe40993bc1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/917ab212fa00dc6eacbb26e8bc387ebe40993bc1",
"reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", "reference": "917ab212fa00dc6eacbb26e8bc387ebe40993bc1",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -287,6 +220,7 @@
"require": { "require": {
"ext-ctype": "*", "ext-ctype": "*",
"ext-filter": "*", "ext-filter": "*",
"ext-hash": "*",
"php": ">=5.5.0" "php": ">=5.5.0"
}, },
"require-dev": { "require-dev": {
@ -330,7 +264,7 @@
} }
], ],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP", "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"time": "2020-07-14T18:50:27+00:00" "time": "2020-10-09T14:55:58+00:00"
}, },
{ {
"name": "psr/cache", "name": "psr/cache",
@ -603,16 +537,16 @@
}, },
{ {
"name": "topthink/framework", "name": "topthink/framework",
"version": "v6.0.3", "version": "v6.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/framework.git", "url": "https://github.com/top-think/framework.git",
"reference": "b4046fb21e6163ba23a792b694162693dbe71b4b" "reference": "4b252d78562d4a51a501651f837c26cb9d91624f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/framework/zipball/b4046fb21e6163ba23a792b694162693dbe71b4b", "url": "https://api.github.com/repos/top-think/framework/zipball/4b252d78562d4a51a501651f837c26cb9d91624f",
"reference": "b4046fb21e6163ba23a792b694162693dbe71b4b", "reference": "4b252d78562d4a51a501651f837c26cb9d91624f",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -626,7 +560,6 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"league/flysystem": "^1.0", "league/flysystem": "^1.0",
"league/flysystem-cached-adapter": "^1.0", "league/flysystem-cached-adapter": "^1.0",
"opis/closure": "^3.1",
"php": ">=7.1.0", "php": ">=7.1.0",
"psr/container": "~1.0", "psr/container": "~1.0",
"psr/log": "~1.0", "psr/log": "~1.0",
@ -667,7 +600,7 @@
"orm", "orm",
"thinkphp" "thinkphp"
], ],
"time": "2020-06-26T16:03:10+00:00" "time": "2020-09-29T02:19:59+00:00"
}, },
{ {
"name": "topthink/think-captcha", "name": "topthink/think-captcha",
@ -821,16 +754,16 @@
}, },
{ {
"name": "topthink/think-orm", "name": "topthink/think-orm",
"version": "v2.0.33", "version": "v2.0.34",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-orm.git", "url": "https://github.com/top-think/think-orm.git",
"reference": "35ca511a1e4d671b39f7afb4c887703c16ef6957" "reference": "57f9b98895b0ff4ae7b7b75e51456fd8cb8fb629"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/35ca511a1e4d671b39f7afb4c887703c16ef6957", "url": "https://api.github.com/repos/top-think/think-orm/zipball/57f9b98895b0ff4ae7b7b75e51456fd8cb8fb629",
"reference": "35ca511a1e4d671b39f7afb4c887703c16ef6957", "reference": "57f9b98895b0ff4ae7b7b75e51456fd8cb8fb629",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -868,7 +801,7 @@
"database", "database",
"orm" "orm"
], ],
"time": "2020-06-22T14:57:28+00:00" "time": "2020-09-28T08:24:57+00:00"
}, },
{ {
"name": "topthink/think-template", "name": "topthink/think-template",
@ -1224,16 +1157,16 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v4.4.13", "version": "v4.4.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "1bef32329f3166486ab7cb88599cae4875632b99" "reference": "0dc22bdf9d1197467bb04d505355180b6f20bcca"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/1bef32329f3166486ab7cb88599cae4875632b99", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0dc22bdf9d1197467bb04d505355180b6f20bcca",
"reference": "1bef32329f3166486ab7cb88599cae4875632b99", "reference": "0dc22bdf9d1197467bb04d505355180b6f20bcca",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -1303,20 +1236,20 @@
"debug", "debug",
"dump" "dump"
], ],
"time": "2020-08-17T07:31:35+00:00" "time": "2020-09-18T08:35:10+00:00"
}, },
{ {
"name": "topthink/think-trace", "name": "topthink/think-trace",
"version": "v1.3", "version": "v1.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-trace.git", "url": "https://github.com/top-think/think-trace.git",
"reference": "d8da2e39df268ab8775013de699f0c3012e51318" "reference": "9a9fa8f767b6c66c5a133ad21ca1bc96ad329444"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-trace/zipball/d8da2e39df268ab8775013de699f0c3012e51318", "url": "https://api.github.com/repos/top-think/think-trace/zipball/9a9fa8f767b6c66c5a133ad21ca1bc96ad329444",
"reference": "d8da2e39df268ab8775013de699f0c3012e51318", "reference": "9a9fa8f767b6c66c5a133ad21ca1bc96ad329444",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -1356,7 +1289,7 @@
} }
], ],
"description": "thinkphp debug trace", "description": "thinkphp debug trace",
"time": "2020-03-18T07:59:53+00:00" "time": "2020-06-29T05:27:28+00:00"
} }
], ],
"aliases": [], "aliases": [],

View File

@ -7,7 +7,6 @@ $baseDir = dirname($vendorDir);
return array( return array(
'9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php', '9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php',
'538ca81a9a966a6716601ecf48f4eaef' => $vendorDir . '/opis/closure/functions.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',

View File

@ -22,7 +22,6 @@ return array(
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'), 'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
'Opis\\Closure\\' => array($vendorDir . '/opis/closure/src'),
'League\\MimeTypeDetection\\' => array($vendorDir . '/league/mime-type-detection/src'), 'League\\MimeTypeDetection\\' => array($vendorDir . '/league/mime-type-detection/src'),
'League\\Flysystem\\Cached\\' => array($vendorDir . '/league/flysystem-cached-adapter/src'), 'League\\Flysystem\\Cached\\' => array($vendorDir . '/league/flysystem-cached-adapter/src'),
'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'),

View File

@ -8,7 +8,6 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
{ {
public static $files = array ( public static $files = array (
'9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php',
'538ca81a9a966a6716601ecf48f4eaef' => __DIR__ . '/..' . '/opis/closure/functions.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -46,10 +45,6 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
'Psr\\Cache\\' => 10, 'Psr\\Cache\\' => 10,
'PHPMailer\\PHPMailer\\' => 20, 'PHPMailer\\PHPMailer\\' => 20,
), ),
'O' =>
array (
'Opis\\Closure\\' => 13,
),
'L' => 'L' =>
array ( array (
'League\\MimeTypeDetection\\' => 25, 'League\\MimeTypeDetection\\' => 25,
@ -127,10 +122,6 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
array ( array (
0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src', 0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
), ),
'Opis\\Closure\\' =>
array (
0 => __DIR__ . '/..' . '/opis/closure/src',
),
'League\\MimeTypeDetection\\' => 'League\\MimeTypeDetection\\' =>
array ( array (
0 => __DIR__ . '/..' . '/league/mime-type-detection/src', 0 => __DIR__ . '/..' . '/league/mime-type-detection/src',

View File

@ -149,17 +149,17 @@
}, },
{ {
"name": "league/mime-type-detection", "name": "league/mime-type-detection",
"version": "1.4.0", "version": "1.5.0",
"version_normalized": "1.4.0.0", "version_normalized": "1.5.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/mime-type-detection.git", "url": "https://github.com/thephpleague/mime-type-detection.git",
"reference": "fda190b62b962d96a069fcc414d781db66d65b69" "reference": "ea2fbfc988bade315acd5967e6d02274086d0f28"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/fda190b62b962d96a069fcc414d781db66d65b69", "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ea2fbfc988bade315acd5967e6d02274086d0f28",
"reference": "fda190b62b962d96a069fcc414d781db66d65b69", "reference": "ea2fbfc988bade315acd5967e6d02274086d0f28",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -176,7 +176,7 @@
"phpstan/phpstan": "^0.12.36", "phpstan/phpstan": "^0.12.36",
"phpunit/phpunit": "^8.5.8" "phpunit/phpunit": "^8.5.8"
}, },
"time": "2020-08-09T10:34:01+00:00", "time": "2020-09-21T18:10:53+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -196,88 +196,19 @@
], ],
"description": "Mime-type detection for Flysystem" "description": "Mime-type detection for Flysystem"
}, },
{
"name": "opis/closure",
"version": "3.5.7",
"version_normalized": "3.5.7.0",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "4531e53afe2fc660403e76fb7644e95998bff7bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/4531e53afe2fc660403e76fb7644e95998bff7bf",
"reference": "4531e53afe2fc660403e76fb7644e95998bff7bf",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.4 || ^7.0"
},
"require-dev": {
"jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"time": "2020-09-06T17:02:15+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.5.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Opis\\Closure\\": "src/"
},
"files": [
"functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marius Sarca",
"email": "marius.sarca@gmail.com"
},
{
"name": "Sorin Sarca",
"email": "sarca_sorin@hotmail.com"
}
],
"description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
"homepage": "https://opis.io/closure",
"keywords": [
"anonymous functions",
"closure",
"function",
"serializable",
"serialization",
"serialize"
]
},
{ {
"name": "phpmailer/phpmailer", "name": "phpmailer/phpmailer",
"version": "v6.1.7", "version": "v6.1.8",
"version_normalized": "6.1.7.0", "version_normalized": "6.1.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git", "url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0" "reference": "917ab212fa00dc6eacbb26e8bc387ebe40993bc1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/917ab212fa00dc6eacbb26e8bc387ebe40993bc1",
"reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", "reference": "917ab212fa00dc6eacbb26e8bc387ebe40993bc1",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -289,6 +220,7 @@
"require": { "require": {
"ext-ctype": "*", "ext-ctype": "*",
"ext-filter": "*", "ext-filter": "*",
"ext-hash": "*",
"php": ">=5.5.0" "php": ">=5.5.0"
}, },
"require-dev": { "require-dev": {
@ -304,7 +236,7 @@
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
}, },
"time": "2020-07-14T18:50:27+00:00", "time": "2020-10-09T14:55:58+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -771,17 +703,17 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v4.4.13", "version": "v4.4.15",
"version_normalized": "4.4.13.0", "version_normalized": "4.4.15.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "1bef32329f3166486ab7cb88599cae4875632b99" "reference": "0dc22bdf9d1197467bb04d505355180b6f20bcca"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/1bef32329f3166486ab7cb88599cae4875632b99", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0dc22bdf9d1197467bb04d505355180b6f20bcca",
"reference": "1bef32329f3166486ab7cb88599cae4875632b99", "reference": "0dc22bdf9d1197467bb04d505355180b6f20bcca",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -811,7 +743,7 @@
"ext-intl": "To show region name in time zone dump", "ext-intl": "To show region name in time zone dump",
"symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
}, },
"time": "2020-08-17T07:31:35+00:00", "time": "2020-09-18T08:35:10+00:00",
"bin": [ "bin": [
"Resources/bin/var-dump-server" "Resources/bin/var-dump-server"
], ],
@ -913,17 +845,17 @@
}, },
{ {
"name": "topthink/framework", "name": "topthink/framework",
"version": "v6.0.3", "version": "v6.0.4",
"version_normalized": "6.0.3.0", "version_normalized": "6.0.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/framework.git", "url": "https://github.com/top-think/framework.git",
"reference": "b4046fb21e6163ba23a792b694162693dbe71b4b" "reference": "4b252d78562d4a51a501651f837c26cb9d91624f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/framework/zipball/b4046fb21e6163ba23a792b694162693dbe71b4b", "url": "https://api.github.com/repos/top-think/framework/zipball/4b252d78562d4a51a501651f837c26cb9d91624f",
"reference": "b4046fb21e6163ba23a792b694162693dbe71b4b", "reference": "4b252d78562d4a51a501651f837c26cb9d91624f",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -937,7 +869,6 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"league/flysystem": "^1.0", "league/flysystem": "^1.0",
"league/flysystem-cached-adapter": "^1.0", "league/flysystem-cached-adapter": "^1.0",
"opis/closure": "^3.1",
"php": ">=7.1.0", "php": ">=7.1.0",
"psr/container": "~1.0", "psr/container": "~1.0",
"psr/log": "~1.0", "psr/log": "~1.0",
@ -950,7 +881,7 @@
"mockery/mockery": "^1.2", "mockery/mockery": "^1.2",
"phpunit/phpunit": "^7.0" "phpunit/phpunit": "^7.0"
}, },
"time": "2020-06-26T16:03:10+00:00", "time": "2020-09-29T02:19:59+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -1139,17 +1070,17 @@
}, },
{ {
"name": "topthink/think-orm", "name": "topthink/think-orm",
"version": "v2.0.33", "version": "v2.0.34",
"version_normalized": "2.0.33.0", "version_normalized": "2.0.34.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-orm.git", "url": "https://github.com/top-think/think-orm.git",
"reference": "35ca511a1e4d671b39f7afb4c887703c16ef6957" "reference": "57f9b98895b0ff4ae7b7b75e51456fd8cb8fb629"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/35ca511a1e4d671b39f7afb4c887703c16ef6957", "url": "https://api.github.com/repos/top-think/think-orm/zipball/57f9b98895b0ff4ae7b7b75e51456fd8cb8fb629",
"reference": "35ca511a1e4d671b39f7afb4c887703c16ef6957", "reference": "57f9b98895b0ff4ae7b7b75e51456fd8cb8fb629",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -1165,7 +1096,7 @@
"psr/simple-cache": "^1.0", "psr/simple-cache": "^1.0",
"topthink/think-helper": "^3.1" "topthink/think-helper": "^3.1"
}, },
"time": "2020-06-22T14:57:28+00:00", "time": "2020-09-28T08:24:57+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -1237,17 +1168,17 @@
}, },
{ {
"name": "topthink/think-trace", "name": "topthink/think-trace",
"version": "v1.3", "version": "v1.4",
"version_normalized": "1.3.0.0", "version_normalized": "1.4.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-trace.git", "url": "https://github.com/top-think/think-trace.git",
"reference": "d8da2e39df268ab8775013de699f0c3012e51318" "reference": "9a9fa8f767b6c66c5a133ad21ca1bc96ad329444"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-trace/zipball/d8da2e39df268ab8775013de699f0c3012e51318", "url": "https://api.github.com/repos/top-think/think-trace/zipball/9a9fa8f767b6c66c5a133ad21ca1bc96ad329444",
"reference": "d8da2e39df268ab8775013de699f0c3012e51318", "reference": "9a9fa8f767b6c66c5a133ad21ca1bc96ad329444",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -1260,7 +1191,7 @@
"php": ">=7.1.0", "php": ">=7.1.0",
"topthink/framework": "^6.0.0" "topthink/framework": "^6.0.0"
}, },
"time": "2020-03-18T07:59:53+00:00", "time": "2020-06-29T05:27:28+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

View File

@ -181,6 +181,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
'dart' => 'application/vnd.dart', 'dart' => 'application/vnd.dart',
'dataless' => 'application/vnd.fdsn.seed', 'dataless' => 'application/vnd.fdsn.seed',
'davmount' => 'application/davmount+xml', 'davmount' => 'application/davmount+xml',
'dbf' => 'application/vnd.dbf',
'dbk' => 'application/docbook+xml', 'dbk' => 'application/docbook+xml',
'dcr' => 'application/x-director', 'dcr' => 'application/x-director',
'dcurl' => 'text/vnd.curl.dcurl', 'dcurl' => 'text/vnd.curl.dcurl',
@ -468,6 +469,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
'ksp' => 'application/vnd.kde.kspread', 'ksp' => 'application/vnd.kde.kspread',
'ktr' => 'application/vnd.kahootz', 'ktr' => 'application/vnd.kahootz',
'ktx' => 'image/ktx', 'ktx' => 'image/ktx',
'ktx2' => 'image/ktx2',
'ktz' => 'application/vnd.kahootz', 'ktz' => 'application/vnd.kahootz',
'kwd' => 'application/vnd.kde.kword', 'kwd' => 'application/vnd.kde.kword',
'kwt' => 'application/vnd.kde.kword', 'kwt' => 'application/vnd.kde.kword',

View File

@ -1,43 +0,0 @@
name: "Tests"
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4]
stability: [prefer-stable]
name: PHP ${{ matrix.php }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Update composer
run: composer self-update
- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: vendor/bin/phpunit --verbose

View File

@ -1,247 +0,0 @@
CHANGELOG
---------
### v3.5.7, 2020.09.06
- Fixed issue [#76](https://github.com/opis/closure/issues/76).
- Fixed issue [#78](https://github.com/opis/closure/issues/78).
### v3.5.6, 2020.08.11
- Fixed issue [#70](https://github.com/opis/closure/issues/70)
### v3.5.5, 2020.06.17
- Fixed a false-positive when using `Opis\Closure\ReflectionClosure::isScopeRequired` method
### v3.5.4, 2020.06.07
- Fixed a false-positive when using `Opis\Closure\ReflectionClosure::isScopeRequired` method
- Fixed a bug related to `T_STRING_VARNAME`
### 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.
When the class scope was `null`, the optimisation failed to work as expected and kept the wrong `SerializableClosure` scope.
### v3.5.2, 2020.05.21
- Removed extra semicolon in short closures, since is not part of the closure's body.
### v3.5.1, 2019.11.30
- Bugfix. See #47
### v3.5.0, 2019.11.29
- Added support for short closures (arrow functions)
- Added `isShortClosure` method to `Opis\Closure\ReflectionClosure`
### v3.4.2, 2019.11.29
- Added `stream_set_option()`
### v3.4.1, 2019.10.19
- Fixed a [bug](https://github.com/opis/closure/issues/40) that prevented serialization to work correctly.
### v3.4.0, 2019.09.03
- Added `createClosure` static method in `Opis\Closure\SerializableClosure`.
This method creates a new closure from arbitrary code, emulating `create_function`,
but without using eval
### v3.3.1, 2019.07.10
- Use `sha1` instead of `md5` for hashing file names in `Opis\Closure\ReflectionClosure` class
### v3.3.0, 2019.05.31
- Fixed a bug that prevented signed closures to properly work when the serialized string
contains invalid UTF-8 chars. Starting with this version `json_encode` is no longer used
when signing a closure. Backward compatibility is maintained and all closures that were
previously signed using the old method will continue to work.
### v3.2.0, 2019.05.05
- Since an unsigned closure can be unserialized when no security provider is set,
there is no reason to treat differently a signed closure in the same situation.
Therefore, the `Opis\Closure\SecurityException` exception is no longer thrown when
unserializing a signed closure, if no security provider is set.
### v3.1.6, 2019.02.22
- Fixed a bug that occurred when trying to set properties of classes that were not defined in user-land.
Those properties are now ignored.
### v3.1.5, 2019.01.14
- Improved parser
### v3.1.4, 2019.01.14
- Added support for static methods that are named using PHP keywords or magic constants.
Ex: `A::new()`, `A::use()`, `A::if()`, `A::function()`, `A::__DIR__()`, etc.
- Used `@internal` to mark classes & methods that are for internal use only and
backward compatibility is not guaranteed.
### v3.1.3, 2019.01.07
- Fixed a bug that prevented traits to be correctly resolved when used by an
anonymous class
- Fixed a bug that occurred when `$this` keyword was used inside an anonymous class
### v3.1.2, 2018.12.16
* Fixed a bug regarding comma trail in group-use statements. See [issue 23](https://github.com/opis/closure/issues/23)
### v3.1.1, 2018.10.02
* Fixed a bug where `parent` keyword was treated like a class-name and scope was not added to the
serialized closure
* Fixed a bug where return type was not properly handled for nested closures
* Support for anonymous classes was improved
### v3.1.0, 2018.09.20
* Added `transformUseVariables` and `resolveUseVariables` to
`Opis\Closure\SerializableClosure` class.
* Added `removeSecurityProvider` static method to
`Opis\Closure\SerializableClosure` class.
* Fixed some security related issues where a user was able to unserialize an unsigned
closure, even when a security provider was in use.
### v3.0.12, 2018.02.23
* Bugfix. See [issue 20](https://github.com/opis/closure/issues/20)
### v3.0.11, 2018.01.22
* Bugfix. See [issue 18](https://github.com/opis/closure/issues/18)
### v3.0.10, 2018.01.04
* Improved support for PHP 7.1 & 7.2
### v3.0.9, 2018.01.04
* Fixed a bug where the return type was not properly resolved.
See [issue 17](https://github.com/opis/closure/issues/17)
* Added more tests
### v3.0.8, 2017.12.18
* Fixed a bug. See [issue 16](https://github.com/opis/closure/issues/16)
### v3.0.7, 2017.10.31
* Bugfix: static properties are ignored now, since they are not serializable
### v3.0.6, 2017.10.06
* Fixed a bug introduced by accident in 3.0.5
### v3.0.5, 2017.09.18
* Fixed a bug related to nested references
### v3.0.4, 2017.09.18
* \[*internal*\] Refactored `SerializableClosure::mapPointers` method
* \[*internal*\] Added a new optional argument to `SerializableClosure::unwrapClosures`
* \[*internal*\] Removed `SerializableClosure::getClosurePointer` method
* Fixed various bugs
### v3.0.3, 2017.09.06
* Fixed a bug related to nested object references
* \[*internal*\] `Opis\Closure\ClosureScope` now extends `SplObjectStorage`
* \[*internal*\] The `storage` property was removed from `Opis\Closure\ClosureScope`
* \[*internal*\] The `instances` and `objects` properties were removed from `Opis\Closure\ClosureContext`
### v3.0.2, 2017.08.28
* Fixed a bug where `$this` object was not handled properly inside the
`SerializableClosre::serialize` method.
### v3.0.1, 2017.04.13
* Fixed a bug in 'ignore_next' state
### v3.0.0, 2017.04.07
* Dropped PHP 5.3 support
* Moved source files from `lib` to `src` folder
* Removed second parameter from `Opis\Closure\SerializableClosure::from` method and from constructor
* Removed `Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure}` classes
* Refactored how signed closures were handled
* Added `wrapClosures` and `unwrapClosures` static methods to `Opis\Closure\SerializableClosure` class
* Added `Opis\Colosure\serialize` and `Opis\Closure\unserialize` functions
* Improved serialization. You can now serialize arbitrary objects and the library will automatically wrap all closures
### v2.4.0, 2016.12.16
* The parser was refactored and improved
* Refactored `Opis\Closure\SerializableClosure::__invoke` method
* `Opis\Closure\{ISecurityProvider, SecurityProvider}` were added
* `Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure}` were deprecated
and they will be removed in the next major version
* `setSecretKey` and `addSecurityProvider` static methods were added to `Opis\Closure\SerializableClosure`
### v2.3.2, 2016.12.15
* Fixed a bug that prevented namespace resolution to be done properly
### v2.3.1, 2016.12.13
* Hotfix. See [PR](https://github.com/opis/closure/pull/7)
### v2.3.0, 2016.11.17
* Added `isBindingRequired` and `isScopeRequired` to the `Opis\Closure\ReflectionClosure` class
* Automatically detects when the scope and/or the bound object of a closure needs to be serialized.
### v2.2.1, 2016.08.20
* Fixed a bug in `Opis\Closure\ReflectionClosure::fetchItems`
### v2.2.0, 2016.07.26
* Fixed CS
* `Opis\Closure\ClosureContext`, `Opis\Closure\ClosureScope`, `Opis\Closure\SelfReference`
and `Opis\Closure\SecurityException` classes were moved into separate files
* Added support for PHP7 syntax
* Fixed some bugs in `Opis\Closure\ReflectionClosure` class
* Improved closure parser
* Added an analyzer for SuperClosure library
### v2.1.0, 2015.09.30
* Added support for the missing `__METHOD__`, `__FUNCTION__` and `__TRAIT__` magic constants
* Added some security related classes and interfaces: `Opis\Closure\SecurityProviderInterface`,
`Opis\Closure\DefaultSecurityProvider`, `Opis\Closure\SecureClosure`, `Opis\Closure\SecurityException`.
* Fiexed a bug in `Opis\Closure\ReflectionClosure::getClasses` method
* Other minor bugfixes
* Added support for static closures
* Added public `isStatic` method to `Opis\Closure\ReflectionClosure` class
### v2.0.1, 2015.09.23
* Removed `branch-alias` property from `composer.json`
* Bugfix. See [issue #6](https://github.com/opis/closure/issues/6)
### v2.0.0, 2015.07.31
* The closure parser was improved
* Class names are now automatically resolved
* Added support for the `#trackme` directive which allows tracking closure's residing source
### v1.3.0, 2014.10.18
* Added autoload file
* Changed README file
### Opis Closure 1.2.2
* Started changelog

View File

@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2018-2019 Zindex Software
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,9 +0,0 @@
Opis Closure
Copyright 2018-2019 Zindex Software
This product includes software developed at
Zindex Software (http://zindex.software).
This software was originally developed by Marius Sarca and Sorin Sarca
(Copyright 2014-2018). The copyright info was changed with the permission
of the original authors.

View File

@ -1,92 +0,0 @@
Opis Closure
====================
[![Tests](https://github.com/opis/closure/workflows/Tests/badge.svg)](https://github.com/opis/closure/actions)
[![Latest Stable Version](https://poser.pugx.org/opis/closure/v/stable.png)](https://packagist.org/packages/opis/closure)
[![Latest Unstable Version](https://poser.pugx.org/opis/closure/v/unstable.png)](https://packagist.org/packages/opis/closure)
[![License](https://poser.pugx.org/opis/closure/license.png)](https://packagist.org/packages/opis/closure)
Serializable closures
---------------------
**Opis Closure** is a library that aims to overcome PHP's limitations regarding closure
serialization by providing a wrapper that will make all closures serializable.
**The library's key features:**
- Serialize any closure
- Serialize arbitrary objects
- Doesn't use `eval` for closure serialization or unserialization
- Works with any PHP version that has support for closures
- Supports PHP 7 syntax
- Handles all variables referenced/imported in `use()` and automatically wraps all referenced/imported closures for
proper serialization
- Handles recursive closures
- Handles magic constants like `__FILE__`, `__DIR__`, `__LINE__`, `__NAMESPACE__`, `__CLASS__`,
`__TRAIT__`, `__METHOD__` and `__FUNCTION__`.
- Automatically resolves all class names, function names and constant names used inside the closure
- Track closure's residing source by using the `#trackme` directive
- Simple and very fast parser
- Any error or exception, that might occur when executing an unserialized closure, can be caught and treated properly
- You can serialize/unserialize any closure unlimited times, even those previously unserialized
(this is possible because `eval()` is not used for unserialization)
- Handles static closures
- Supports cryptographically signed closures
- Provides a reflector that can give you information about the serialized closure
- Provides an analyzer for *SuperClosure* library
- Automatically detects when the scope and/or the bound object of a closure needs to be serialized
in order for the closure to work after deserialization
## Documentation
The full documentation for this library can be found [here][documentation].
## License
**Opis Closure** is licensed under the [MIT License (MIT)][license].
## Requirements
* PHP ^5.4 || ^7.0
## Installation
**Opis Closure** is available on [Packagist] and it can be installed from a
command line interface by using [Composer].
```bash
composer require opis/closure
```
Or you could directly reference it into your `composer.json` file as a dependency
```json
{
"require": {
"opis/closure": "^3.5"
}
}
```
### Migrating from 2.x
If your project needs to support PHP 5.3 you can continue using the `2.x` version
of **Opis Closure**. Otherwise, assuming you are not using one of the removed/refactored classes or features(see
[CHANGELOG]), migrating to version `3.x` is simply a matter of updating your `composer.json` file.
### Semantic versioning
**Opis Closure** follows [semantic versioning][SemVer] specifications.
### Arbitrary object serialization
We've added this feature in order to be able to support the serialization of a closure's bound object.
The implementation is far from being perfect, and it's really hard to make it work flawless.
We will try to improve this, but we can't guarantee anything.
So our advice regarding the `Opis\Closure\serialize|unserialize` functions is to use them with caution.
[documentation]: https://www.opis.io/closure "Opis Closure"
[license]: http://opensource.org/licenses/MIT "MIT License"
[Packagist]: https://packagist.org/packages/opis/closure "Packagist"
[Composer]: https://getcomposer.org "Composer"
[SemVer]: http://semver.org/ "Semantic versioning"
[CHANGELOG]: https://github.com/opis/closure/blob/master/CHANGELOG.md "Changelog"

View File

@ -1,39 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
require_once 'functions.php';
spl_autoload_register(function($class){
$class = ltrim($class, '\\');
$dir = __DIR__ . '/src';
$namespace = 'Opis\Closure';
if(strpos($class, $namespace) === 0)
{
$class = substr($class, strlen($namespace));
$path = '';
if(($pos = strripos($class, '\\')) !== FALSE)
{
$path = str_replace('\\', '/', substr($class, 0, $pos)) . '/';
$class = substr($class, $pos + 1);
}
$path .= str_replace('_', '/', $class) . '.php';
$dir .= '/' . $path;
if(file_exists($dir))
{
include $dir;
return true;
}
return false;
}
return false;
});

View File

@ -1,40 +0,0 @@
{
"name": "opis/closure",
"description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
"keywords": ["closure", "serialization", "function", "serializable", "serialize", "anonymous functions"],
"homepage": "https://opis.io/closure",
"license": "MIT",
"authors": [
{
"name": "Marius Sarca",
"email": "marius.sarca@gmail.com"
},
{
"name": "Sorin Sarca",
"email": "sarca_sorin@hotmail.com"
}
],
"require": {
"php": "^5.4 || ^7.0"
},
"require-dev": {
"jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"autoload": {
"psr-4": {
"Opis\\Closure\\": "src/"
},
"files": ["functions.php"]
},
"autoload-dev": {
"psr-4": {
"Opis\\Closure\\Test\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "3.5.x-dev"
}
}
}

View File

@ -1,41 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* Serialize
*
* @param mixed $data
* @return string
*/
function serialize($data)
{
SerializableClosure::enterContext();
SerializableClosure::wrapClosures($data);
$data = \serialize($data);
SerializableClosure::exitContext();
return $data;
}
/**
* Unserialize
*
* @param string $data
* @param array|null $options
* @return mixed
*/
function unserialize($data, array $options = null)
{
SerializableClosure::enterContext();
$data = ($options === null || \PHP_MAJOR_VERSION < 7)
? \unserialize($data)
: \unserialize($data, $options);
SerializableClosure::unwrapClosures($data);
SerializableClosure::exitContext();
return $data;
}

View File

@ -1,62 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
use Closure;
use SuperClosure\Analyzer\ClosureAnalyzer;
/**
* @deprecated We'll remove this class
*/
class Analyzer extends ClosureAnalyzer
{
/**
* Analyzer a given closure.
*
* @param Closure $closure
*
* @return array
*/
public function analyze(Closure $closure)
{
$reflection = new ReflectionClosure($closure);
$scope = $reflection->getClosureScopeClass();
$data = [
'reflection' => $reflection,
'code' => $reflection->getCode(),
'hasThis' => $reflection->isBindingRequired(),
'context' => $reflection->getUseVariables(),
'hasRefs' => false,
'binding' => $reflection->getClosureThis(),
'scope' => $scope ? $scope->getName() : null,
'isStatic' => $reflection->isStatic(),
];
return $data;
}
/**
* @param array $data
* @return mixed
*/
protected function determineCode(array &$data)
{
return null;
}
/**
* @param array $data
* @return mixed
*/
protected function determineContext(array &$data)
{
return null;
}
}

View File

@ -1,34 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* Closure context class
* @internal
*/
class ClosureContext
{
/**
* @var ClosureScope Closures scope
*/
public $scope;
/**
* @var integer
*/
public $locks;
/**
* Constructor
*/
public function __construct()
{
$this->scope = new ClosureScope();
$this->locks = 0;
}
}

View File

@ -1,25 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* Closure scope class
* @internal
*/
class ClosureScope extends \SplObjectStorage
{
/**
* @var integer Number of serializations in current scope
*/
public $serializations = 0;
/**
* @var integer Number of closures that have to be serialized
*/
public $toserialize = 0;
}

View File

@ -1,99 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* @internal
*/
class ClosureStream
{
const STREAM_PROTO = 'closure';
protected static $isRegistered = false;
protected $content;
protected $length;
protected $pointer = 0;
function stream_open($path, $mode, $options, &$opened_path)
{
$this->content = "<?php\nreturn " . substr($path, strlen(static::STREAM_PROTO . '://')) . ";";
$this->length = strlen($this->content);
return true;
}
public function stream_read($count)
{
$value = substr($this->content, $this->pointer, $count);
$this->pointer += $count;
return $value;
}
public function stream_eof()
{
return $this->pointer >= $this->length;
}
public function stream_set_option($option, $arg1, $arg2)
{
return false;
}
public function stream_stat()
{
$stat = stat(__FILE__);
$stat[7] = $stat['size'] = $this->length;
return $stat;
}
public function url_stat($path, $flags)
{
$stat = stat(__FILE__);
$stat[7] = $stat['size'] = $this->length;
return $stat;
}
public function stream_seek($offset, $whence = SEEK_SET)
{
$crt = $this->pointer;
switch ($whence) {
case SEEK_SET:
$this->pointer = $offset;
break;
case SEEK_CUR:
$this->pointer += $offset;
break;
case SEEK_END:
$this->pointer = $this->length + $offset;
break;
}
if ($this->pointer < 0 || $this->pointer >= $this->length) {
$this->pointer = $crt;
return false;
}
return true;
}
public function stream_tell()
{
return $this->pointer;
}
public static function register()
{
if (!static::$isRegistered) {
static::$isRegistered = stream_wrapper_register(static::STREAM_PROTO, __CLASS__);
}
}
}

View File

@ -1,25 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
interface ISecurityProvider
{
/**
* Sign serialized closure
* @param string $closure
* @return array
*/
public function sign($closure);
/**
* Verify signature
* @param array $data
* @return bool
*/
public function verify(array $data);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
use Exception;
/**
* Security exception class
*/
class SecurityException extends Exception
{
}

View File

@ -1,42 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
class SecurityProvider implements ISecurityProvider
{
/** @var string */
protected $secret;
/**
* SecurityProvider constructor.
* @param string $secret
*/
public function __construct($secret)
{
$this->secret = $secret;
}
/**
* @inheritdoc
*/
public function sign($closure)
{
return array(
'closure' => $closure,
'hash' => base64_encode(hash_hmac('sha256', $closure, $this->secret, true)),
);
}
/**
* @inheritdoc
*/
public function verify(array $data)
{
return base64_encode(hash_hmac('sha256', $data['closure'], $this->secret, true)) === $data['hash'];
}
}

View File

@ -1,31 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* Helper class used to indicate a reference to an object
* @internal
*/
class SelfReference
{
/**
* @var string An unique hash representing the object
*/
public $hash;
/**
* Constructor
*
* @param string $hash
*/
public function __construct($hash)
{
$this->hash = $hash;
}
}

View File

@ -1,678 +0,0 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
use Closure;
use Serializable;
use SplObjectStorage;
use ReflectionObject;
/**
* Provides a wrapper for serialization of closures
*/
class SerializableClosure implements Serializable
{
/**
* @var Closure Wrapped closure
*
* @see \Opis\Closure\SerializableClosure::getClosure()
*/
protected $closure;
/**
* @var ReflectionClosure A reflection instance for closure
*
* @see \Opis\Closure\SerializableClosure::getReflector()
*/
protected $reflector;
/**
* @var mixed Used at deserialization to hold variables
*
* @see \Opis\Closure\SerializableClosure::unserialize()
* @see \Opis\Closure\SerializableClosure::getReflector()
*/
protected $code;
/**
* @var string Closure's ID
*/
protected $reference;
/**
* @var string Closure scope
*/
protected $scope;
/**
* @var ClosureContext Context of closure, used in serialization
*/
protected static $context;
/**
* @var ISecurityProvider|null
*/
protected static $securityProvider;
/** Array recursive constant*/
const ARRAY_RECURSIVE_KEY = '¯\_(ツ)_/¯';
/**
* Constructor
*
* @param Closure $closure Closure you want to serialize
*/
public function __construct(Closure $closure)
{
$this->closure = $closure;
if (static::$context !== null) {
$this->scope = static::$context->scope;
$this->scope->toserialize++;
}
}
/**
* Get the Closure object
*
* @return Closure The wrapped closure
*/
public function getClosure()
{
return $this->closure;
}
/**
* Get the reflector for closure
*
* @return ReflectionClosure
*/
public function getReflector()
{
if ($this->reflector === null) {
$this->reflector = new ReflectionClosure($this->closure, $this->code);
$this->code = null;
}
return $this->reflector;
}
/**
* Implementation of magic method __invoke()
*/
public function __invoke()
{
return call_user_func_array($this->closure, func_get_args());
}
/**
* Implementation of Serializable::serialize()
*
* @return string The serialized closure
*/
public function serialize()
{
if ($this->scope === null) {
$this->scope = new ClosureScope();
$this->scope->toserialize++;
}
$this->scope->serializations++;
$scope = $object = null;
$reflector = $this->getReflector();
if($reflector->isBindingRequired()){
$object = $reflector->getClosureThis();
static::wrapClosures($object, $this->scope);
if($scope = $reflector->getClosureScopeClass()){
$scope = $scope->name;
}
} else {
if($scope = $reflector->getClosureScopeClass()){
$scope = $scope->name;
}
}
$this->reference = spl_object_hash($this->closure);
$this->scope[$this->closure] = $this;
$use = $this->transformUseVariables($reflector->getUseVariables());
$code = $reflector->getCode();
$this->mapByReference($use);
$ret = \serialize(array(
'use' => $use,
'function' => $code,
'scope' => $scope,
'this' => $object,
'self' => $this->reference,
));
if (static::$securityProvider !== null) {
$data = static::$securityProvider->sign($ret);
$ret = '@' . $data['hash'] . '.' . $data['closure'];
}
if (!--$this->scope->serializations && !--$this->scope->toserialize) {
$this->scope = null;
}
return $ret;
}
/**
* Transform the use variables before serialization.
*
* @param array $data The Closure's use variables
* @return array
*/
protected function transformUseVariables($data)
{
return $data;
}
/**
* Implementation of Serializable::unserialize()
*
* @param string $data Serialized data
* @throws SecurityException
*/
public function unserialize($data)
{
ClosureStream::register();
if (static::$securityProvider !== null) {
if ($data[0] !== '@') {
throw new SecurityException("The serialized closure is not signed. ".
"Make sure you use a security provider for both serialization and unserialization.");
}
if ($data[1] !== '{') {
$separator = strpos($data, '.');
if ($separator === false) {
throw new SecurityException('Invalid signed closure');
}
$hash = substr($data, 1, $separator - 1);
$closure = substr($data, $separator + 1);
$data = ['hash' => $hash, 'closure' => $closure];
unset($hash, $closure);
} else {
$data = json_decode(substr($data, 1), true);
}
if (!is_array($data) || !static::$securityProvider->verify($data)) {
throw new SecurityException("Your serialized closure might have been modified and it's unsafe to be unserialized. " .
"Make sure you use the same security provider, with the same settings, " .
"both for serialization and unserialization.");
}
$data = $data['closure'];
} elseif ($data[0] === '@') {
if ($data[1] !== '{') {
$separator = strpos($data, '.');
if ($separator === false) {
throw new SecurityException('Invalid signed closure');
}
$hash = substr($data, 1, $separator - 1);
$closure = substr($data, $separator + 1);
$data = ['hash' => $hash, 'closure' => $closure];
unset($hash, $closure);
} else {
$data = json_decode(substr($data, 1), true);
}
if (!is_array($data) || !isset($data['closure']) || !isset($data['hash'])) {
throw new SecurityException('Invalid signed closure');
}
$data = $data['closure'];
}
$this->code = \unserialize($data);
// unset data
unset($data);
$this->code['objects'] = array();
if ($this->code['use']) {
$this->scope = new ClosureScope();
$this->code['use'] = $this->resolveUseVariables($this->code['use']);
$this->mapPointers($this->code['use']);
extract($this->code['use'], EXTR_OVERWRITE | EXTR_REFS);
$this->scope = null;
}
$this->closure = include(ClosureStream::STREAM_PROTO . '://' . $this->code['function']);
if($this->code['this'] === $this){
$this->code['this'] = null;
}
$this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']);
if(!empty($this->code['objects'])){
foreach ($this->code['objects'] as $item){
$item['property']->setValue($item['instance'], $item['object']->getClosure());
}
}
$this->code = $this->code['function'];
}
/**
* Resolve the use variables after unserialization.
*
* @param array $data The Closure's transformed use variables
* @return array
*/
protected function resolveUseVariables($data)
{
return $data;
}
/**
* Wraps a closure and sets the serialization context (if any)
*
* @param Closure $closure Closure to be wrapped
*
* @return self The wrapped closure
*/
public static function from(Closure $closure)
{
if (static::$context === null) {
$instance = new static($closure);
} elseif (isset(static::$context->scope[$closure])) {
$instance = static::$context->scope[$closure];
} else {
$instance = new static($closure);
static::$context->scope[$closure] = $instance;
}
return $instance;
}
/**
* Increments the context lock counter or creates a new context if none exist
*/
public static function enterContext()
{
if (static::$context === null) {
static::$context = new ClosureContext();
}
static::$context->locks++;
}
/**
* Decrements the context lock counter and destroy the context when it reaches to 0
*/
public static function exitContext()
{
if (static::$context !== null && !--static::$context->locks) {
static::$context = null;
}
}
/**
* @param string $secret
*/
public static function setSecretKey($secret)
{
if(static::$securityProvider === null){
static::$securityProvider = new SecurityProvider($secret);
}
}
/**
* @param ISecurityProvider $securityProvider
*/
public static function addSecurityProvider(ISecurityProvider $securityProvider)
{
static::$securityProvider = $securityProvider;
}
/**
* Remove security provider
*/
public static function removeSecurityProvider()
{
static::$securityProvider = null;
}
/**
* @return null|ISecurityProvider
*/
public static function getSecurityProvider()
{
return static::$securityProvider;
}
/**
* Wrap closures
*
* @internal
* @param $data
* @param ClosureScope|SplObjectStorage|null $storage
*/
public static function wrapClosures(&$data, SplObjectStorage $storage = null)
{
if($storage === null){
$storage = static::$context->scope;
}
if($data instanceof Closure){
$data = static::from($data);
} elseif (is_array($data)){
if(isset($data[self::ARRAY_RECURSIVE_KEY])){
return;
}
$data[self::ARRAY_RECURSIVE_KEY] = true;
foreach ($data as $key => &$value){
if($key === self::ARRAY_RECURSIVE_KEY){
continue;
}
static::wrapClosures($value, $storage);
}
unset($value);
unset($data[self::ARRAY_RECURSIVE_KEY]);
} elseif($data instanceof \stdClass){
if(isset($storage[$data])){
$data = $storage[$data];
return;
}
$data = $storage[$data] = clone($data);
foreach ($data as &$value){
static::wrapClosures($value, $storage);
}
unset($value);
} elseif (is_object($data) && ! $data instanceof static){
if(isset($storage[$data])){
$data = $storage[$data];
return;
}
$instance = $data;
$reflection = new ReflectionObject($instance);
if(!$reflection->isUserDefined()){
$storage[$instance] = $data;
return;
}
$storage[$instance] = $data = $reflection->newInstanceWithoutConstructor();
do{
if(!$reflection->isUserDefined()){
break;
}
foreach ($reflection->getProperties() as $property){
if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){
continue;
}
$property->setAccessible(true);
if (PHP_VERSION >= 7.4 && !$property->isInitialized($instance)) {
continue;
}
$value = $property->getValue($instance);
if(is_array($value) || is_object($value)){
static::wrapClosures($value, $storage);
}
$property->setValue($data, $value);
};
} while($reflection = $reflection->getParentClass());
}
}
/**
* Unwrap closures
*
* @internal
* @param $data
* @param SplObjectStorage|null $storage
*/
public static function unwrapClosures(&$data, SplObjectStorage $storage = null)
{
if($storage === null){
$storage = static::$context->scope;
}
if($data instanceof static){
$data = $data->getClosure();
} elseif (is_array($data)){
if(isset($data[self::ARRAY_RECURSIVE_KEY])){
return;
}
$data[self::ARRAY_RECURSIVE_KEY] = true;
foreach ($data as $key => &$value){
if($key === self::ARRAY_RECURSIVE_KEY){
continue;
}
static::unwrapClosures($value, $storage);
}
unset($data[self::ARRAY_RECURSIVE_KEY]);
}elseif ($data instanceof \stdClass){
if(isset($storage[$data])){
return;
}
$storage[$data] = true;
foreach ($data as &$property){
static::unwrapClosures($property, $storage);
}
} elseif (is_object($data) && !($data instanceof Closure)){
if(isset($storage[$data])){
return;
}
$storage[$data] = true;
$reflection = new ReflectionObject($data);
do{
if(!$reflection->isUserDefined()){
break;
}
foreach ($reflection->getProperties() as $property){
if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){
continue;
}
$property->setAccessible(true);
if (PHP_VERSION >= 7.4 && !$property->isInitialized($data)) {
continue;
}
$value = $property->getValue($data);
if(is_array($value) || is_object($value)){
static::unwrapClosures($value, $storage);
$property->setValue($data, $value);
}
};
} while($reflection = $reflection->getParentClass());
}
}
/**
* Creates a new closure from arbitrary code,
* emulating create_function, but without using eval
*
* @param string$args
* @param string $code
* @return Closure
*/
public static function createClosure($args, $code)
{
ClosureStream::register();
return include(ClosureStream::STREAM_PROTO . '://function(' . $args. '){' . $code . '};');
}
/**
* Internal method used to map closure pointers
* @internal
* @param $data
*/
protected function mapPointers(&$data)
{
$scope = $this->scope;
if ($data instanceof static) {
$data = &$data->closure;
} elseif (is_array($data)) {
if(isset($data[self::ARRAY_RECURSIVE_KEY])){
return;
}
$data[self::ARRAY_RECURSIVE_KEY] = true;
foreach ($data as $key => &$value){
if($key === self::ARRAY_RECURSIVE_KEY){
continue;
} elseif ($value instanceof static) {
$data[$key] = &$value->closure;
} elseif ($value instanceof SelfReference && $value->hash === $this->code['self']){
$data[$key] = &$this->closure;
} else {
$this->mapPointers($value);
}
}
unset($value);
unset($data[self::ARRAY_RECURSIVE_KEY]);
} elseif ($data instanceof \stdClass) {
if(isset($scope[$data])){
return;
}
$scope[$data] = true;
foreach ($data as $key => &$value){
if ($value instanceof SelfReference && $value->hash === $this->code['self']){
$data->{$key} = &$this->closure;
} elseif(is_array($value) || is_object($value)) {
$this->mapPointers($value);
}
}
unset($value);
} elseif (is_object($data) && !($data instanceof Closure)){
if(isset($scope[$data])){
return;
}
$scope[$data] = true;
$reflection = new ReflectionObject($data);
do{
if(!$reflection->isUserDefined()){
break;
}
foreach ($reflection->getProperties() as $property){
if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){
continue;
}
$property->setAccessible(true);
if (PHP_VERSION >= 7.4 && !$property->isInitialized($data)) {
continue;
}
$item = $property->getValue($data);
if ($item instanceof SerializableClosure || ($item instanceof SelfReference && $item->hash === $this->code['self'])) {
$this->code['objects'][] = array(
'instance' => $data,
'property' => $property,
'object' => $item instanceof SelfReference ? $this : $item,
);
} elseif (is_array($item) || is_object($item)) {
$this->mapPointers($item);
$property->setValue($data, $item);
}
}
} while($reflection = $reflection->getParentClass());
}
}
/**
* Internal method used to map closures by reference
*
* @internal
* @param mixed &$data
*/
protected function mapByReference(&$data)
{
if ($data instanceof Closure) {
if($data === $this->closure){
$data = new SelfReference($this->reference);
return;
}
if (isset($this->scope[$data])) {
$data = $this->scope[$data];
return;
}
$instance = new static($data);
if (static::$context !== null) {
static::$context->scope->toserialize--;
} else {
$instance->scope = $this->scope;
}
$data = $this->scope[$data] = $instance;
} elseif (is_array($data)) {
if(isset($data[self::ARRAY_RECURSIVE_KEY])){
return;
}
$data[self::ARRAY_RECURSIVE_KEY] = true;
foreach ($data as $key => &$value){
if($key === self::ARRAY_RECURSIVE_KEY){
continue;
}
$this->mapByReference($value);
}
unset($value);
unset($data[self::ARRAY_RECURSIVE_KEY]);
} elseif ($data instanceof \stdClass) {
if(isset($this->scope[$data])){
$data = $this->scope[$data];
return;
}
$instance = $data;
$this->scope[$instance] = $data = clone($data);
foreach ($data as &$value){
$this->mapByReference($value);
}
unset($value);
} elseif (is_object($data) && !$data instanceof SerializableClosure){
if(isset($this->scope[$data])){
$data = $this->scope[$data];
return;
}
$instance = $data;
$reflection = new ReflectionObject($data);
if(!$reflection->isUserDefined()){
$this->scope[$instance] = $data;
return;
}
$this->scope[$instance] = $data = $reflection->newInstanceWithoutConstructor();
do{
if(!$reflection->isUserDefined()){
break;
}
foreach ($reflection->getProperties() as $property){
if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){
continue;
}
$property->setAccessible(true);
if (PHP_VERSION >= 7.4 && !$property->isInitialized($instance)) {
continue;
}
$value = $property->getValue($instance);
if(is_array($value) || is_object($value)){
$this->mapByReference($value);
}
$property->setValue($data, $value);
}
} while($reflection = $reflection->getParentClass());
}
}
}

View File

@ -1 +1 @@
6.1.7 6.1.8

View File

@ -28,7 +28,8 @@
"require": { "require": {
"php": ">=5.5.0", "php": ">=5.5.0",
"ext-ctype": "*", "ext-ctype": "*",
"ext-filter": "*" "ext-filter": "*",
"ext-hash": "*"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^2.2", "friendsofphp/php-cs-fixer": "^2.2",

View File

@ -8,7 +8,7 @@
* @author Jim Jagielski (jimjag) <jimjag@gmail.com> * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder) * @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2017 Marcus Bointon * @copyright 2012 - 2020 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski * @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost * @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License

View File

@ -15,6 +15,8 @@ $PHPMAILER_LANG['file_open'] = 'Dateifehler: Konnte folgende Datei ni
$PHPMAILER_LANG['from_failed'] = 'Die folgende Absenderadresse ist nicht korrekt: '; $PHPMAILER_LANG['from_failed'] = 'Die folgende Absenderadresse ist nicht korrekt: ';
$PHPMAILER_LANG['instantiate'] = 'Mail-Funktion konnte nicht initialisiert werden.'; $PHPMAILER_LANG['instantiate'] = 'Mail-Funktion konnte nicht initialisiert werden.';
$PHPMAILER_LANG['invalid_address'] = 'Die Adresse ist ungültig: '; $PHPMAILER_LANG['invalid_address'] = 'Die Adresse ist ungültig: ';
$PHPMAILER_LANG['invalid_hostentry'] = 'Ungültiger Hosteintrag: ';
$PHPMAILER_LANG['invalid_host'] = 'Ungültiger Host: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wird nicht unterstützt.'; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer wird nicht unterstützt.';
$PHPMAILER_LANG['provide_address'] = 'Bitte geben Sie mindestens eine Empfängeradresse an.'; $PHPMAILER_LANG['provide_address'] = 'Bitte geben Sie mindestens eine Empfängeradresse an.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP-Fehler: Die folgenden Empfänger sind nicht korrekt: '; $PHPMAILER_LANG['recipients_failed'] = 'SMTP-Fehler: Die folgenden Empfänger sind nicht korrekt: ';

View File

@ -4,6 +4,7 @@
* @package PHPMailer * @package PHPMailer
* @author Cecep Prawiro <cecep.prawiro@gmail.com> * @author Cecep Prawiro <cecep.prawiro@gmail.com>
* @author @januridp * @author @januridp
* @author Ian Mustafa <mail@ianmustafa.com>
*/ */
$PHPMAILER_LANG['authenticate'] = 'Kesalahan SMTP: Tidak dapat mengotentikasi.'; $PHPMAILER_LANG['authenticate'] = 'Kesalahan SMTP: Tidak dapat mengotentikasi.';
@ -13,15 +14,17 @@ $PHPMAILER_LANG['empty_message'] = 'Isi pesan kosong';
$PHPMAILER_LANG['encoding'] = 'Pengkodean karakter tidak dikenali: '; $PHPMAILER_LANG['encoding'] = 'Pengkodean karakter tidak dikenali: ';
$PHPMAILER_LANG['execute'] = 'Tidak dapat menjalankan proses: '; $PHPMAILER_LANG['execute'] = 'Tidak dapat menjalankan proses: ';
$PHPMAILER_LANG['file_access'] = 'Tidak dapat mengakses berkas: '; $PHPMAILER_LANG['file_access'] = 'Tidak dapat mengakses berkas: ';
$PHPMAILER_LANG['file_open'] = 'Kesalahan File: Berkas tidak dapat dibuka : '; $PHPMAILER_LANG['file_open'] = 'Kesalahan Berkas: Berkas tidak dapat dibuka: ';
$PHPMAILER_LANG['from_failed'] = 'Alamat pengirim berikut mengakibatkan kesalahan: '; $PHPMAILER_LANG['from_failed'] = 'Alamat pengirim berikut mengakibatkan kesalahan: ';
$PHPMAILER_LANG['instantiate'] = 'Tidak dapat menginisialisasi fungsi surel'; $PHPMAILER_LANG['instantiate'] = 'Tidak dapat menginisialisasi fungsi surel.';
$PHPMAILER_LANG['invalid_address'] = 'Gagal terkirim, alamat surel tidak benar : '; $PHPMAILER_LANG['invalid_address'] = 'Gagal terkirim, alamat surel tidak sesuai: ';
$PHPMAILER_LANG['provide_address'] = 'Harus disediakan minimal satu alamat tujuan'; $PHPMAILER_LANG['invalid_hostentry'] = 'Gagal terkirim, entri host tidak sesuai: ';
$PHPMAILER_LANG['invalid_host'] = 'Gagal terkirim, host tidak sesuai: ';
$PHPMAILER_LANG['provide_address'] = 'Harus tersedia minimal satu alamat tujuan';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer tidak didukung'; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer tidak didukung';
$PHPMAILER_LANG['recipients_failed'] = 'Kesalahan SMTP: Alamat tujuan berikut menghasilkan kesalahan : '; $PHPMAILER_LANG['recipients_failed'] = 'Kesalahan SMTP: Alamat tujuan berikut menyebabkan kesalahan: ';
$PHPMAILER_LANG['signing'] = 'Kesalahan dalam tanda tangan : '; $PHPMAILER_LANG['signing'] = 'Kesalahan dalam penandatangan SSL: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() gagal.'; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() gagal.';
$PHPMAILER_LANG['smtp_error'] = 'Kesalahan pada pelayan SMTP: '; $PHPMAILER_LANG['smtp_error'] = 'Kesalahan pada pelayan SMTP: ';
$PHPMAILER_LANG['variable_set'] = 'Tidak dapat mengatur atau mengatur ulang variable : '; $PHPMAILER_LANG['variable_set'] = 'Tidak dapat mengatur atau mengatur ulang variabel: ';
$PHPMAILER_LANG['extension_missing'] = 'Ekstensi hilang: '; $PHPMAILER_LANG['extension_missing'] = 'Ekstensi PHP tidak tersedia: ';

View File

@ -3,25 +3,25 @@
* Tagalog PHPMailer language file: refer to English translation for definitive list * Tagalog PHPMailer language file: refer to English translation for definitive list
* *
* @package PHPMailer * @package PHPMailer
* @author Adriane Justine Tan <adrianetan12@gmail.com> * @author Adriane Justine Tan <eidoriantan@gmail.com>
*/ */
$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Hindi mapatotohanan.'; $PHPMAILER_LANG['authenticate'] = 'SMTP Error: Hindi mapatotohanan.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Hindi makakonekta sa SMTP host.'; $PHPMAILER_LANG['connect_host'] = 'SMTP Error: Hindi makakonekta sa SMTP host.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Ang datos ay hindi maaaring matatanggap.'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Ang datos ay hindi naitanggap.';
$PHPMAILER_LANG['empty_message'] = 'Walang laman ang mensahe'; $PHPMAILER_LANG['empty_message'] = 'Walang laman ang mensahe';
$PHPMAILER_LANG['encoding'] = 'Hindi alam ang encoding: '; $PHPMAILER_LANG['encoding'] = 'Hindi alam ang encoding: ';
$PHPMAILER_LANG['execute'] = 'Hindi maisasagawa: '; $PHPMAILER_LANG['execute'] = 'Hindi maisasagawa: ';
$PHPMAILER_LANG['file_access'] = 'Hindi ma-access ang file: '; $PHPMAILER_LANG['file_access'] = 'Hindi ma-access ang file: ';
$PHPMAILER_LANG['file_open'] = 'Hindi mabuksan ang file: '; $PHPMAILER_LANG['file_open'] = 'File Error: Hindi mabuksan ang file: ';
$PHPMAILER_LANG['from_failed'] = 'Ang sumusunod na address ay nabigo: '; $PHPMAILER_LANG['from_failed'] = 'Ang sumusunod na address ay nabigo: ';
$PHPMAILER_LANG['instantiate'] = 'Hindi maaaring magbigay ng institusyon ang mail'; $PHPMAILER_LANG['instantiate'] = 'Hindi maisimulan ang instance ng mail function.';
$PHPMAILER_LANG['invalid_address'] = 'Hindi wasto ang address na naibigay: '; $PHPMAILER_LANG['invalid_address'] = 'Hindi wasto ang address na naibigay: ';
$PHPMAILER_LANG['mailer_not_supported'] = 'Ang mailer ay hindi suportado'; $PHPMAILER_LANG['mailer_not_supported'] = 'Ang mailer ay hindi suportado.';
$PHPMAILER_LANG['provide_address'] = 'Kailangan mong magbigay ng kahit isang email address na tatanggap'; $PHPMAILER_LANG['provide_address'] = 'Kailangan mong magbigay ng kahit isang email address na tatanggap.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Ang mga sumusunod na tatanggap ay nabigo: '; $PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Ang mga sumusunod na tatanggap ay nabigo: ';
$PHPMAILER_LANG['signing'] = 'Hindi ma-sign'; $PHPMAILER_LANG['signing'] = 'Hindi ma-sign: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Ang SMTP connect() ay nabigo'; $PHPMAILER_LANG['smtp_connect_failed'] = 'Ang SMTP connect() ay nabigo.';
$PHPMAILER_LANG['smtp_error'] = 'Ang server ng SMTP ay nabigo'; $PHPMAILER_LANG['smtp_error'] = 'Ang server ng SMTP ay nabigo: ';
$PHPMAILER_LANG['variable_set'] = 'Hindi matatakda ang mga variables: '; $PHPMAILER_LANG['variable_set'] = 'Hindi matatakda o ma-reset ang mga variables: ';
$PHPMAILER_LANG['extension_missing'] = 'Nawawala ang extension'; $PHPMAILER_LANG['extension_missing'] = 'Nawawala ang extension: ';

View File

@ -9,7 +9,7 @@
* @author Jim Jagielski (jimjag) <jimjag@gmail.com> * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder) * @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2017 Marcus Bointon * @copyright 2012 - 2020 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski * @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost * @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License

View File

@ -9,7 +9,7 @@
* @author Jim Jagielski (jimjag) <jimjag@gmail.com> * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder) * @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2015 Marcus Bointon * @copyright 2012 - 2020 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski * @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost * @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License

View File

@ -9,7 +9,7 @@
* @author Jim Jagielski (jimjag) <jimjag@gmail.com> * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder) * @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2019 Marcus Bointon * @copyright 2012 - 2020 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski * @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost * @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@ -747,7 +747,7 @@ class PHPMailer
* *
* @var string * @var string
*/ */
const VERSION = '6.1.7'; const VERSION = '6.1.8';
/** /**
* Error severity: message only, continue processing. * Error severity: message only, continue processing.
@ -899,6 +899,7 @@ class PHPMailer
switch ($this->Debugoutput) { switch ($this->Debugoutput) {
case 'error_log': case 'error_log':
//Don't output, just log //Don't output, just log
/** @noinspection ForgottenDebugOutputInspection */
error_log($str); error_log($str);
break; break;
case 'html': case 'html':
@ -1350,7 +1351,7 @@ class PHPMailer
/* /*
* This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
* *
* @see http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email) * @see https://html.spec.whatwg.org/#e-mail-state-(type=email)
*/ */
return (bool) preg_match( return (bool) preg_match(
'/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
@ -1609,6 +1610,9 @@ class PHPMailer
return $this->mailSend($this->MIMEHeader, $this->MIMEBody); return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
} }
} catch (Exception $exc) { } catch (Exception $exc) {
if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true) {
$this->smtp->reset();
}
$this->setError($exc->getMessage()); $this->setError($exc->getMessage());
$this->edebug($exc->getMessage()); $this->edebug($exc->getMessage());
if ($this->exceptions) { if ($this->exceptions) {
@ -1749,6 +1753,23 @@ class PHPMailer
return !preg_match('#^[a-z]+://#i', $path); return !preg_match('#^[a-z]+://#i', $path);
} }
/**
* Check whether a file path is safe, accessible, and readable.
*
* @param string $path A relative or absolute path to a file
*
* @return bool
*/
protected static function fileIsAccessible($path)
{
$readable = file_exists($path);
//If not a UNC path (expected to start with \\), check read permission, see #2069
if (strpos($path, '\\\\') !== 0) {
$readable = $readable && is_readable($path);
}
return static::isPermittedPath($path) && $readable;
}
/** /**
* Send mail using the PHP mail() function. * Send mail using the PHP mail() function.
* *
@ -2002,7 +2023,12 @@ class PHPMailer
} }
$host = $hostinfo[2]; $host = $hostinfo[2];
$port = $this->Port; $port = $this->Port;
if (array_key_exists(3, $hostinfo) && is_numeric($hostinfo[3]) && $hostinfo[3] > 0 && $hostinfo[3] < 65536) { if (
array_key_exists(3, $hostinfo) &&
is_numeric($hostinfo[3]) &&
$hostinfo[3] > 0 &&
$hostinfo[3] < 65536
) {
$port = (int) $hostinfo[3]; $port = (int) $hostinfo[3];
} }
if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
@ -2132,7 +2158,7 @@ class PHPMailer
// There is no English translation file // There is no English translation file
if ('en' !== $langcode) { if ('en' !== $langcode) {
// Make sure language file path is readable // Make sure language file path is readable
if (!static::isPermittedPath($lang_file) || !file_exists($lang_file)) { if (!static::fileIsAccessible($lang_file)) {
$foundlang = false; $foundlang = false;
} else { } else {
// Overwrite language-specific strings. // Overwrite language-specific strings.
@ -2380,21 +2406,18 @@ class PHPMailer
$result .= $this->headerLine('Date', '' === $this->MessageDate ? self::rfcDate() : $this->MessageDate); $result .= $this->headerLine('Date', '' === $this->MessageDate ? self::rfcDate() : $this->MessageDate);
// To be created automatically by mail() // The To header is created automatically by mail(), so needs to be omitted here
if ($this->SingleTo) {
if ('mail' !== $this->Mailer) { if ('mail' !== $this->Mailer) {
if ($this->SingleTo) {
foreach ($this->to as $toaddr) { foreach ($this->to as $toaddr) {
$this->SingleToArray[] = $this->addrFormat($toaddr); $this->SingleToArray[] = $this->addrFormat($toaddr);
} }
}
} elseif (count($this->to) > 0) { } elseif (count($this->to) > 0) {
if ('mail' !== $this->Mailer) {
$result .= $this->addrAppend('To', $this->to); $result .= $this->addrAppend('To', $this->to);
}
} elseif (count($this->cc) === 0) { } elseif (count($this->cc) === 0) {
$result .= $this->headerLine('To', 'undisclosed-recipients:;'); $result .= $this->headerLine('To', 'undisclosed-recipients:;');
} }
}
$result .= $this->addrAppend('From', [[trim($this->From), $this->FromName]]); $result .= $this->addrAppend('From', [[trim($this->From), $this->FromName]]);
// sendmail and mail() extract Cc from the header before sending // sendmail and mail() extract Cc from the header before sending
@ -2949,7 +2972,7 @@ class PHPMailer
* @param string $path Path to the attachment * @param string $path Path to the attachment
* @param string $name Overrides the attachment name * @param string $name Overrides the attachment name
* @param string $encoding File encoding (see $Encoding) * @param string $encoding File encoding (see $Encoding)
* @param string $type File extension (MIME) type * @param string $type MIME type, e.g. `image/jpeg`; determined automatically from $path if not specified
* @param string $disposition Disposition to use * @param string $disposition Disposition to use
* *
* @throws Exception * @throws Exception
@ -2964,7 +2987,7 @@ class PHPMailer
$disposition = 'attachment' $disposition = 'attachment'
) { ) {
try { try {
if (!static::isPermittedPath($path) || !@is_file($path) || !is_readable($path)) { if (!static::fileIsAccessible($path)) {
throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE); throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
} }
@ -3138,7 +3161,7 @@ class PHPMailer
protected function encodeFile($path, $encoding = self::ENCODING_BASE64) protected function encodeFile($path, $encoding = self::ENCODING_BASE64)
{ {
try { try {
if (!static::isPermittedPath($path) || !file_exists($path) || !is_readable($path)) { if (!static::fileIsAccessible($path)) {
throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE); throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
} }
$file_buffer = file_get_contents($path); $file_buffer = file_get_contents($path);
@ -3524,7 +3547,7 @@ class PHPMailer
$disposition = 'inline' $disposition = 'inline'
) { ) {
try { try {
if (!static::isPermittedPath($path) || !@is_file($path) || !is_readable($path)) { if (!static::fileIsAccessible($path)) {
throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE); throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
} }
@ -4215,6 +4238,7 @@ class PHPMailer
'tiff' => 'image/tiff', 'tiff' => 'image/tiff',
'tif' => 'image/tiff', 'tif' => 'image/tiff',
'webp' => 'image/webp', 'webp' => 'image/webp',
'avif' => 'image/avif',
'heif' => 'image/heif', 'heif' => 'image/heif',
'heifs' => 'image/heif-sequence', 'heifs' => 'image/heif-sequence',
'heic' => 'image/heic', 'heic' => 'image/heic',

View File

@ -9,7 +9,7 @@
* @author Jim Jagielski (jimjag) <jimjag@gmail.com> * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder) * @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2019 Marcus Bointon * @copyright 2012 - 2020 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski * @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost * @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@ -45,7 +45,7 @@ class POP3
* *
* @var string * @var string
*/ */
const VERSION = '6.1.7'; const VERSION = '6.1.8';
/** /**
* Default POP3 port number. * Default POP3 port number.

View File

@ -9,7 +9,7 @@
* @author Jim Jagielski (jimjag) <jimjag@gmail.com> * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder) * @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2019 Marcus Bointon * @copyright 2012 - 2020 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski * @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost * @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@ -34,7 +34,7 @@ class SMTP
* *
* @var string * @var string
*/ */
const VERSION = '6.1.7'; const VERSION = '6.1.8';
/** /**
* SMTP line break constant. * SMTP line break constant.
@ -417,8 +417,8 @@ class SMTP
// Windows does not have support for this timeout function // Windows does not have support for this timeout function
if (strpos(PHP_OS, 'WIN') !== 0) { if (strpos(PHP_OS, 'WIN') !== 0) {
$max = (int)ini_get('max_execution_time'); $max = (int)ini_get('max_execution_time');
// Don't bother if unlimited // Don't bother if unlimited, or if set_time_limit is disabled
if (0 !== $max && $timeout > $max) { if (0 !== $max && $timeout > $max && strpos(ini_get('disable_functions'), 'set_time_limit') === false) {
@set_time_limit($timeout); @set_time_limit($timeout);
} }
stream_set_timeout($connection, $timeout, 0); stream_set_timeout($connection, $timeout, 0);

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-09-20 15:13:17 // This file is automatically generated at:2020-10-11 14:54:36
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\captcha\\CaptchaService', 0 => 'think\\captcha\\CaptchaService',

View File

@ -23,27 +23,27 @@ use Symfony\Component\VarDumper\Cloner\Stub;
class AmqpCaster class AmqpCaster
{ {
private static $flags = [ private static $flags = [
AMQP_DURABLE => 'AMQP_DURABLE', \AMQP_DURABLE => 'AMQP_DURABLE',
AMQP_PASSIVE => 'AMQP_PASSIVE', \AMQP_PASSIVE => 'AMQP_PASSIVE',
AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE', \AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE',
AMQP_AUTODELETE => 'AMQP_AUTODELETE', \AMQP_AUTODELETE => 'AMQP_AUTODELETE',
AMQP_INTERNAL => 'AMQP_INTERNAL', \AMQP_INTERNAL => 'AMQP_INTERNAL',
AMQP_NOLOCAL => 'AMQP_NOLOCAL', \AMQP_NOLOCAL => 'AMQP_NOLOCAL',
AMQP_AUTOACK => 'AMQP_AUTOACK', \AMQP_AUTOACK => 'AMQP_AUTOACK',
AMQP_IFEMPTY => 'AMQP_IFEMPTY', \AMQP_IFEMPTY => 'AMQP_IFEMPTY',
AMQP_IFUNUSED => 'AMQP_IFUNUSED', \AMQP_IFUNUSED => 'AMQP_IFUNUSED',
AMQP_MANDATORY => 'AMQP_MANDATORY', \AMQP_MANDATORY => 'AMQP_MANDATORY',
AMQP_IMMEDIATE => 'AMQP_IMMEDIATE', \AMQP_IMMEDIATE => 'AMQP_IMMEDIATE',
AMQP_MULTIPLE => 'AMQP_MULTIPLE', \AMQP_MULTIPLE => 'AMQP_MULTIPLE',
AMQP_NOWAIT => 'AMQP_NOWAIT', \AMQP_NOWAIT => 'AMQP_NOWAIT',
AMQP_REQUEUE => 'AMQP_REQUEUE', \AMQP_REQUEUE => 'AMQP_REQUEUE',
]; ];
private static $exchangeTypes = [ private static $exchangeTypes = [
AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT', \AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT',
AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT', \AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT',
AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC', \AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC',
AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS', \AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS',
]; ];
public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, $isNested) public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, $isNested)

View File

@ -23,44 +23,44 @@ use Symfony\Component\VarDumper\Cloner\Stub;
class DOMCaster class DOMCaster
{ {
private static $errorCodes = [ private static $errorCodes = [
DOM_PHP_ERR => 'DOM_PHP_ERR', \DOM_PHP_ERR => 'DOM_PHP_ERR',
DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR', \DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR',
DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR', \DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR',
DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR', \DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR',
DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR', \DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR',
DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR', \DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR',
DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR', \DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR',
DOM_NO_MODIFICATION_ALLOWED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR', \DOM_NO_MODIFICATION_ALLOWED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR',
DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR', \DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR',
DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR', \DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR',
DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR', \DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR',
DOM_INVALID_STATE_ERR => 'DOM_INVALID_STATE_ERR', \DOM_INVALID_STATE_ERR => 'DOM_INVALID_STATE_ERR',
DOM_SYNTAX_ERR => 'DOM_SYNTAX_ERR', \DOM_SYNTAX_ERR => 'DOM_SYNTAX_ERR',
DOM_INVALID_MODIFICATION_ERR => 'DOM_INVALID_MODIFICATION_ERR', \DOM_INVALID_MODIFICATION_ERR => 'DOM_INVALID_MODIFICATION_ERR',
DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR', \DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR',
DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR', \DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR',
DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR', \DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR',
]; ];
private static $nodeTypes = [ private static $nodeTypes = [
XML_ELEMENT_NODE => 'XML_ELEMENT_NODE', \XML_ELEMENT_NODE => 'XML_ELEMENT_NODE',
XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE', \XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE',
XML_TEXT_NODE => 'XML_TEXT_NODE', \XML_TEXT_NODE => 'XML_TEXT_NODE',
XML_CDATA_SECTION_NODE => 'XML_CDATA_SECTION_NODE', \XML_CDATA_SECTION_NODE => 'XML_CDATA_SECTION_NODE',
XML_ENTITY_REF_NODE => 'XML_ENTITY_REF_NODE', \XML_ENTITY_REF_NODE => 'XML_ENTITY_REF_NODE',
XML_ENTITY_NODE => 'XML_ENTITY_NODE', \XML_ENTITY_NODE => 'XML_ENTITY_NODE',
XML_PI_NODE => 'XML_PI_NODE', \XML_PI_NODE => 'XML_PI_NODE',
XML_COMMENT_NODE => 'XML_COMMENT_NODE', \XML_COMMENT_NODE => 'XML_COMMENT_NODE',
XML_DOCUMENT_NODE => 'XML_DOCUMENT_NODE', \XML_DOCUMENT_NODE => 'XML_DOCUMENT_NODE',
XML_DOCUMENT_TYPE_NODE => 'XML_DOCUMENT_TYPE_NODE', \XML_DOCUMENT_TYPE_NODE => 'XML_DOCUMENT_TYPE_NODE',
XML_DOCUMENT_FRAG_NODE => 'XML_DOCUMENT_FRAG_NODE', \XML_DOCUMENT_FRAG_NODE => 'XML_DOCUMENT_FRAG_NODE',
XML_NOTATION_NODE => 'XML_NOTATION_NODE', \XML_NOTATION_NODE => 'XML_NOTATION_NODE',
XML_HTML_DOCUMENT_NODE => 'XML_HTML_DOCUMENT_NODE', \XML_HTML_DOCUMENT_NODE => 'XML_HTML_DOCUMENT_NODE',
XML_DTD_NODE => 'XML_DTD_NODE', \XML_DTD_NODE => 'XML_DTD_NODE',
XML_ELEMENT_DECL_NODE => 'XML_ELEMENT_DECL_NODE', \XML_ELEMENT_DECL_NODE => 'XML_ELEMENT_DECL_NODE',
XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE', \XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE',
XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE', \XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE',
XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE', \XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
]; ];
public static function castException(\DOMException $e, array $a, Stub $stub, $isNested) public static function castException(\DOMException $e, array $a, Stub $stub, $isNested)

View File

@ -27,21 +27,21 @@ class ExceptionCaster
public static $srcContext = 1; public static $srcContext = 1;
public static $traceArgs = true; public static $traceArgs = true;
public static $errorTypes = [ public static $errorTypes = [
E_DEPRECATED => 'E_DEPRECATED', \E_DEPRECATED => 'E_DEPRECATED',
E_USER_DEPRECATED => 'E_USER_DEPRECATED', \E_USER_DEPRECATED => 'E_USER_DEPRECATED',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR', \E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
E_ERROR => 'E_ERROR', \E_ERROR => 'E_ERROR',
E_WARNING => 'E_WARNING', \E_WARNING => 'E_WARNING',
E_PARSE => 'E_PARSE', \E_PARSE => 'E_PARSE',
E_NOTICE => 'E_NOTICE', \E_NOTICE => 'E_NOTICE',
E_CORE_ERROR => 'E_CORE_ERROR', \E_CORE_ERROR => 'E_CORE_ERROR',
E_CORE_WARNING => 'E_CORE_WARNING', \E_CORE_WARNING => 'E_CORE_WARNING',
E_COMPILE_ERROR => 'E_COMPILE_ERROR', \E_COMPILE_ERROR => 'E_COMPILE_ERROR',
E_COMPILE_WARNING => 'E_COMPILE_WARNING', \E_COMPILE_WARNING => 'E_COMPILE_WARNING',
E_USER_ERROR => 'E_USER_ERROR', \E_USER_ERROR => 'E_USER_ERROR',
E_USER_WARNING => 'E_USER_WARNING', \E_USER_WARNING => 'E_USER_WARNING',
E_USER_NOTICE => 'E_USER_NOTICE', \E_USER_NOTICE => 'E_USER_NOTICE',
E_STRICT => 'E_STRICT', \E_STRICT => 'E_STRICT',
]; ];
private static $framesCache = []; private static $framesCache = [];

View File

@ -36,37 +36,37 @@ class PgSqlCaster
]; ];
private static $transactionStatus = [ private static $transactionStatus = [
PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE', \PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE',
PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE', \PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE',
PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS', \PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS',
PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR', \PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR',
PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN', \PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN',
]; ];
private static $resultStatus = [ private static $resultStatus = [
PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY', \PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK', \PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK', \PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
PGSQL_COPY_OUT => 'PGSQL_COPY_OUT', \PGSQL_COPY_OUT => 'PGSQL_COPY_OUT',
PGSQL_COPY_IN => 'PGSQL_COPY_IN', \PGSQL_COPY_IN => 'PGSQL_COPY_IN',
PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE', \PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE',
PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR', \PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR',
PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR', \PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
]; ];
private static $diagCodes = [ private static $diagCodes = [
'severity' => PGSQL_DIAG_SEVERITY, 'severity' => \PGSQL_DIAG_SEVERITY,
'sqlstate' => PGSQL_DIAG_SQLSTATE, 'sqlstate' => \PGSQL_DIAG_SQLSTATE,
'message' => PGSQL_DIAG_MESSAGE_PRIMARY, 'message' => \PGSQL_DIAG_MESSAGE_PRIMARY,
'detail' => PGSQL_DIAG_MESSAGE_DETAIL, 'detail' => \PGSQL_DIAG_MESSAGE_DETAIL,
'hint' => PGSQL_DIAG_MESSAGE_HINT, 'hint' => \PGSQL_DIAG_MESSAGE_HINT,
'statement position' => PGSQL_DIAG_STATEMENT_POSITION, 'statement position' => \PGSQL_DIAG_STATEMENT_POSITION,
'internal position' => PGSQL_DIAG_INTERNAL_POSITION, 'internal position' => \PGSQL_DIAG_INTERNAL_POSITION,
'internal query' => PGSQL_DIAG_INTERNAL_QUERY, 'internal query' => \PGSQL_DIAG_INTERNAL_QUERY,
'context' => PGSQL_DIAG_CONTEXT, 'context' => \PGSQL_DIAG_CONTEXT,
'file' => PGSQL_DIAG_SOURCE_FILE, 'file' => \PGSQL_DIAG_SOURCE_FILE,
'line' => PGSQL_DIAG_SOURCE_LINE, 'line' => \PGSQL_DIAG_SOURCE_LINE,
'function' => PGSQL_DIAG_SOURCE_FUNCTION, 'function' => \PGSQL_DIAG_SOURCE_FUNCTION,
]; ];
public static function castLargeObject($lo, array $a, Stub $stub, $isNested) public static function castLargeObject($lo, array $a, Stub $stub, $isNested)
@ -79,7 +79,7 @@ class PgSqlCaster
public static function castLink($link, array $a, Stub $stub, $isNested) public static function castLink($link, array $a, Stub $stub, $isNested)
{ {
$a['status'] = pg_connection_status($link); $a['status'] = pg_connection_status($link);
$a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']); $a['status'] = new ConstStub(\PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
$a['busy'] = pg_connection_busy($link); $a['busy'] = pg_connection_busy($link);
$a['transaction'] = pg_transaction_status($link); $a['transaction'] = pg_transaction_status($link);
@ -115,7 +115,7 @@ class PgSqlCaster
if (isset(self::$resultStatus[$a['status']])) { if (isset(self::$resultStatus[$a['status']])) {
$a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']); $a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']);
} }
$a['command-completion tag'] = pg_result_status($result, PGSQL_STATUS_STRING); $a['command-completion tag'] = pg_result_status($result, \PGSQL_STATUS_STRING);
if (-1 === $a['num rows']) { if (-1 === $a['num rows']) {
foreach (self::$diagCodes as $k => $v) { foreach (self::$diagCodes as $k => $v) {

View File

@ -120,7 +120,7 @@ class ReflectionCaster
'file' => $c->getExecutingFile(), 'file' => $c->getExecutingFile(),
'line' => $c->getExecutingLine(), 'line' => $c->getExecutingLine(),
]; ];
if ($trace = $c->getTrace(DEBUG_BACKTRACE_IGNORE_ARGS)) { if ($trace = $c->getTrace(\DEBUG_BACKTRACE_IGNORE_ARGS)) {
$function = new \ReflectionGenerator($c->getExecutingGenerator()); $function = new \ReflectionGenerator($c->getExecutingGenerator());
array_unshift($trace, [ array_unshift($trace, [
'function' => 'yield', 'function' => 'yield',

View File

@ -94,11 +94,33 @@ class SplCaster
unset($a["\0SplFileInfo\0fileName"]); unset($a["\0SplFileInfo\0fileName"]);
unset($a["\0SplFileInfo\0pathName"]); unset($a["\0SplFileInfo\0pathName"]);
if (\PHP_VERSION_ID < 80000) {
if (false === $c->getPathname()) { if (false === $c->getPathname()) {
$a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state'; $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
return $a; return $a;
} }
} else {
try {
$c->isReadable();
} catch (\RuntimeException $e) {
if ('Object not initialized' !== $e->getMessage()) {
throw $e;
}
$a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
return $a;
} catch (\Error $e) {
if ('Object not initialized' !== $e->getMessage()) {
throw $e;
}
$a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
return $a;
}
}
foreach ($map as $key => $accessor) { foreach ($map as $key => $accessor) {
try { try {

View File

@ -23,28 +23,28 @@ use Symfony\Component\VarDumper\Cloner\Stub;
class XmlResourceCaster class XmlResourceCaster
{ {
private static $xmlErrors = [ private static $xmlErrors = [
XML_ERROR_NONE => 'XML_ERROR_NONE', \XML_ERROR_NONE => 'XML_ERROR_NONE',
XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY', \XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY',
XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX', \XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX',
XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS', \XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS',
XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN', \XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN',
XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN', \XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN',
XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR', \XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR',
XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH', \XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH',
XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE', \XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE',
XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT', \XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT',
XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF', \XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF',
XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY', \XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY',
XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF', \XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF',
XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY', \XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY',
XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF', \XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF',
XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF', \XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF',
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF', \XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF',
XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI', \XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI',
XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING', \XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING',
XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING', \XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING',
XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION', \XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION',
XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING', \XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING',
]; ];
public static function castXml($h, array $a, Stub $stub, $isNested) public static function castXml($h, array $a, Stub $stub, $isNested)

View File

@ -244,7 +244,7 @@ abstract class AbstractCloner implements ClonerInterface
public function cloneVar($var, $filter = 0) public function cloneVar($var, $filter = 0)
{ {
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) { $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) { if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) {
// Cloner never dies // Cloner never dies
throw new \ErrorException($msg, 0, $type, $file, $line); throw new \ErrorException($msg, 0, $type, $file, $line);
} }

View File

@ -328,7 +328,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
} }
} elseif (Stub::TYPE_REF === $item->type) { } elseif (Stub::TYPE_REF === $item->type) {
if ($item->handle) { if ($item->handle) {
if (!isset($refs[$r = $item->handle - (PHP_INT_MAX >> 1)])) { if (!isset($refs[$r = $item->handle - (\PHP_INT_MAX >> 1)])) {
$cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0]; $cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0];
} else { } else {
$firstSeen = false; $firstSeen = false;

View File

@ -125,8 +125,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
$this->decimalPoint = localeconv(); $this->decimalPoint = localeconv();
$this->decimalPoint = $this->decimalPoint['decimal_point']; $this->decimalPoint = $this->decimalPoint['decimal_point'];
if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(LC_NUMERIC, 0) : null) { if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) {
setlocale(LC_NUMERIC, 'C'); setlocale(\LC_NUMERIC, 'C');
} }
if ($returnDump = true === $output) { if ($returnDump = true === $output) {
@ -150,7 +150,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
$this->setOutput($prevOutput); $this->setOutput($prevOutput);
} }
if ($locale) { if ($locale) {
setlocale(LC_NUMERIC, $locale); setlocale(\LC_NUMERIC, $locale);
} }
} }

View File

@ -149,8 +149,8 @@ class CliDumper extends AbstractDumper
$style = 'num'; $style = 'num';
switch (true) { switch (true) {
case INF === $value: $value = 'INF'; break; case \INF === $value: $value = 'INF'; break;
case -INF === $value: $value = '-INF'; break; case -\INF === $value: $value = '-INF'; break;
case is_nan($value): $value = 'NAN'; break; case is_nan($value): $value = 'NAN'; break;
default: default:
$value = (string) $value; $value = (string) $value;

View File

@ -40,7 +40,7 @@ final class SourceContextProvider implements ContextProviderInterface
public function getContext(): ?array public function getContext(): ?array
{ {
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, $this->limit); $trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, $this->limit);
$file = $trace[1]['file']; $file = $trace[1]['file'];
$line = $trace[1]['line']; $line = $trace[1]['line'];

View File

@ -159,7 +159,7 @@ class HtmlDumper extends CliDumper
return $this->dumpHeader; return $this->dumpHeader;
} }
$line = str_replace('{$options}', json_encode($this->displayOptions, JSON_FORCE_OBJECT), <<<'EOHTML' $line = str_replace('{$options}', json_encode($this->displayOptions, \JSON_FORCE_OBJECT), <<<'EOHTML'
<script> <script>
Sfdump = window.Sfdump || (function (doc) { Sfdump = window.Sfdump || (function (doc) {
@ -971,7 +971,7 @@ EOHTML
if (-1 === $depth) { if (-1 === $depth) {
$args = ['"'.$this->dumpId.'"']; $args = ['"'.$this->dumpId.'"'];
if ($this->extraDisplayOptions) { if ($this->extraDisplayOptions) {
$args[] = json_encode($this->extraDisplayOptions, JSON_FORCE_OBJECT); $args[] = json_encode($this->extraDisplayOptions, \JSON_FORCE_OBJECT);
} }
// Replace is for BC // Replace is for BC
$this->line .= sprintf(str_replace('"%s"', '%s', $this->dumpSuffix), implode(', ', $args)); $this->line .= sprintf(str_replace('"%s"', '%s', $this->dumpSuffix), implode(', ', $args));
@ -1000,5 +1000,5 @@ EOHTML
function esc($str) function esc($str)
{ {
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); return htmlspecialchars($str, \ENT_QUOTES, 'UTF-8');
} }

View File

@ -64,7 +64,7 @@ class Connection
return true; return true;
} }
if (!$socketIsFresh) { if (!$socketIsFresh) {
stream_socket_shutdown($this->socket, STREAM_SHUT_RDWR); stream_socket_shutdown($this->socket, \STREAM_SHUT_RDWR);
fclose($this->socket); fclose($this->socket);
$this->socket = $this->createSocket(); $this->socket = $this->createSocket();
} }
@ -87,7 +87,7 @@ class Connection
{ {
set_error_handler([self::class, 'nullErrorHandler']); set_error_handler([self::class, 'nullErrorHandler']);
try { try {
return stream_socket_client($this->host, $errno, $errstr, 3, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT); return stream_socket_client($this->host, $errno, $errstr, 3, \STREAM_CLIENT_CONNECT | \STREAM_CLIENT_ASYNC_CONNECT);
} finally { } finally {
restore_error_handler(); restore_error_handler();
} }

View File

@ -13,7 +13,7 @@ ThinkPHP 6.0
ThinkPHP6.0底层架构采用PHP7.1改写和进一步优化。 ThinkPHP6.0底层架构采用PHP7.1改写和进一步优化。
[官方应用服务市场](https://www.thinkphp.cn/service) | [`ThinkPHP`开发者扶持计划](https://sites.thinkphp.cn/1782366) [官方应用服务市场](https://market.topthink.com) | [`ThinkPHP`开发者扶持计划](https://sites.thinkphp.cn/1782366)
## 主要新特性 ## 主要新特性

View File

@ -24,7 +24,6 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"league/flysystem": "^1.0", "league/flysystem": "^1.0",
"league/flysystem-cached-adapter": "^1.0", "league/flysystem-cached-adapter": "^1.0",
"opis/closure": "^3.1",
"psr/log": "~1.0", "psr/log": "~1.0",
"psr/container": "~1.0", "psr/container": "~1.0",
"psr/simple-cache": "^1.0", "psr/simple-cache": "^1.0",

View File

@ -39,7 +39,7 @@ use think\initializer\RegisterService;
*/ */
class App extends Container class App extends Container
{ {
const VERSION = '6.0.3'; const VERSION = '6.0.4';
/** /**
* 应用调试模式 * 应用调试模式

View File

@ -116,6 +116,10 @@ class Config
*/ */
public function has(string $name): bool public function has(string $name): bool
{ {
if (false === strpos($name, '.') && !isset($this->config[strtolower($name)])) {
return false;
}
return !is_null($this->get($name)); return !is_null($this->get($name));
} }

View File

@ -91,9 +91,7 @@ class Console
{ {
$this->app = $app; $this->app = $app;
if (!$this->app->initialized()) { $this->initialize();
$this->app->initialize();
}
$this->definition = $this->getDefaultInputDefinition(); $this->definition = $this->getDefaultInputDefinition();
@ -103,6 +101,63 @@ class Console
$this->start(); $this->start();
} }
/**
* 初始化
*/
protected function initialize()
{
if (!$this->app->initialized()) {
$this->app->initialize();
}
$this->makeRequest();
}
/**
* 构造request
*/
protected function makeRequest()
{
$uri = $this->app->config->get('app.url', 'http://localhost');
$components = parse_url($uri);
$server = $_SERVER;
if (isset($components['path'])) {
$server = array_merge($server, [
'SCRIPT_FILENAME' => $components['path'],
'SCRIPT_NAME' => $components['path'],
]);
}
if (isset($components['host'])) {
$server['SERVER_NAME'] = $components['host'];
$server['HTTP_HOST'] = $components['host'];
}
if (isset($components['scheme'])) {
if ('https' === $components['scheme']) {
$server['HTTPS'] = 'on';
$server['SERVER_PORT'] = 443;
} else {
unset($server['HTTPS']);
$server['SERVER_PORT'] = 80;
}
}
if (isset($components['port'])) {
$server['SERVER_PORT'] = $components['port'];
$server['HTTP_HOST'] .= ':' . $components['port'];
}
$server['REQUEST_URI'] = $uri;
/** @var Request $request */
$request = $this->app->make('request');
$request->withServer($server);
}
/** /**
* 添加初始化器 * 添加初始化器
* @param Closure $callback * @param Closure $callback

View File

@ -152,9 +152,10 @@ class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, C
$this->instance($abstract, $concrete); $this->instance($abstract, $concrete);
} else { } else {
$abstract = $this->getAlias($abstract); $abstract = $this->getAlias($abstract);
if ($abstract != $concrete) {
$this->bind[$abstract] = $concrete; $this->bind[$abstract] = $concrete;
} }
}
return $this; return $this;
} }
@ -445,9 +446,9 @@ class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, C
$args[] = $this->getObjectParam($class->getName(), $vars); $args[] = $this->getObjectParam($class->getName(), $vars);
} elseif (1 == $type && !empty($vars)) { } elseif (1 == $type && !empty($vars)) {
$args[] = array_shift($vars); $args[] = array_shift($vars);
} elseif (0 == $type && isset($vars[$name])) { } elseif (0 == $type && array_key_exists($name, $vars)) {
$args[] = $vars[$name]; $args[] = $vars[$name];
} elseif (0 == $type && isset($vars[$lowerName])) { } elseif (0 == $type && array_key_exists($lowerName, $vars)) {
$args[] = $vars[$lowerName]; $args[] = $vars[$lowerName];
} elseif ($param->isDefaultValueAvailable()) { } elseif ($param->isDefaultValueAvailable()) {
$args[] = $param->getDefaultValue(); $args[] = $param->getDefaultValue();

View File

@ -42,6 +42,12 @@ class Http
*/ */
protected $path; protected $path;
/**
* 路由路径
* @var string
*/
protected $routePath;
/** /**
* 是否绑定应用 * 是否绑定应用
* @var bool * @var bool
@ -117,7 +123,6 @@ class Http
* 设置路由目录 * 设置路由目录
* @access public * @access public
* @param string $path 路由定义目录 * @param string $path 路由定义目录
* @return string
*/ */
public function setRoutePath(string $path): void public function setRoutePath(string $path): void
{ {
@ -154,6 +159,9 @@ class Http
*/ */
public function run(Request $request = null): Response public function run(Request $request = null): Response
{ {
//初始化
$this->initialize();
//自动创建request对象 //自动创建request对象
$request = $request ?? $this->app->make('request', [], true); $request = $request ?? $this->app->make('request', [], true);
$this->app->instance('request', $request); $this->app->instance('request', $request);
@ -186,8 +194,6 @@ class Http
*/ */
protected function runWithRequest(Request $request) protected function runWithRequest(Request $request)
{ {
$this->initialize();
// 加载全局中间件 // 加载全局中间件
$this->loadMiddleware(); $this->loadMiddleware();

View File

@ -153,6 +153,18 @@ class Lang
if (function_exists('yaml_parse_file')) { if (function_exists('yaml_parse_file')) {
$result = yaml_parse_file($file); $result = yaml_parse_file($file);
} }
break;
case 'json':
$data = file_get_contents($file);
if($data !== false) {
$data = json_decode($data, true);
if(json_last_error() === JSON_ERROR_NONE) {
$result = $data;
}
}
break; break;
} }

View File

@ -165,12 +165,12 @@ class Route
// 读取路由映射文件 // 读取路由映射文件
$this->import(include $this->app->getRuntimePath() . 'route.php'); $this->import(include $this->app->getRuntimePath() . 'route.php');
} }
$this->config = array_merge($this->config, $this->app->config->get('route'));
} }
protected function init() protected function init()
{ {
$this->config = array_merge($this->config, $this->app->config->get('route'));
if (!empty($this->config['middleware'])) { if (!empty($this->config['middleware'])) {
$this->app->middleware->import($this->config['middleware'], 'route'); $this->app->middleware->import($this->config['middleware'], 'route');
} }
@ -423,7 +423,7 @@ class Route
* @param string $name 路由标识 * @param string $name 路由标识
* @param string $domain 域名 * @param string $domain 域名
* @param string $method 请求类型 * @param string $method 请求类型
* @return RuleItem[] * @return array
*/ */
public function getName(string $name = null, string $domain = null, string $method = '*'): array public function getName(string $name = null, string $domain = null, string $method = '*'): array
{ {
@ -681,6 +681,18 @@ class Route
public function redirect(string $rule, string $route = '', int $status = 301): RuleItem public function redirect(string $rule, string $route = '', int $status = 301): RuleItem
{ {
return $this->rule($rule, function () use ($status, $route) { return $this->rule($rule, function () use ($status, $route) {
$search = $replace = [];
$matches = $this->request->rule()->getVars();
foreach ($matches as $key => $value) {
$search[] = '<' . $key . '>';
$replace[] = $value;
$search[] = ':' . $key;
$replace[] = $value;
}
$route = str_replace($search, $replace, $route);
return Response::create($route, 'redirect')->code($status); return Response::create($route, 'redirect')->code($status);
}, '*'); }, '*');
} }

View File

@ -605,6 +605,7 @@ class Validate
if (isset($this->append[$field])) { if (isset($this->append[$field])) {
// 追加额外的验证规则 // 追加额外的验证规则
$rules = array_unique(array_merge($rules, $this->append[$field]), SORT_REGULAR); $rules = array_unique(array_merge($rules, $this->append[$field]), SORT_REGULAR);
unset($this->append[$field]);
} }
if (empty($rules)) { if (empty($rules)) {
@ -663,7 +664,7 @@ class Validate
$i++; $i++;
} }
return $result; return $result ?? true;
} }
/** /**

View File

@ -87,7 +87,7 @@ class Redis extends Driver
} }
if (0 != $this->options['select']) { if (0 != $this->options['select']) {
$this->handler->select($this->options['select']); $this->handler->select( (int) $this->options['select']);
} }
} }

View File

@ -5,7 +5,6 @@ namespace {%namespace%};
class {%className%} extends \think\Service class {%className%} extends \think\Service
{ {
/** /**
* 注册服务 * 注册服务
* *
@ -16,7 +15,6 @@ class {%className%} extends \think\Service
// //
} }
/** /**
* 执行服务 * 执行服务
* *

View File

@ -58,10 +58,9 @@ class Route extends Command
//触发路由载入完成事件 //触发路由载入完成事件
$this->app->event->trigger(RouteLoaded::class); $this->app->event->trigger(RouteLoaded::class);
$rules = $this->app->route->getName();
$content = '<?php ' . PHP_EOL . 'return '; return '<?php ' . PHP_EOL . 'return unserialize(\'' . serialize($rules) . '\');';
$content .= '\Opis\Closure\unserialize(\'' . \Opis\Closure\serialize($this->app->route->getName()) . '\');';
return $content;
} }
} }

View File

@ -11,18 +11,49 @@
namespace think\console\input; namespace think\console\input;
/**
* 命令行选项
* @package think\console\input
*/
class Option class Option
{ {
// 无需传值
const VALUE_NONE = 1; const VALUE_NONE = 1;
// 必须传值
const VALUE_REQUIRED = 2; const VALUE_REQUIRED = 2;
// 可选传值
const VALUE_OPTIONAL = 4; const VALUE_OPTIONAL = 4;
// 传数组值
const VALUE_IS_ARRAY = 8; const VALUE_IS_ARRAY = 8;
/**
* 选项名
* @var string
*/
private $name; private $name;
/**
* 选项短名称
* @var string
*/
private $shortcut; private $shortcut;
/**
* 选项类型
* @var int
*/
private $mode; private $mode;
/**
* 选项默认值
* @var mixed
*/
private $default; private $default;
/**
* 选项描述
* @var string
*/
private $description; private $description;
/** /**

View File

@ -61,17 +61,24 @@ class CheckRequestCache
public function handle($request, Closure $next, $cache = null) public function handle($request, Closure $next, $cache = null)
{ {
if ($request->isGet() && false !== $cache) { if ($request->isGet() && false !== $cache) {
$cache = $cache ?: $this->getRequestCache($request); if (false === $this->config['request_cache_key']) {
// 关闭当前缓存
$cache = false;
}
$cache = $cache ?? $this->getRequestCache($request);
if ($cache) { if ($cache) {
if (is_array($cache)) { if (is_array($cache)) {
[$key, $expire, $tag] = $cache; [$key, $expire, $tag] = array_pad($cache, 3, null);
} else { } else {
$key = str_replace('|', '/', $request->url()); $key = md5($request->url(true));
$expire = $cache; $expire = $cache;
$tag = null; $tag = null;
} }
$key = $this->parseCacheKey($request, $key);
if (strtotime($request->server('HTTP_IF_MODIFIED_SINCE', '')) + $expire > $request->server('REQUEST_TIME')) { if (strtotime($request->server('HTTP_IF_MODIFIED_SINCE', '')) + $expire > $request->server('REQUEST_TIME')) {
// 读取缓存 // 读取缓存
return Response::create()->code(304); return Response::create()->code(304);
@ -111,6 +118,24 @@ class CheckRequestCache
$except = $this->config['request_cache_except']; $except = $this->config['request_cache_except'];
$tag = $this->config['request_cache_tag']; $tag = $this->config['request_cache_tag'];
foreach ($except as $rule) {
if (0 === stripos($request->url(), $rule)) {
return;
}
}
return [$key, $expire, $tag];
}
/**
* 读取当前地址的请求缓存信息
* @access protected
* @param Request $request
* @param mixed $key
* @return null|string
*/
protected function parseCacheKey($request, $key)
{
if ($key instanceof \Closure) { if ($key instanceof \Closure) {
$key = call_user_func($key, $request); $key = call_user_func($key, $request);
} }
@ -120,12 +145,6 @@ class CheckRequestCache
return; return;
} }
foreach ($except as $rule) {
if (0 === stripos($request->url(), $rule)) {
return;
}
}
if (true === $key) { if (true === $key) {
// 自动缓存功能 // 自动缓存功能
$key = '__URL__'; $key = '__URL__';
@ -140,6 +159,7 @@ class CheckRequestCache
if (false !== strpos($key, ':')) { if (false !== strpos($key, ':')) {
$param = $request->param(); $param = $request->param();
foreach ($param as $item => $val) { foreach ($param as $item => $val) {
if (is_string($val) && false !== strpos($key, ':' . $item)) { if (is_string($val) && false !== strpos($key, ':' . $item)) {
$key = str_replace(':' . $item, $val, $key); $key = str_replace(':' . $item, $val, $key);
@ -158,6 +178,6 @@ class CheckRequestCache
$key = $fun($key); $key = $fun($key);
} }
return [$key, $expire, $tag]; return $key;
} }
} }

View File

@ -237,11 +237,17 @@ abstract class Rule
*/ */
public function getPattern(string $name = '') public function getPattern(string $name = '')
{ {
if ('' === $name) { $pattern = $this->pattern;
return $this->pattern;
if ($this->parent) {
$pattern = array_merge($this->parent->getPattern(), $pattern);
} }
return $this->pattern[$name] ?? null; if ('' === $name) {
return $pattern;
}
return $pattern[$name] ?? null;
} }
/** /**
@ -253,11 +259,26 @@ abstract class Rule
*/ */
public function getOption(string $name = '', $default = null) public function getOption(string $name = '', $default = null)
{ {
if ('' === $name) { $option = $this->option;
return $this->option;
if ($this->parent) {
$parentOption = $this->parent->getOption();
// 合并分组参数
foreach ($this->mergeOptions as $item) {
if (isset($parentOption[$item]) && isset($option[$item])) {
$option[$item] = array_merge($parentOption[$item], $option[$item]);
}
} }
return $this->option[$name] ?? $default; $option = array_merge($parentOption, $option);
}
if ('' === $name) {
return $option;
}
return $option[$name] ?? $default;
} }
/** /**
@ -551,26 +572,6 @@ abstract class Rule
return $this; return $this;
} }
/**
* 合并分组参数
* @access public
* @return array
*/
public function mergeGroupOptions(): array
{
$parentOption = $this->parent->getOption();
// 合并分组参数
foreach ($this->mergeOptions as $item) {
if (isset($parentOption[$item]) && isset($this->option[$item])) {
$this->option[$item] = array_merge($parentOption[$item], $this->option[$item]);
}
}
$this->option = array_merge($parentOption, $this->option);
return $this->option;
}
/** /**
* 解析匹配到的规则路由 * 解析匹配到的规则路由
* @access public * @access public
@ -590,24 +591,31 @@ abstract class Rule
} }
// 替换路由地址中的变量 // 替换路由地址中的变量
if (is_string($route) && !empty($matches)) { $extraParams = true;
$search = $replace = []; $search = $replace = [];
$depr = $this->router->config('pathinfo_depr');
foreach ($matches as $key => $value) { foreach ($matches as $key => $value) {
$search[] = '<' . $key . '>'; $search[] = '<' . $key . '>';
$replace[] = $value; $replace[] = $value;
$search[] = ':' . $key; $search[] = ':' . $key;
$replace[] = $value; $replace[] = $value;
if (strpos($value, $depr)) {
$extraParams = false;
}
} }
if (is_string($route)) {
$route = str_replace($search, $replace, $route); $route = str_replace($search, $replace, $route);
} }
// 解析额外参数 // 解析额外参数
if ($extraParams) {
$count = substr_count($rule, '/'); $count = substr_count($rule, '/');
$url = array_slice(explode('|', $url), $count + 1); $url = array_slice(explode('|', $url), $count + 1);
$this->parseUrlParams(implode('|', $url), $matches); $this->parseUrlParams(implode('|', $url), $matches);
}
$this->vars = $matches; $this->vars = $matches;
@ -630,7 +638,7 @@ abstract class Rule
} elseif ($route instanceof Closure) { } elseif ($route instanceof Closure) {
// 执行闭包 // 执行闭包
$result = new CallbackDispatch($request, $this, $route, $this->vars); $result = new CallbackDispatch($request, $this, $route, $this->vars);
} elseif (false !== strpos($route, '@') || false !== strpos($route, '::')) { } elseif (false !== strpos($route, '@') || false !== strpos($route, '::') || false !== strpos($route, '\\')) {
// 路由到类的方法 // 路由到类的方法
$route = str_replace('::', '@', $route); $route = str_replace('::', '@', $route);
$result = $this->dispatchMethod($request, $route); $result = $this->dispatchMethod($request, $route);

View File

@ -147,19 +147,13 @@ class RuleGroup extends Rule
// 获取当前路由规则 // 获取当前路由规则
$method = strtolower($request->method()); $method = strtolower($request->method());
$rules = $this->getRules($method); $rules = $this->getRules($method);
$option = $this->getOption();
if ($this->parent) { if (isset($option['complete_match'])) {
// 合并分组参数 $completeMatch = $option['complete_match'];
$this->mergeGroupOptions();
// 合并分组变量规则
$this->pattern = array_merge($this->parent->getPattern(), $this->pattern);
} }
if (isset($this->option['complete_match'])) { if (!empty($option['merge_rule_regex'])) {
$completeMatch = $this->option['complete_match'];
}
if (!empty($this->option['merge_rule_regex'])) {
// 合并路由正则规则进行路由匹配检查 // 合并路由正则规则进行路由匹配检查
$result = $this->checkMergeRuleRegex($request, $rules, $url, $completeMatch); $result = $this->checkMergeRuleRegex($request, $rules, $url, $completeMatch);
@ -179,7 +173,7 @@ class RuleGroup extends Rule
if ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) { if ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) {
// 未匹配所有路由的路由规则处理 // 未匹配所有路由的路由规则处理
$result = $this->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->mergeGroupOptions()); $result = $this->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->getOption());
} else { } else {
$result = false; $result = false;
} }
@ -495,7 +489,7 @@ class RuleGroup extends Rule
} }
return array_filter($this->rules, function ($item) use ($method) { return array_filter($this->rules, function ($item) use ($method) {
return $method == $item[0] || $item[0] == '*'; return $method == $item[0] || '*' == $item[0];
}); });
} }

View File

@ -191,12 +191,12 @@ class RuleItem extends Rule
} }
// 合并分组参数 // 合并分组参数
$option = $this->mergeGroupOptions(); $option = $this->getOption();
$pattern = $this->getPattern();
$url = $this->urlSuffixCheck($request, $url, $option); $url = $this->urlSuffixCheck($request, $url, $option);
if (is_null($match)) { if (is_null($match)) {
$match = $this->match($url, $option, $completeMatch); $match = $this->match($url, $option, $pattern, $completeMatch);
} }
if (false !== $match) { if (false !== $match) {
@ -248,17 +248,17 @@ class RuleItem extends Rule
* @access private * @access private
* @param string $url URL地址 * @param string $url URL地址
* @param array $option 路由参数 * @param array $option 路由参数
* @param bool $completeMatch 路由是否完全匹配 * @param array $pattern 变量规则
* @param bool $completeMatch 是否完全匹配
* @return array|false * @return array|false
*/ */
private function match(string $url, array $option, bool $completeMatch) private function match(string $url, array $option, array $pattern, bool $completeMatch)
{ {
if (isset($option['complete_match'])) { if (isset($option['complete_match'])) {
$completeMatch = $option['complete_match']; $completeMatch = $option['complete_match'];
} }
$depr = $this->router->config('pathinfo_depr'); $depr = $this->router->config('pathinfo_depr');
$pattern = array_merge($this->parent->getPattern(), $this->pattern);
// 检查完整规则定义 // 检查完整规则定义
if (isset($pattern['__url__']) && !preg_match(0 === strpos($pattern['__url__'], '/') ? $pattern['__url__'] : '/^' . $pattern['__url__'] . ($completeMatch ? '$' : '') . '/', str_replace('|', $depr, $url))) { if (isset($pattern['__url__']) && !preg_match(0 === strpos($pattern['__url__'], '/') ? $pattern['__url__'] : '/^' . $pattern['__url__'] . ($completeMatch ? '$' : '') . '/', str_replace('|', $depr, $url))) {

View File

@ -46,10 +46,11 @@ class RuleName
public function setName(string $name, RuleItem $ruleItem, bool $first = false): void public function setName(string $name, RuleItem $ruleItem, bool $first = false): void
{ {
$name = strtolower($name); $name = strtolower($name);
$item = $this->getRuleItemInfo($ruleItem);
if ($first && isset($this->item[$name])) { if ($first && isset($this->item[$name])) {
array_unshift($this->item[$name], $ruleItem); array_unshift($this->item[$name], $item);
} else { } else {
$this->item[$name][] = $ruleItem; $this->item[$name][] = $item;
} }
} }
@ -179,8 +180,8 @@ class RuleName
$result = $this->item[$name]; $result = $this->item[$name];
} else { } else {
foreach ($this->item[$name] as $item) { foreach ($this->item[$name] as $item) {
$itemDomain = $item->getDomain(); $itemDomain = $item['domain'];
$itemMethod = $item->getMethod(); $itemMethod = $item['method'];
if (($itemDomain == $domain || '-' == $itemDomain) && ('*' == $itemMethod || '*' == $method || $method == $itemMethod)) { if (($itemDomain == $domain || '-' == $itemDomain) && ('*' == $itemMethod || '*' == $method || $method == $itemMethod)) {
$result[] = $item; $result[] = $item;
@ -192,4 +193,19 @@ class RuleName
return $result; return $result;
} }
/**
* 获取路由信息
* @access protected
* @param RuleItem $item 路由规则
* @return array
*/
protected function getRuleItemInfo(RuleItem $item): array
{
return [
'rule' => $item->getRule(),
'domain' => $item->getDomain(),
'method' => $item->getMethod(),
'suffix' => $item->getSuffix(),
];
}
} }

View File

@ -302,10 +302,10 @@ class Url
$port = $request->port(); $port = $request->port();
foreach ($rule as $item) { foreach ($rule as $item) {
$url = $item->getRule(); $url = $item['rule'];
$pattern = $this->parseVar($url); $pattern = $this->parseVar($url);
$domain = $item->getDomain(); $domain = $item['domain'];
$suffix = $item->getSuffix(); $suffix = $item['suffix'];
if ('-' == $domain) { if ('-' == $domain) {
$domain = is_string($allowDomain) ? $allowDomain : $request->host(true); $domain = is_string($allowDomain) ? $allowDomain : $request->host(true);

View File

@ -39,7 +39,7 @@ class File implements SessionHandlerInterface
$this->config = array_merge($this->config, $config); $this->config = array_merge($this->config, $config);
if (empty($this->config['path'])) { if (empty($this->config['path'])) {
$this->config['path'] = $app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . 'session' . DIRECTORY_SEPARATOR; $this->config['path'] = $app->getRuntimePath() . 'session' . DIRECTORY_SEPARATOR;
} elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) {
$this->config['path'] .= DIRECTORY_SEPARATOR; $this->config['path'] .= DIRECTORY_SEPARATOR;
} }

View File

@ -149,6 +149,7 @@ class ContainerTest extends TestCase
$container->bind('name2', $object); $container->bind('name2', $object);
$container->bind('name3', Taylor::class);
$container->bind('name3', Taylor::class); $container->bind('name3', Taylor::class);
$container->name4 = $object; $container->name4 = $object;

View File

@ -123,6 +123,7 @@ class HttpTest extends TestCase
$response = m::mock(Response::class); $response = m::mock(Response::class);
$this->app->shouldReceive('instance')->once()->with('request', $request); $this->app->shouldReceive('instance')->once()->with('request', $request);
$this->app->shouldReceive('initialize')->once();
$exception = new Exception(); $exception = new Exception();

View File

@ -203,7 +203,7 @@ abstract class PDOConnection extends Connection
* @param array $config 连接信息 * @param array $config 连接信息
* @return string * @return string
*/ */
abstract protected function parseDsn(array $config); abstract protected function parseDsn(array $config): string;
/** /**
* 取得数据表的字段信息 * 取得数据表的字段信息
@ -211,7 +211,7 @@ abstract class PDOConnection extends Connection
* @param string $tableName 数据表名称 * @param string $tableName 数据表名称
* @return array * @return array
*/ */
abstract public function getFields(string $tableName); abstract public function getFields(string $tableName): array;
/** /**
* 取得数据库的表信息 * 取得数据库的表信息
@ -219,7 +219,7 @@ abstract class PDOConnection extends Connection
* @param string $dbName 数据库名称 * @param string $dbName 数据库名称
* @return array * @return array
*/ */
abstract public function getTables(string $dbName); abstract public function getTables(string $dbName = ''): array;
/** /**
* 对返数据表字段信息进行大小写转换出来 * 对返数据表字段信息进行大小写转换出来
@ -728,16 +728,13 @@ abstract class PDOConnection extends Connection
*/ */
public function getPDOStatement(string $sql, array $bind = [], bool $master = false, bool $procedure = false): PDOStatement public function getPDOStatement(string $sql, array $bind = [], bool $master = false, bool $procedure = false): PDOStatement
{ {
try {
$this->initConnect($this->readMaster ?: $master); $this->initConnect($this->readMaster ?: $master);
// 记录SQL语句 // 记录SQL语句
$this->queryStr = $sql; $this->queryStr = $sql;
$this->bind = $bind; $this->bind = $bind;
$this->db->updateQueryTimes(); $this->db->updateQueryTimes();
try {
$this->queryStartTime = microtime(true); $this->queryStartTime = microtime(true);
// 预处理 // 预处理
@ -1394,11 +1391,11 @@ abstract class PDOConnection extends Connection
*/ */
public function startTrans(): void public function startTrans(): void
{ {
try {
$this->initConnect(true); $this->initConnect(true);
++$this->transTimes; ++$this->transTimes;
try {
if (1 == $this->transTimes) { if (1 == $this->transTimes) {
$this->linkID->beginTransaction(); $this->linkID->beginTransaction();
} elseif ($this->transTimes > 1 && $this->supportSavepoint()) { } elseif ($this->transTimes > 1 && $this->supportSavepoint()) {
@ -1412,10 +1409,11 @@ abstract class PDOConnection extends Connection
--$this->transTimes; --$this->transTimes;
++$this->reConnectTimes; ++$this->reConnectTimes;
$this->close()->startTrans(); $this->close()->startTrans();
} } else {
throw $e; throw $e;
} }
} }
}
/** /**
* 用于非自动提交状态下面的查询提交 * 用于非自动提交状态下面的查询提交

View File

@ -378,7 +378,7 @@ trait WhereQuery
} elseif (is_string($field)) { } elseif (is_string($field)) {
if (preg_match('/[,=\<\'\"\(\s]/', $field)) { if (preg_match('/[,=\<\'\"\(\s]/', $field)) {
return $this->whereRaw($field, is_array($op) ? $op : [], $logic); return $this->whereRaw($field, is_array($op) ? $op : [], $logic);
} elseif (is_string($op) && strtolower($op) == 'exp') { } elseif (is_string($op) && strtolower($op) == 'exp' && !is_null($condition)) {
$bind = isset($param[2]) && is_array($param[2]) ? $param[2] : []; $bind = isset($param[2]) && is_array($param[2]) ? $param[2] : [];
return $this->whereExp($field, $condition, $bind, $logic); return $this->whereExp($field, $condition, $bind, $logic);
} }
@ -514,18 +514,10 @@ trait WhereQuery
} }
if ($condition) { if ($condition) {
if ($query instanceof Closure) {
$query($this, $condition);
} elseif (is_array($query)) {
$this->where($query); $this->where($query);
}
} elseif ($otherwise) { } elseif ($otherwise) {
if ($otherwise instanceof Closure) {
$otherwise($this, $condition);
} elseif (is_array($otherwise)) {
$this->where($otherwise); $this->where($otherwise);
} }
}
return $this; return $this;
} }

View File

@ -17,6 +17,34 @@ use Exception;
/** /**
* Database相关异常处理类 * Database相关异常处理类
*/ */
if (class_exists('think\Exception')) {
class DbException extends \think\Exception
{
/**
* DbException constructor.
* @access public
* @param string $message
* @param array $config
* @param string $sql
* @param int $code
*/
public function __construct(string $message, array $config = [], string $sql = '', int $code = 10500)
{
$this->message = $message;
$this->code = $code;
$this->setData('Database Status', [
'Error Code' => $code,
'Error Message' => $message,
'Error SQL' => $sql,
]);
unset($config['username'], $config['password']);
$this->setData('Database Config', $config);
}
}
} else {
class DbException extends Exception class DbException extends Exception
{ {
/** /**
@ -79,3 +107,4 @@ class DbException extends Exception
return $this->data; return $this->data;
} }
} }
}

View File

@ -99,6 +99,26 @@ abstract class Relation
return $this->query; return $this->query;
} }
/**
* 获取关联表外键
* @access public
* @return string
*/
public function getForeignKey()
{
return $this->foreignKey;
}
/**
* 获取关联表主键
* @access public
* @return string
*/
public function getLocalKey()
{
return $this->localKey;
}
/** /**
* 获取当前的关联模型类的实例 * 获取当前的关联模型类的实例
* @access public * @access public

View File

@ -185,7 +185,11 @@ trait Attribute
*/ */
protected function getRealFieldName(string $name): string protected function getRealFieldName(string $name): string
{ {
return $this->strict ? $name : Str::snake($name); if ($this->convertNameToCamel || !$this->strict) {
return Str::snake($name);
}
return $name;
} }
/** /**
@ -302,7 +306,7 @@ trait Attribute
// 只读字段不允许更新 // 只读字段不允许更新
foreach ($this->readonly as $key => $field) { foreach ($this->readonly as $key => $field) {
if (isset($data[$field])) { if (array_key_exists($field, $data)) {
unset($data[$field]); unset($data[$field]);
} }
} }

View File

@ -48,6 +48,24 @@ trait Conversion
*/ */
protected $resultSetType; protected $resultSetType;
/**
* 数据命名是否自动转为驼峰
* @var bool
*/
protected $convertNameToCamel;
/**
* 转换数据为驼峰命名(用于输出)
* @access public
* @param bool $toCamel 是否自动驼峰命名
* @return $this
*/
public function convertNameToCamel(bool $toCamel = true)
{
$this->convertNameToCamel = $toCamel;
return $this;
}
/** /**
* 设置需要附加的输出属性 * 设置需要附加的输出属性
* @access public * @access public
@ -181,6 +199,16 @@ trait Conversion
$this->appendAttrToArray($item, $key, $name); $this->appendAttrToArray($item, $key, $name);
} }
if ($this->convertNameToCamel) {
foreach ($item as $key => $val) {
$name = Str::camel($key);
if ($name !== $key) {
$item[$name] = $val;
unset($item[$key]);
}
}
}
return $item; return $item;
} }

View File

@ -440,6 +440,7 @@ class BelongsToMany extends Relation
protected function belongsToManyQuery(string $foreignKey, string $localKey, array $condition = []): Query protected function belongsToManyQuery(string $foreignKey, string $localKey, array $condition = []): Query
{ {
// 关联查询封装 // 关联查询封装
if (empty($this->baseQuery)) {
$tableName = $this->query->getTable(); $tableName = $this->query->getTable();
$table = $this->pivot->db()->getTable(); $table = $this->pivot->db()->getTable();
$fields = $this->getQueryFields($tableName); $fields = $this->getQueryFields($tableName);
@ -454,6 +455,8 @@ class BelongsToMany extends Relation
->join([$table => 'pivot'], 'pivot.' . $foreignKey . '=' . $tableName . '.' . $this->query->getPk()) ->join([$table => 'pivot'], 'pivot.' . $foreignKey . '=' . $tableName . '.' . $this->query->getPk())
->where($condition); ->where($condition);
}
return $this->query; return $this->query;
} }
@ -666,7 +669,11 @@ class BelongsToMany extends Relation
$localKey = $this->localKey; $localKey = $this->localKey;
// 关联查询 // 关联查询
if (null === $this->parent->getKey()) {
$condition = ['pivot.' . $localKey, 'exp', new Raw('=' . $this->parent->getTable() . '.' . $this->parent->getPk())];
} else {
$condition = ['pivot.' . $localKey, '=', $this->parent->getKey()]; $condition = ['pivot.' . $localKey, '=', $this->parent->getKey()];
}
$this->belongsToManyQuery($foreignKey, $localKey, [$condition]); $this->belongsToManyQuery($foreignKey, $localKey, [$condition]);

View File

@ -181,7 +181,7 @@ class HasOne extends OneToOne
$fields = $this->getRelationQueryFields($fields, $model); $fields = $this->getRelationQueryFields($fields, $model);
$softDelete = $this->query->getOptions('soft_delete'); $softDelete = $this->query->getOptions('soft_delete');
$query = $query ?: $this->parent->db()->alias($model); $query = $query ? $query->alias($model) : $this->parent->db()->alias($model);
return $query->field($fields) return $query->field($fields)
->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType ?: $this->joinType) ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType ?: $this->joinType)

View File

@ -307,10 +307,6 @@ abstract class OneToOne extends Relation
$this->query->field($this->withField); $this->query->field($this->withField);
} }
if ($this->query->getOptions('order')) {
$this->query->group($key);
}
$list = $this->query $list = $this->query
->where($where) ->where($where)
->with($subRelation) ->with($subRelation)

View File

@ -40,12 +40,15 @@ class Console
{ {
$request = $app->request; $request = $app->request;
$contentType = $response->getHeader('Content-Type'); $contentType = $response->getHeader('Content-Type');
$accept = $request->header('accept', '');
if (strpos($accept, 'application/json') === 0 || $request->isAjax()) { if ($request->isJson() || $request->isAjax()) {
return false; return false;
} elseif (!empty($contentType) && strpos($contentType, 'html') === false) { } elseif (!empty($contentType) && strpos($contentType, 'html') === false) {
return false; return false;
} elseif ($response->getCode() == 204) {
return false;
} }
// 获取基本信息 // 获取基本信息
$runtime = number_format(microtime(true) - $app->getBeginTime(), 10, '.', ''); $runtime = number_format(microtime(true) - $app->getBeginTime(), 10, '.', '');
$reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞';

View File

@ -41,13 +41,14 @@ class Html
public function output(App $app, Response $response, array $log = []) public function output(App $app, Response $response, array $log = [])
{ {
$request = $app->request; $request = $app->request;
$contentType = $response->getHeader('Content-Type'); $contentType = $response->getHeader('Content-Type');
$accept = $request->header('accept', '');
if (strpos($accept, 'application/json') === 0 || $request->isAjax()) { if ($request->isJson() || $request->isAjax()) {
return false; return false;
} elseif (!empty($contentType) && strpos($contentType, 'html') === false) { } elseif (!empty($contentType) && strpos($contentType, 'html') === false) {
return false; return false;
} elseif ($response->getCode() == 204) {
return false;
} }
// 获取基本信息 // 获取基本信息