diff --git a/application/index/view/auth/login.html b/application/index/view/auth/login.html
index 7e323c83..6c2e5c96 100644
--- a/application/index/view/auth/login.html
+++ b/application/index/view/auth/login.html
@@ -3,7 +3,7 @@
{block name="title"}登录 - {$config.site_name}{/block}
{block name="css"}
-
+
{/block}
{block name="main"}
@@ -42,5 +42,5 @@
{/block}
{block name="js"}
-
+
{/block}
\ No newline at end of file
diff --git a/application/index/view/auth/register.html b/application/index/view/auth/register.html
index 9993359b..880ea46c 100644
--- a/application/index/view/auth/register.html
+++ b/application/index/view/auth/register.html
@@ -3,7 +3,7 @@
{block name="title"}注册 - {$config.site_name}{/block}
{block name="css"}
-
+
{/block}
{block name="main"}
@@ -67,5 +67,5 @@
{/block}
{block name="js"}
-
+
{/block}
diff --git a/composer.lock b/composer.lock
index c4b44ddf..f8c6dff2 100644
--- a/composer.lock
+++ b/composer.lock
@@ -157,16 +157,16 @@
},
{
"name": "guzzlehttp/guzzle",
- "version": "6.3.3",
+ "version": "6.4.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
+ "reference": "0895c932405407fd3a7368b6910c09a24d26db11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11",
+ "reference": "0895c932405407fd3a7368b6910c09a24d26db11",
"shasum": "",
"mirrors": [
{
@@ -176,14 +176,15 @@
]
},
"require": {
+ "ext-json": "*",
"guzzlehttp/promises": "^1.0",
- "guzzlehttp/psr7": "^1.4",
+ "guzzlehttp/psr7": "^1.6.1",
"php": ">=5.5"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
- "psr/log": "^1.0"
+ "psr/log": "^1.1"
},
"suggest": {
"psr/log": "Required for using the Log middleware"
@@ -195,12 +196,12 @@
}
},
"autoload": {
- "files": [
- "src/functions_include.php"
- ],
"psr-4": {
"GuzzleHttp\\": "src/"
- }
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -224,7 +225,7 @@
"rest",
"web service"
],
- "time": "2018-04-22T15:46:56+00:00"
+ "time": "2019-10-23T15:58:00+00:00"
},
{
"name": "guzzlehttp/promises",
@@ -362,16 +363,16 @@
},
{
"name": "phpmailer/phpmailer",
- "version": "v6.0.7",
+ "version": "v6.1.1",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
- "reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59"
+ "reference": "26bd96350b0b2fcbf0ef4e6f0f9cf3528302a9d8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/0c41a36d4508d470e376498c1c0c527aa36a2d59",
- "reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59",
+ "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/26bd96350b0b2fcbf0ef4e6f0f9cf3528302a9d8",
+ "reference": "26bd96350b0b2fcbf0ef4e6f0f9cf3528302a9d8",
"shasum": "",
"mirrors": [
{
@@ -410,17 +411,17 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
- "LGPL-2.1"
+ "LGPL-2.1-only"
],
"authors": [
- {
- "name": "Jim Jagielski",
- "email": "jimjag@gmail.com"
- },
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
+ {
+ "name": "Jim Jagielski",
+ "email": "jimjag@gmail.com"
+ },
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
@@ -430,7 +431,7 @@
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
- "time": "2019-02-01T15:04:28+00:00"
+ "time": "2019-09-27T21:33:43+00:00"
},
{
"name": "psr/http-message",
@@ -490,16 +491,16 @@
},
{
"name": "qcloud/cos-sdk-v5",
- "version": "v1.3.3",
+ "version": "v1.3.4",
"source": {
"type": "git",
"url": "https://github.com/tencentyun/cos-php-sdk-v5.git",
- "reference": "cd1b9cefa04521eaf125a82eb53552d9a87aae4d"
+ "reference": "1b32aa422f6dffe4ea411e5095e4b0da9135551b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/cd1b9cefa04521eaf125a82eb53552d9a87aae4d",
- "reference": "cd1b9cefa04521eaf125a82eb53552d9a87aae4d",
+ "url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/1b32aa422f6dffe4ea411e5095e4b0da9135551b",
+ "reference": "1b32aa422f6dffe4ea411e5095e4b0da9135551b",
"shasum": "",
"mirrors": [
{
@@ -538,20 +539,20 @@
"php",
"qcloud"
],
- "time": "2019-08-07T10:15:47+00:00"
+ "time": "2019-09-02T12:08:44+00:00"
},
{
"name": "qiniu/php-sdk",
- "version": "v7.2.9",
+ "version": "v7.2.10",
"source": {
"type": "git",
"url": "https://github.com/qiniu/php-sdk.git",
- "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90"
+ "reference": "d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/afe7d8715d8a688b1d8d8cdf031240d2363dad90",
- "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90",
+ "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8",
+ "reference": "d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8",
"shasum": "",
"mirrors": [
{
@@ -595,7 +596,7 @@
"sdk",
"storage"
],
- "time": "2019-07-09T07:55:07+00:00"
+ "time": "2019-10-28T10:23:23+00:00"
},
{
"name": "ralouphie/getallheaders",
@@ -711,16 +712,16 @@
},
{
"name": "topthink/framework",
- "version": "v5.1.38",
+ "version": "v5.1.38.1",
"source": {
"type": "git",
"url": "https://github.com/top-think/framework.git",
- "reference": "b538d2615794bfd05455b6f8232a359d09f5a8df"
+ "reference": "12d15c29d5d6a972fc8bfc8db005d64d4786028c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/top-think/framework/zipball/b538d2615794bfd05455b6f8232a359d09f5a8df",
- "reference": "b538d2615794bfd05455b6f8232a359d09f5a8df",
+ "url": "https://api.github.com/repos/top-think/framework/zipball/12d15c29d5d6a972fc8bfc8db005d64d4786028c",
+ "reference": "12d15c29d5d6a972fc8bfc8db005d64d4786028c",
"shasum": "",
"mirrors": [
{
@@ -764,7 +765,7 @@
"orm",
"thinkphp"
],
- "time": "2019-08-09T07:12:36+00:00"
+ "time": "2019-08-12T00:58:30+00:00"
},
{
"name": "topthink/think-captcha",
@@ -906,16 +907,16 @@
},
{
"name": "upyun/sdk",
- "version": "3.3.0",
+ "version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/upyun/php-sdk.git",
- "reference": "1a2dd5ae31047956c733aef0f764f3a527d30628"
+ "reference": "b4819fd941e3f19a886f8b3c5f8bffcb8279185f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/upyun/php-sdk/zipball/1a2dd5ae31047956c733aef0f764f3a527d30628",
- "reference": "1a2dd5ae31047956c733aef0f764f3a527d30628",
+ "url": "https://api.github.com/repos/upyun/php-sdk/zipball/b4819fd941e3f19a886f8b3c5f8bffcb8279185f",
+ "reference": "b4819fd941e3f19a886f8b3c5f8bffcb8279185f",
"shasum": "",
"mirrors": [
{
@@ -945,10 +946,6 @@
"MIT"
],
"authors": [
- {
- "name": "totoleo",
- "email": "totoleo@163.com"
- },
{
"name": "lfeng",
"email": "bonevv@gmail.com"
@@ -957,6 +954,10 @@
"name": "lvtongda",
"email": "riyao.lyu@gmail.com"
},
+ {
+ "name": "totoleo",
+ "email": "totoleo@163.com"
+ },
{
"name": "sabakugaara",
"email": "senellise@gmail.com"
@@ -968,7 +969,7 @@
"sdk",
"upyun"
],
- "time": "2017-11-12T09:17:42+00:00"
+ "time": "2019-04-29T09:27:51+00:00"
}
],
"packages-dev": [],
diff --git a/thinkphp/helper.php b/thinkphp/helper.php
index fc2ca8c8..72b9e9fd 100644
--- a/thinkphp/helper.php
+++ b/thinkphp/helper.php
@@ -686,7 +686,13 @@ if (!function_exists('widget')) {
*/
function widget($name, $data = [])
{
- return app()->action($name, $data, 'widget');
+ $result = app()->action($name, $data, 'widget');
+
+ if (is_object($result)) {
+ $result = $result->getContent();
+ }
+
+ return $result;
}
}
diff --git a/thinkphp/library/think/Collection.php b/thinkphp/library/think/Collection.php
index d58c8999..8251fc8f 100644
--- a/thinkphp/library/think/Collection.php
+++ b/thinkphp/library/think/Collection.php
@@ -353,7 +353,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
$result = isset($data[$field]) ? $data[$field] : null;
}
- switch ($operator) {
+ switch (strtolower($operator)) {
case '===':
return $result === $value;
case '!==':
diff --git a/thinkphp/library/think/View.php b/thinkphp/library/think/View.php
index 17860a6b..284dd41a 100644
--- a/thinkphp/library/think/View.php
+++ b/thinkphp/library/think/View.php
@@ -160,7 +160,10 @@ class View
*/
public function filter($filter)
{
- $this->filter = $filter;
+ if ($filter) {
+ $this->filter = $filter;
+ }
+
return $this;
}
diff --git a/update.sql b/update.sql.b
similarity index 100%
rename from update.sql
rename to update.sql.b
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index f66d2bb0..62974bf8 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -154,17 +154,17 @@
},
{
"name": "guzzlehttp/guzzle",
- "version": "6.3.3",
- "version_normalized": "6.3.3.0",
+ "version": "6.4.1",
+ "version_normalized": "6.4.1.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
+ "reference": "0895c932405407fd3a7368b6910c09a24d26db11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11",
+ "reference": "0895c932405407fd3a7368b6910c09a24d26db11",
"shasum": "",
"mirrors": [
{
@@ -174,19 +174,20 @@
]
},
"require": {
+ "ext-json": "*",
"guzzlehttp/promises": "^1.0",
- "guzzlehttp/psr7": "^1.4",
+ "guzzlehttp/psr7": "^1.6.1",
"php": ">=5.5"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
- "psr/log": "^1.0"
+ "psr/log": "^1.1"
},
"suggest": {
"psr/log": "Required for using the Log middleware"
},
- "time": "2018-04-22T15:46:56+00:00",
+ "time": "2019-10-23T15:58:00+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -195,12 +196,12 @@
},
"installation-source": "dist",
"autoload": {
- "files": [
- "src/functions_include.php"
- ],
"psr-4": {
"GuzzleHttp\\": "src/"
- }
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -365,17 +366,17 @@
},
{
"name": "phpmailer/phpmailer",
- "version": "v6.0.7",
- "version_normalized": "6.0.7.0",
+ "version": "v6.1.1",
+ "version_normalized": "6.1.1.0",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
- "reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59"
+ "reference": "26bd96350b0b2fcbf0ef4e6f0f9cf3528302a9d8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/0c41a36d4508d470e376498c1c0c527aa36a2d59",
- "reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59",
+ "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/26bd96350b0b2fcbf0ef4e6f0f9cf3528302a9d8",
+ "reference": "26bd96350b0b2fcbf0ef4e6f0f9cf3528302a9d8",
"shasum": "",
"mirrors": [
{
@@ -406,7 +407,7 @@
"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)"
},
- "time": "2019-02-01T15:04:28+00:00",
+ "time": "2019-09-27T21:33:43+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -416,17 +417,17 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
- "LGPL-2.1"
+ "LGPL-2.1-only"
],
"authors": [
- {
- "name": "Jim Jagielski",
- "email": "jimjag@gmail.com"
- },
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
+ {
+ "name": "Jim Jagielski",
+ "email": "jimjag@gmail.com"
+ },
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
@@ -497,17 +498,17 @@
},
{
"name": "qcloud/cos-sdk-v5",
- "version": "v1.3.3",
- "version_normalized": "1.3.3.0",
+ "version": "v1.3.4",
+ "version_normalized": "1.3.4.0",
"source": {
"type": "git",
"url": "https://github.com/tencentyun/cos-php-sdk-v5.git",
- "reference": "cd1b9cefa04521eaf125a82eb53552d9a87aae4d"
+ "reference": "1b32aa422f6dffe4ea411e5095e4b0da9135551b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/cd1b9cefa04521eaf125a82eb53552d9a87aae4d",
- "reference": "cd1b9cefa04521eaf125a82eb53552d9a87aae4d",
+ "url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/1b32aa422f6dffe4ea411e5095e4b0da9135551b",
+ "reference": "1b32aa422f6dffe4ea411e5095e4b0da9135551b",
"shasum": "",
"mirrors": [
{
@@ -520,7 +521,7 @@
"guzzle/guzzle": "~3.7",
"php": ">=5.3.0"
},
- "time": "2019-08-07T10:15:47+00:00",
+ "time": "2019-09-02T12:08:44+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -551,17 +552,17 @@
},
{
"name": "qiniu/php-sdk",
- "version": "v7.2.9",
- "version_normalized": "7.2.9.0",
+ "version": "v7.2.10",
+ "version_normalized": "7.2.10.0",
"source": {
"type": "git",
"url": "https://github.com/qiniu/php-sdk.git",
- "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90"
+ "reference": "d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/afe7d8715d8a688b1d8d8cdf031240d2363dad90",
- "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90",
+ "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8",
+ "reference": "d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8",
"shasum": "",
"mirrors": [
{
@@ -577,7 +578,7 @@
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.3"
},
- "time": "2019-07-09T07:55:07+00:00",
+ "time": "2019-10-28T10:23:23+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -726,17 +727,17 @@
},
{
"name": "topthink/framework",
- "version": "v5.1.38",
- "version_normalized": "5.1.38.0",
+ "version": "v5.1.38.1",
+ "version_normalized": "5.1.38.1",
"source": {
"type": "git",
"url": "https://github.com/top-think/framework.git",
- "reference": "b538d2615794bfd05455b6f8232a359d09f5a8df"
+ "reference": "12d15c29d5d6a972fc8bfc8db005d64d4786028c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/top-think/framework/zipball/b538d2615794bfd05455b6f8232a359d09f5a8df",
- "reference": "b538d2615794bfd05455b6f8232a359d09f5a8df",
+ "url": "https://api.github.com/repos/top-think/framework/zipball/12d15c29d5d6a972fc8bfc8db005d64d4786028c",
+ "reference": "12d15c29d5d6a972fc8bfc8db005d64d4786028c",
"shasum": "",
"mirrors": [
{
@@ -758,7 +759,7 @@
"sebastian/phpcpd": "2.*",
"squizlabs/php_codesniffer": "2.*"
},
- "time": "2019-08-09T07:12:36+00:00",
+ "time": "2019-08-12T00:58:30+00:00",
"type": "think-framework",
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
@@ -929,17 +930,17 @@
},
{
"name": "upyun/sdk",
- "version": "3.3.0",
- "version_normalized": "3.3.0.0",
+ "version": "3.4.0",
+ "version_normalized": "3.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/upyun/php-sdk.git",
- "reference": "1a2dd5ae31047956c733aef0f764f3a527d30628"
+ "reference": "b4819fd941e3f19a886f8b3c5f8bffcb8279185f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/upyun/php-sdk/zipball/1a2dd5ae31047956c733aef0f764f3a527d30628",
- "reference": "1a2dd5ae31047956c733aef0f764f3a527d30628",
+ "url": "https://api.github.com/repos/upyun/php-sdk/zipball/b4819fd941e3f19a886f8b3c5f8bffcb8279185f",
+ "reference": "b4819fd941e3f19a886f8b3c5f8bffcb8279185f",
"shasum": "",
"mirrors": [
{
@@ -958,7 +959,7 @@
"phpdocumentor/phpdocumentor": "^2.9",
"phpunit/phpunit": "~4.0"
},
- "time": "2017-11-12T09:17:42+00:00",
+ "time": "2019-04-29T09:27:51+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -971,10 +972,6 @@
"MIT"
],
"authors": [
- {
- "name": "totoleo",
- "email": "totoleo@163.com"
- },
{
"name": "lfeng",
"email": "bonevv@gmail.com"
@@ -983,6 +980,10 @@
"name": "lvtongda",
"email": "riyao.lyu@gmail.com"
},
+ {
+ "name": "totoleo",
+ "email": "totoleo@163.com"
+ },
{
"name": "sabakugaara",
"email": "senellise@gmail.com"
diff --git a/vendor/guzzlehttp/guzzle/.php_cs b/vendor/guzzlehttp/guzzle/.php_cs
new file mode 100644
index 00000000..a8ace8aa
--- /dev/null
+++ b/vendor/guzzlehttp/guzzle/.php_cs
@@ -0,0 +1,21 @@
+setRiskyAllowed(true)
+ ->setRules([
+ '@PSR2' => true,
+ 'array_syntax' => ['syntax' => 'short'],
+ 'declare_strict_types' => false,
+ 'concat_space' => ['spacing'=>'one'],
+ // 'ordered_imports' => true,
+ // 'phpdoc_align' => ['align'=>'vertical'],
+ // 'native_function_invocation' => true,
+ ])
+ ->setFinder(
+ PhpCsFixer\Finder::create()
+ ->in(__DIR__.'/src')
+ ->name('*.php')
+ )
+;
+
+return $config;
diff --git a/vendor/guzzlehttp/guzzle/CHANGELOG.md b/vendor/guzzlehttp/guzzle/CHANGELOG.md
index 17badd75..65557498 100644
--- a/vendor/guzzlehttp/guzzle/CHANGELOG.md
+++ b/vendor/guzzlehttp/guzzle/CHANGELOG.md
@@ -1,5 +1,22 @@
# Change Log
+## 6.4.1 - 2019-10-23
+
+* No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that
+* Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar`
+
+## 6.4.0 - 2019-10-23
+
+* Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108)
+* Fix: Test if response is readable before returning a summary in `RequestException::getResponseBodySummary()` [#2081](https://github.com/guzzle/guzzle/pull/2081)
+* Fix: Add support for GUZZLE_CURL_SELECT_TIMEOUT environment variable [#2161](https://github.com/guzzle/guzzle/pull/2161)
+* Improvement: Added `GuzzleHttp\Exception\InvalidArgumentException` [#2163](https://github.com/guzzle/guzzle/pull/2163)
+* Improvement: Added `GuzzleHttp\_current_time()` to use `hrtime()` if that function exists. [#2242](https://github.com/guzzle/guzzle/pull/2242)
+* Improvement: Added curl's `appconnect_time` in `TransferStats` [#2284](https://github.com/guzzle/guzzle/pull/2284)
+* Improvement: Make GuzzleException extend Throwable wherever it's available [#2273](https://github.com/guzzle/guzzle/pull/2273)
+* Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335)
+* Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362)
+
## 6.3.3 - 2018-04-22
* Fix: Default headers when decode_content is specified
diff --git a/vendor/guzzlehttp/guzzle/Dockerfile b/vendor/guzzlehttp/guzzle/Dockerfile
new file mode 100644
index 00000000..f6a09523
--- /dev/null
+++ b/vendor/guzzlehttp/guzzle/Dockerfile
@@ -0,0 +1,18 @@
+FROM composer:latest as setup
+
+RUN mkdir /guzzle
+
+WORKDIR /guzzle
+
+RUN set -xe \
+ && composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár " --no-interaction \
+ && composer require guzzlehttp/guzzle
+
+
+FROM php:7.3
+
+RUN mkdir /guzzle
+
+WORKDIR /guzzle
+
+COPY --from=setup /guzzle /guzzle
diff --git a/vendor/guzzlehttp/guzzle/README.md b/vendor/guzzlehttp/guzzle/README.md
index bcd18b8e..a5ef18ae 100644
--- a/vendor/guzzlehttp/guzzle/README.md
+++ b/vendor/guzzlehttp/guzzle/README.md
@@ -21,19 +21,18 @@ trivial to integrate with web services.
```php
$client = new \GuzzleHttp\Client();
-$res = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
-echo $res->getStatusCode();
-// 200
-echo $res->getHeaderLine('content-type');
-// 'application/json; charset=utf8'
-echo $res->getBody();
-// '{"id": 1420053, "name": "guzzle", ...}'
+$response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
-// Send an asynchronous request.
+echo $response->getStatusCode(); # 200
+echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8'
+echo $response->getBody(); # '{"id": 1420053, "name": "guzzle", ...}'
+
+# Send an asynchronous request.
$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
$promise = $client->sendAsync($request)->then(function ($response) {
echo 'I completed! ' . $response->getBody();
});
+
$promise->wait();
```
@@ -57,7 +56,7 @@ curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of Guzzle:
```bash
-php composer.phar require guzzlehttp/guzzle
+composer require guzzlehttp/guzzle
```
After installing, you need to require Composer's autoloader:
@@ -69,7 +68,7 @@ require 'vendor/autoload.php';
You can then later update Guzzle using composer:
```bash
-composer.phar update
+composer update
```
@@ -86,6 +85,6 @@ composer.phar update
[guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x
[guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3
[guzzle-6-repo]: https://github.com/guzzle/guzzle
-[guzzle-3-docs]: http://guzzle3.readthedocs.org/en/latest/
+[guzzle-3-docs]: http://guzzle3.readthedocs.org
[guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/
[guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/
diff --git a/vendor/guzzlehttp/guzzle/composer.json b/vendor/guzzlehttp/guzzle/composer.json
index 1f328e30..c5532575 100644
--- a/vendor/guzzlehttp/guzzle/composer.json
+++ b/vendor/guzzlehttp/guzzle/composer.json
@@ -2,7 +2,15 @@
"name": "guzzlehttp/guzzle",
"type": "library",
"description": "Guzzle is a PHP HTTP client library",
- "keywords": ["framework", "http", "rest", "web service", "curl", "client", "HTTP client"],
+ "keywords": [
+ "framework",
+ "http",
+ "rest",
+ "web service",
+ "curl",
+ "client",
+ "HTTP client"
+ ],
"homepage": "http://guzzlephp.org/",
"license": "MIT",
"authors": [
@@ -14,31 +22,37 @@
],
"require": {
"php": ">=5.5",
- "guzzlehttp/psr7": "^1.4",
- "guzzlehttp/promises": "^1.0"
+ "ext-json": "*",
+ "guzzlehttp/promises": "^1.0",
+ "guzzlehttp/psr7": "^1.6.1"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
- "psr/log": "^1.0"
- },
- "autoload": {
- "files": ["src/functions_include.php"],
- "psr-4": {
- "GuzzleHttp\\": "src/"
- }
- },
- "autoload-dev": {
- "psr-4": {
- "GuzzleHttp\\Tests\\": "tests/"
- }
+ "psr/log": "^1.1"
},
"suggest": {
"psr/log": "Required for using the Log middleware"
},
+ "config": {
+ "sort-packages": true
+ },
"extra": {
"branch-alias": {
"dev-master": "6.3-dev"
}
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "GuzzleHttp\\Tests\\": "tests/"
+ }
}
}
diff --git a/vendor/guzzlehttp/guzzle/phpstan.neon.dist b/vendor/guzzlehttp/guzzle/phpstan.neon.dist
new file mode 100644
index 00000000..4ef4192d
--- /dev/null
+++ b/vendor/guzzlehttp/guzzle/phpstan.neon.dist
@@ -0,0 +1,9 @@
+parameters:
+ level: 1
+ paths:
+ - src
+
+ ignoreErrors:
+ -
+ message: '#Function uri_template not found#'
+ path: %currentWorkingDirectory%/src/functions.php
diff --git a/vendor/guzzlehttp/guzzle/src/Client.php b/vendor/guzzlehttp/guzzle/src/Client.php
index 80417918..0f43c71f 100644
--- a/vendor/guzzlehttp/guzzle/src/Client.php
+++ b/vendor/guzzlehttp/guzzle/src/Client.php
@@ -210,7 +210,7 @@ class Client implements ClientInterface
*
* @return array
*/
- private function prepareDefaults($options)
+ private function prepareDefaults(array $options)
{
$defaults = $this->config;
diff --git a/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/vendor/guzzlehttp/guzzle/src/ClientInterface.php
index 2dbcffa4..5b370851 100644
--- a/vendor/guzzlehttp/guzzle/src/ClientInterface.php
+++ b/vendor/guzzlehttp/guzzle/src/ClientInterface.php
@@ -12,7 +12,7 @@ use Psr\Http\Message\UriInterface;
*/
interface ClientInterface
{
- const VERSION = '6.3.3';
+ const VERSION = '6.4.1';
/**
* Send an HTTP request.
diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
index 78f2b79f..28626426 100644
--- a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
+++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
@@ -120,7 +120,7 @@ class CookieJar implements CookieJarInterface
} elseif (!$path) {
$this->cookies = array_filter(
$this->cookies,
- function (SetCookie $cookie) use ($path, $domain) {
+ function (SetCookie $cookie) use ($domain) {
return !$cookie->matchesDomain($domain);
}
);
diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
index 9887c1d5..3fb8600e 100644
--- a/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
+++ b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
@@ -23,6 +23,7 @@ class FileCookieJar extends CookieJar
*/
public function __construct($cookieFile, $storeSessionCookies = false)
{
+ parent::__construct();
$this->filename = $cookieFile;
$this->storeSessionCookies = $storeSessionCookies;
@@ -56,7 +57,7 @@ class FileCookieJar extends CookieJar
}
$jsonStr = \GuzzleHttp\json_encode($json);
- if (false === file_put_contents($filename, $jsonStr)) {
+ if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) {
throw new \RuntimeException("Unable to save file {$filename}");
}
}
diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
index 4497bcf0..0224a244 100644
--- a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
+++ b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
@@ -22,6 +22,7 @@ class SessionCookieJar extends CookieJar
*/
public function __construct($sessionKey, $storeSessionCookies = false)
{
+ parent::__construct();
$this->sessionKey = $sessionKey;
$this->storeSessionCookies = $storeSessionCookies;
$this->load();
diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
index f6993943..3d776a70 100644
--- a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
+++ b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
@@ -227,7 +227,7 @@ class SetCookie
/**
* Get whether or not this is a secure cookie
*
- * @return null|bool
+ * @return bool|null
*/
public function getSecure()
{
@@ -247,7 +247,7 @@ class SetCookie
/**
* Get whether or not this is a session cookie
*
- * @return null|bool
+ * @return bool|null
*/
public function getDiscard()
{
diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php b/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php
index f95c09f2..4cfd393c 100644
--- a/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php
+++ b/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php
@@ -4,4 +4,6 @@ namespace GuzzleHttp\Exception;
/**
* Exception when a client error is encountered (4xx codes)
*/
-class ClientException extends BadResponseException {}
+class ClientException extends BadResponseException
+{
+}
diff --git a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
index 510778f6..27b2722b 100644
--- a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
+++ b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
@@ -1,13 +1,23 @@
getBody();
- if (!$body->isSeekable()) {
+ if (!$body->isSeekable() || !$body->isReadable()) {
return null;
}
diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php
index 7cdd3408..127094c1 100644
--- a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php
+++ b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php
@@ -4,4 +4,6 @@ namespace GuzzleHttp\Exception;
/**
* Exception when a server error is encountered (5xx codes)
*/
-class ServerException extends BadResponseException {}
+class ServerException extends BadResponseException
+{
+}
diff --git a/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php b/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php
index b60a9678..fff05251 100644
--- a/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php
+++ b/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php
@@ -1,4 +1,6 @@
handle);
+ $curlStats['appconnect_time'] = curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME);
$stats = new TransferStats(
$easy->request,
$easy->response,
@@ -136,7 +140,9 @@ class CurlFactory implements CurlFactoryInterface
$ctx = [
'errno' => $easy->errno,
'error' => curl_error($easy->handle),
+ 'appconnect_time' => curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME),
] + curl_getinfo($easy->handle);
+ $ctx[self::CURL_VERSION_STR] = curl_version()['version'];
$factory->release($easy);
// Retry when nothing is present or when curl failed to rewind.
@@ -172,13 +178,22 @@ class CurlFactory implements CurlFactoryInterface
)
);
}
-
- $message = sprintf(
- 'cURL error %s: %s (%s)',
- $ctx['errno'],
- $ctx['error'],
- 'see http://curl.haxx.se/libcurl/c/libcurl-errors.html'
- );
+ if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) {
+ $message = sprintf(
+ 'cURL error %s: %s (%s)',
+ $ctx['errno'],
+ $ctx['error'],
+ 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'
+ );
+ } else {
+ $message = sprintf(
+ 'cURL error %s: %s (%s) for %s',
+ $ctx['errno'],
+ $ctx['error'],
+ 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html',
+ $easy->request->getUri()
+ );
+ }
// Create a connection exception if it was a specific error code.
$error = isset($connectionErrors[$easy->errno])
diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
index 2754d8e4..d8297623 100644
--- a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
+++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
@@ -37,8 +37,14 @@ class CurlMultiHandler
{
$this->factory = isset($options['handle_factory'])
? $options['handle_factory'] : new CurlFactory(50);
- $this->selectTimeout = isset($options['select_timeout'])
- ? $options['select_timeout'] : 1;
+
+ if (isset($options['select_timeout'])) {
+ $this->selectTimeout = $options['select_timeout'];
+ } elseif ($selectTimeout = getenv('GUZZLE_CURL_SELECT_TIMEOUT')) {
+ $this->selectTimeout = $selectTimeout;
+ } else {
+ $this->selectTimeout = 1;
+ }
}
public function __get($name)
@@ -82,7 +88,7 @@ class CurlMultiHandler
{
// Add any delayed handles if needed.
if ($this->delays) {
- $currentTime = microtime(true);
+ $currentTime = \GuzzleHttp\_current_time();
foreach ($this->delays as $id => $delay) {
if ($currentTime >= $delay) {
unset($this->delays[$id]);
@@ -134,7 +140,7 @@ class CurlMultiHandler
if (empty($easy->options['delay'])) {
curl_multi_add_handle($this->_mh, $easy->handle);
} else {
- $this->delays[$id] = microtime(true) + ($easy->options['delay'] / 1000);
+ $this->delays[$id] = \GuzzleHttp\_current_time() + ($easy->options['delay'] / 1000);
}
}
@@ -186,7 +192,7 @@ class CurlMultiHandler
private function timeToNext()
{
- $currentTime = microtime(true);
+ $currentTime = \GuzzleHttp\_current_time();
$nextTime = PHP_INT_MAX;
foreach ($this->delays as $time) {
if ($time < $nextTime) {
diff --git a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
index d892061c..d5c449c1 100644
--- a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
+++ b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
@@ -182,7 +182,8 @@ class MockHandler implements \Countable
$reason = null
) {
if (isset($options['on_stats'])) {
- $stats = new TransferStats($request, $response, 0, $reason);
+ $transferTime = isset($options['transfer_time']) ? $options['transfer_time'] : 0;
+ $stats = new TransferStats($request, $response, $transferTime, $reason);
call_user_func($options['on_stats'], $stats);
}
}
diff --git a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
index b686545e..0dedd7da 100644
--- a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
+++ b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
@@ -33,7 +33,7 @@ class StreamHandler
usleep($options['delay'] * 1000);
}
- $startTime = isset($options['on_stats']) ? microtime(true) : null;
+ $startTime = isset($options['on_stats']) ? \GuzzleHttp\_current_time() : null;
try {
// Does not support the expect header.
@@ -42,7 +42,7 @@ class StreamHandler
// Append a content-length header if body size is zero to match
// cURL's behavior.
if (0 === $request->getBody()->getSize()) {
- $request = $request->withHeader('Content-Length', 0);
+ $request = $request->withHeader('Content-Length', '0');
}
return $this->createResponse(
@@ -82,7 +82,7 @@ class StreamHandler
$stats = new TransferStats(
$request,
$response,
- microtime(true) - $startTime,
+ \GuzzleHttp\_current_time() - $startTime,
$error,
[]
);
@@ -343,13 +343,25 @@ class StreamHandler
if ('v4' === $options['force_ip_resolve']) {
$records = dns_get_record($uri->getHost(), DNS_A);
if (!isset($records[0]['ip'])) {
- throw new ConnectException(sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request);
+ throw new ConnectException(
+ sprintf(
+ "Could not resolve IPv4 address for host '%s'",
+ $uri->getHost()
+ ),
+ $request
+ );
}
$uri = $uri->withHost($records[0]['ip']);
} elseif ('v6' === $options['force_ip_resolve']) {
$records = dns_get_record($uri->getHost(), DNS_AAAA);
if (!isset($records[0]['ipv6'])) {
- throw new ConnectException(sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request);
+ throw new ConnectException(
+ sprintf(
+ "Could not resolve IPv6 address for host '%s'",
+ $uri->getHost()
+ ),
+ $request
+ );
}
$uri = $uri->withHost('[' . $records[0]['ipv6'] . ']');
}
diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php
index 24c46fd9..f0016861 100644
--- a/vendor/guzzlehttp/guzzle/src/HandlerStack.php
+++ b/vendor/guzzlehttp/guzzle/src/HandlerStack.php
@@ -206,7 +206,7 @@ class HandlerStack
}
/**
- * @param $name
+ * @param string $name
* @return int
*/
private function findByName($name)
@@ -223,10 +223,10 @@ class HandlerStack
/**
* Splices a function into the middleware list at a specific position.
*
- * @param $findName
- * @param $withName
+ * @param string $findName
+ * @param string $withName
* @param callable $middleware
- * @param $before
+ * @param bool $before
*/
private function splice($findName, $withName, callable $middleware, $before)
{
diff --git a/vendor/guzzlehttp/guzzle/src/Middleware.php b/vendor/guzzlehttp/guzzle/src/Middleware.php
index d4ad75c9..bffc1974 100644
--- a/vendor/guzzlehttp/guzzle/src/Middleware.php
+++ b/vendor/guzzlehttp/guzzle/src/Middleware.php
@@ -7,7 +7,6 @@ use GuzzleHttp\Promise\RejectedPromise;
use GuzzleHttp\Psr7;
use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerInterface;
-use Psr\Log\LogLevel;
/**
* Functions used to create and wrap handlers with handler middleware.
@@ -39,7 +38,7 @@ final class Middleware
$cookieJar->extractCookies($request, $response);
return $response;
}
- );
+ );
};
};
}
@@ -58,7 +57,7 @@ final class Middleware
return $handler($request, $options);
}
return $handler($request, $options)->then(
- function (ResponseInterface $response) use ($request, $handler) {
+ function (ResponseInterface $response) use ($request) {
$code = $response->getStatusCode();
if ($code < 400) {
return $response;
@@ -183,7 +182,7 @@ final class Middleware
*
* @return callable Returns a function that accepts the next handler.
*/
- public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = LogLevel::INFO)
+ public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = 'info' /* \Psr\Log\LogLevel::INFO */)
{
return function (callable $handler) use ($logger, $formatter, $logLevel) {
return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) {
diff --git a/vendor/guzzlehttp/guzzle/src/Pool.php b/vendor/guzzlehttp/guzzle/src/Pool.php
index 8f1be33c..05c854ae 100644
--- a/vendor/guzzlehttp/guzzle/src/Pool.php
+++ b/vendor/guzzlehttp/guzzle/src/Pool.php
@@ -6,7 +6,7 @@ use Psr\Http\Message\RequestInterface;
use GuzzleHttp\Promise\EachPromise;
/**
- * Sends and iterator of requests concurrently using a capped pool size.
+ * Sends an iterator of requests concurrently using a capped pool size.
*
* The pool will read from an iterator until it is cancelled or until the
* iterator is consumed. When a request is yielded, the request is sent after
diff --git a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
index 131b7717..bff4e4e8 100644
--- a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
+++ b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
@@ -186,7 +186,7 @@ class RedirectMiddleware
if ($options['allow_redirects']['referer']
&& $modify['uri']->getScheme() === $request->getUri()->getScheme()
) {
- $uri = $request->getUri()->withUserInfo('', '');
+ $uri = $request->getUri()->withUserInfo('');
$modify['set_headers']['Referer'] = (string) $uri;
} else {
$modify['remove_headers'][] = 'Referer';
diff --git a/vendor/guzzlehttp/guzzle/src/RequestOptions.php b/vendor/guzzlehttp/guzzle/src/RequestOptions.php
index c6aacfb1..5c0fd19d 100644
--- a/vendor/guzzlehttp/guzzle/src/RequestOptions.php
+++ b/vendor/guzzlehttp/guzzle/src/RequestOptions.php
@@ -22,7 +22,7 @@ final class RequestOptions
* - strict: (bool, default=false) Set to true to use strict redirects
* meaning redirect POST requests with POST requests vs. doing what most
* browsers do which is redirect POST requests with GET requests
- * - referer: (bool, default=true) Set to false to disable the Referer
+ * - referer: (bool, default=false) Set to true to enable the Referer
* header.
* - protocols: (array, default=['http', 'https']) Allowed redirect
* protocols.
diff --git a/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php b/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php
index f27090fd..7d40ecaf 100644
--- a/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php
+++ b/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php
@@ -19,6 +19,9 @@ class RetryMiddleware
/** @var callable */
private $decider;
+ /** @var callable */
+ private $delay;
+
/**
* @param callable $decider Function that accepts the number of retries,
* a request, [response], and [exception] and
@@ -42,7 +45,7 @@ class RetryMiddleware
/**
* Default exponential backoff delay function.
*
- * @param $retries
+ * @param int $retries
*
* @return int
*/
diff --git a/vendor/guzzlehttp/guzzle/src/TransferStats.php b/vendor/guzzlehttp/guzzle/src/TransferStats.php
index 15f717e1..23a22a33 100644
--- a/vendor/guzzlehttp/guzzle/src/TransferStats.php
+++ b/vendor/guzzlehttp/guzzle/src/TransferStats.php
@@ -20,7 +20,7 @@ final class TransferStats
/**
* @param RequestInterface $request Request that was sent.
* @param ResponseInterface $response Response received (if any)
- * @param null $transferTime Total handler transfer time.
+ * @param float|null $transferTime Total handler transfer time.
* @param mixed $handlerErrorData Handler error data.
* @param array $handlerStats Handler specific stats.
*/
diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php
index a3ac450d..51d736d8 100644
--- a/vendor/guzzlehttp/guzzle/src/functions.php
+++ b/vendor/guzzlehttp/guzzle/src/functions.php
@@ -196,7 +196,8 @@ function default_ca_bundle()
}
}
- throw new \RuntimeException(<<< EOT
+ throw new \RuntimeException(
+ <<< EOT
No system CA bundle could be found in any of the the common system locations.
PHP versions earlier than 5.6 are not properly configured to use the system's
CA bundle by default. In order to verify peer certificates, you will need to
@@ -294,14 +295,14 @@ function is_host_in_noproxy($host, array $noProxyArray)
* @param int $options Bitmask of JSON decode options.
*
* @return mixed
- * @throws \InvalidArgumentException if the JSON cannot be decoded.
+ * @throws Exception\InvalidArgumentException if the JSON cannot be decoded.
* @link http://www.php.net/manual/en/function.json-decode.php
*/
function json_decode($json, $assoc = false, $depth = 512, $options = 0)
{
$data = \json_decode($json, $assoc, $depth, $options);
if (JSON_ERROR_NONE !== json_last_error()) {
- throw new \InvalidArgumentException(
+ throw new Exception\InvalidArgumentException(
'json_decode error: ' . json_last_error_msg()
);
}
@@ -317,17 +318,29 @@ function json_decode($json, $assoc = false, $depth = 512, $options = 0)
* @param int $depth Set the maximum depth. Must be greater than zero.
*
* @return string
- * @throws \InvalidArgumentException if the JSON cannot be encoded.
+ * @throws Exception\InvalidArgumentException if the JSON cannot be encoded.
* @link http://www.php.net/manual/en/function.json-encode.php
*/
function json_encode($value, $options = 0, $depth = 512)
{
$json = \json_encode($value, $options, $depth);
if (JSON_ERROR_NONE !== json_last_error()) {
- throw new \InvalidArgumentException(
+ throw new Exception\InvalidArgumentException(
'json_encode error: ' . json_last_error_msg()
);
}
return $json;
}
+
+/**
+ * Wrapper for the hrtime() or microtime() functions
+ * (depending on the PHP version, one of the two is used)
+ *
+ * @return float|mixed UNIX timestamp
+ * @internal
+ */
+function _current_time()
+{
+ return function_exists('hrtime') ? hrtime(true) / 1e9 : microtime(true);
+}
diff --git a/vendor/phpmailer/phpmailer/README.md b/vendor/phpmailer/phpmailer/README.md
index 62706463..a000c930 100644
--- a/vendor/phpmailer/phpmailer/README.md
+++ b/vendor/phpmailer/phpmailer/README.md
@@ -10,13 +10,13 @@ Build status: [](h
## Class Features
- Probably the world's most popular code for sending email from PHP!
-- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more
+- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla!, and many more
- Integrated SMTP support - send without a local mail server
- Send emails with multiple To, CC, BCC and Reply-to addresses
- Multipart/alternative emails for mail clients that do not read HTML email
- Add attachments, including inline
- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
-- SMTP authentication with LOGIN, PLAIN, CRAM-MD5 and XOAUTH2 mechanisms over SSL and SMTP+STARTTLS transports
+- SMTP authentication with LOGIN, PLAIN, CRAM-MD5, and XOAUTH2 mechanisms over SSL and SMTP+STARTTLS transports
- Validates email addresses automatically
- Protect against header injection attacks
- Error messages in over 50 languages!
@@ -26,12 +26,12 @@ Build status: [](h
- Much more!
## Why you might need it
-Many PHP developers utilize email in their code. The only PHP function that supports this is the `mail()` function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments.
+Many PHP developers need to send email from their code. The only PHP function that supports this is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as encryption, authentication, HTML messages, and attachments.
-Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong!
-*Please* don't be tempted to do it yourself - if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own - try [SwiftMailer](https://swiftmailer.symfony.com/), [Zend/Mail](https://zendframework.github.io/zend-mail/), [eZcomponents](https://github.com/zetacomponents/Mail) etc.
+Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules – the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong!
+*Please* don't be tempted to do it yourself – if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own. Try [SwiftMailer](https://swiftmailer.symfony.com/), [Zend/Mail](https://zendframework.github.io/zend-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail) etc.
-The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD and OS X platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server.
+The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD, and macOS platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server.
## License
This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read LICENSE for information on the software availability and distribution.
@@ -40,7 +40,7 @@ This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lg
PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:
```json
-"phpmailer/phpmailer": "~6.0"
+"phpmailer/phpmailer": "~6.1"
```
or run
@@ -70,15 +70,13 @@ If you're not using the `SMTP` class explicitly (you're probably not), you don't
If you don't speak git or just want a tarball, click the 'zip' button on the right of the project page in GitHub, though note that docs and examples are not included in the tarball.
## Legacy versions
-PHPMailer 5.2 (which is compatible with PHP 5.0 - 7.0) is no longer being supported for feature updates, and will only be receiving security updates from now on. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable), and future versions of 5.2 will be tagged with 5.2.x version numbers, so existing Composer configs should remain working. If you're using PHP 5.5 or later, we recommend you make the necessary changes to switch to the 6.0 release.
+PHPMailer 5.2 (which is compatible with PHP 5.0 - 7.0) is no longer being supported, even for security updates. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable). If you're using PHP 5.5 or later (which you should be), switch to the 6.x releases.
-The 5.2 branch will not receive security updates after December 31st 2018.
-
-## Upgrading from 5.2
+### Upgrading from 5.2
The biggest changes are that source files are now in the `src/` folder, and PHPMailer now declares the namespace `PHPMailer\PHPMailer`. This has several important effects – [read the upgrade guide](https://github.com/PHPMailer/PHPMailer/tree/master/UPGRADING.md) for more details.
### Minimal installation
-While installing the entire package manually or with Composer is simple, convenient and reliable, you may want to include only vital files in your project. At the very least you will need [src/PHPMailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/PHPMailer.php). If you're using SMTP, you'll need [src/SMTP.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/SMTP.php), and if you're using POP-before SMTP, you'll need [src/POP3.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/POP3.php). You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. If you're using XOAUTH2 you will need [src/OAuth.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/OAuth.php) as well as the Composer dependencies for the services you wish to authenticate with. Really, it's much easier to use Composer!
+While installing the entire package manually or with Composer is simple, convenient, and reliable, you may want to include only vital files in your project. At the very least you will need [src/PHPMailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/PHPMailer.php). If you're using SMTP, you'll need [src/SMTP.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/SMTP.php), and if you're using POP-before SMTP, you'll need [src/POP3.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/POP3.php). You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. If you're using XOAUTH2 you will need [src/OAuth.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/OAuth.php) as well as the Composer dependencies for the services you wish to authenticate with. Really, it's much easier to use Composer!
## A Simple Example
@@ -87,22 +85,25 @@ While installing the entire package manually or with Composer is simple, conveni
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
+use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
-//Load Composer's autoloader
+// Load Composer's autoloader
require 'vendor/autoload.php';
-$mail = new PHPMailer(true); // Passing `true` enables exceptions
+// Instantiation and passing `true` enables exceptions
+$mail = new PHPMailer(true);
+
try {
//Server settings
- $mail->SMTPDebug = 2; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'user@example.com'; // SMTP username
- $mail->Password = 'secret'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587; // TCP port to connect to
+ $mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
+ $mail->isSMTP(); // Send using SMTP
+ $mail->Host = 'smtp1.example.com'; // Set the SMTP server to send through
+ $mail->SMTPAuth = true; // Enable SMTP authentication
+ $mail->Username = 'user@example.com'; // SMTP username
+ $mail->Password = 'secret'; // SMTP password
+ $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` also accepted
+ $mail->Port = 587; // TCP port to connect to
//Recipients
$mail->setFrom('from@example.com', 'Mailer');
@@ -112,11 +113,11 @@ try {
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
- //Attachments
+ // Attachments
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
- //Content
+ // Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body in bold!';
@@ -125,16 +126,18 @@ try {
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
- echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
+ echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
```
You'll find plenty more to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder.
+If you are re-using the instance (e.g. when sending to a mailing list), you may need to clear the recipient list to avoid sending duplicate messages. See [the mailing list example](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) for further guidance.
+
That's it. You should now be ready to use PHPMailer!
## Localization
-PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find numerous (48 at the time of writing!) translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
+PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
```php
// To load the French version
diff --git a/vendor/phpmailer/phpmailer/VERSION b/vendor/phpmailer/phpmailer/VERSION
index 41bd15e2..132c6def 100644
--- a/vendor/phpmailer/phpmailer/VERSION
+++ b/vendor/phpmailer/phpmailer/VERSION
@@ -1 +1 @@
-6.0.7
\ No newline at end of file
+6.1.1
\ No newline at end of file
diff --git a/vendor/phpmailer/phpmailer/composer.json b/vendor/phpmailer/phpmailer/composer.json
index ee4e890d..d1b14171 100644
--- a/vendor/phpmailer/phpmailer/composer.json
+++ b/vendor/phpmailer/phpmailer/composer.json
@@ -51,5 +51,5 @@
"PHPMailer\\Test\\": "test/"
}
},
- "license": "LGPL-2.1"
+ "license": "LGPL-2.1-only"
}
diff --git a/vendor/phpmailer/phpmailer/language/phpmailer.lang-af.php b/vendor/phpmailer/phpmailer/language/phpmailer.lang-af.php
new file mode 100644
index 00000000..3c42d78e
--- /dev/null
+++ b/vendor/phpmailer/phpmailer/language/phpmailer.lang-af.php
@@ -0,0 +1,25 @@
+
+ * @author Marcus Bointon
*/
class Exception extends \Exception
{
diff --git a/vendor/phpmailer/phpmailer/src/PHPMailer.php b/vendor/phpmailer/phpmailer/src/PHPMailer.php
index 52104924..4897b5e2 100644
--- a/vendor/phpmailer/phpmailer/src/PHPMailer.php
+++ b/vendor/phpmailer/phpmailer/src/PHPMailer.php
@@ -3,13 +3,13 @@
* PHPMailer - PHP email creation and transport class.
* PHP Version 5.5.
*
- * @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
+ * @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
*
* @author Marcus Bointon (Synchro/coolbru)
* @author Jim Jagielski (jimjag)
* @author Andy Prevost (codeworxtech)
* @author Brent R. Matzelle (original founder)
- * @copyright 2012 - 2017 Marcus Bointon
+ * @copyright 2012 - 2019 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@@ -23,13 +23,14 @@ namespace PHPMailer\PHPMailer;
/**
* PHPMailer - PHP email creation and transport class.
*
- * @author Marcus Bointon (Synchro/coolbru)
- * @author Jim Jagielski (jimjag)
- * @author Andy Prevost (codeworxtech)
- * @author Brent R. Matzelle (original founder)
+ * @author Marcus Bointon (Synchro/coolbru)
+ * @author Jim Jagielski (jimjag)
+ * @author Andy Prevost (codeworxtech)
+ * @author Brent R. Matzelle (original founder)
*/
class PHPMailer
{
+ const CHARSET_ASCII = 'us-ascii';
const CHARSET_ISO88591 = 'iso-8859-1';
const CHARSET_UTF8 = 'utf-8';
@@ -46,6 +47,18 @@ class PHPMailer
const ENCODING_BINARY = 'binary';
const ENCODING_QUOTED_PRINTABLE = 'quoted-printable';
+ const ENCRYPTION_STARTTLS = 'tls';
+ const ENCRYPTION_SMTPS = 'ssl';
+
+ const ICAL_METHOD_REQUEST = 'REQUEST';
+ const ICAL_METHOD_PUBLISH = 'PUBLISH';
+ const ICAL_METHOD_REPLY = 'REPLY';
+ const ICAL_METHOD_ADD = 'ADD';
+ const ICAL_METHOD_CANCEL = 'CANCEL';
+ const ICAL_METHOD_REFRESH = 'REFRESH';
+ const ICAL_METHOD_COUNTER = 'COUNTER';
+ const ICAL_METHOD_DECLINECOUNTER = 'DECLINECOUNTER';
+
/**
* Email priority.
* Options: null (default), 1 = High, 3 = Normal, 5 = low.
@@ -145,6 +158,22 @@ class PHPMailer
*/
public $Ical = '';
+ /**
+ * Value-array of "method" in Contenttype header "text/calendar"
+ *
+ * @var string[]
+ */
+ protected static $IcalMethods = [
+ self::ICAL_METHOD_REQUEST,
+ self::ICAL_METHOD_PUBLISH,
+ self::ICAL_METHOD_REPLY,
+ self::ICAL_METHOD_ADD,
+ self::ICAL_METHOD_CANCEL,
+ self::ICAL_METHOD_REFRESH,
+ self::ICAL_METHOD_COUNTER,
+ self::ICAL_METHOD_DECLINECOUNTER,
+ ];
+
/**
* The complete compiled MIME message body.
*
@@ -212,6 +241,8 @@ class PHPMailer
* $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value
* 'localhost.localdomain'.
*
+ * @see PHPMailer::$Helo
+ *
* @var string
*/
public $Hostname = '';
@@ -258,7 +289,7 @@ class PHPMailer
public $Port = 25;
/**
- * The SMTP HELO of the message.
+ * The SMTP HELO/EHLO name used for the SMTP connection.
* Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find
* one with the same method described above for $Hostname.
*
@@ -270,7 +301,7 @@ class PHPMailer
/**
* What kind of encryption to use on the SMTP connection.
- * Options: '', 'ssl' or 'tls'.
+ * Options: '', static::ENCRYPTION_STARTTLS, or static::ENCRYPTION_SMTPS.
*
* @var string
*/
@@ -340,15 +371,28 @@ class PHPMailer
*/
public $Timeout = 300;
+ /**
+ * Comma separated list of DSN notifications
+ * 'NEVER' under no circumstances a DSN must be returned to the sender.
+ * If you use NEVER all other notifications will be ignored.
+ * 'SUCCESS' will notify you when your mail has arrived at its destination.
+ * 'FAILURE' will arrive if an error occurred during delivery.
+ * 'DELAY' will notify you if there is an unusual delay in delivery, but the actual
+ * delivery's outcome (success or failure) is not yet decided.
+ *
+ * @see https://tools.ietf.org/html/rfc3461 See section 4.1 for more information about NOTIFY
+ */
+ public $dsn = '';
+
/**
* SMTP class debug output mode.
* Debug output level.
* Options:
- * * `0` No output
- * * `1` Commands
- * * `2` Data and commands
- * * `3` As 2 plus connection status
- * * `4` Low-level data output.
+ * * SMTP::DEBUG_OFF: No output
+ * * SMTP::DEBUG_CLIENT: Client messages
+ * * SMTP::DEBUG_SERVER: Client and server messages
+ * * SMTP::DEBUG_CONNECTION: As SERVER plus connection status
+ * * SMTP::DEBUG_LOWLEVEL: Noisy, low-level data output, rarely needed
*
* @see SMTP::$do_debug
*
@@ -514,9 +558,9 @@ class PHPMailer
/**
* What to put in the X-Mailer header.
- * Options: An empty string for PHPMailer default, whitespace for none, or a string to use.
+ * Options: An empty string for PHPMailer default, whitespace/null for none, or a string to use.
*
- * @var string
+ * @var string|null
*/
public $XMailer = '';
@@ -701,7 +745,7 @@ class PHPMailer
*
* @var string
*/
- const VERSION = '6.0.7';
+ const VERSION = '6.1.1';
/**
* Error severity: message only, continue processing.
@@ -731,6 +775,16 @@ class PHPMailer
*/
protected static $LE = "\r\n";
+ /**
+ * The maximum line length supported by mail().
+ *
+ * Background: mail() will sometimes corrupt messages
+ * with headers headers longer than 65 chars, see #818.
+ *
+ * @var int
+ */
+ const MAIL_MAX_LINE_LENGTH = 63;
+
/**
* The maximum line length allowed by RFC 2822 section 2.1.1.
*
@@ -927,6 +981,8 @@ class PHPMailer
* @param string $address The email address to send to
* @param string $name
*
+ * @throws Exception
+ *
* @return bool true on success, false if address already used or invalid in some way
*/
public function addAddress($address, $name = '')
@@ -940,6 +996,8 @@ class PHPMailer
* @param string $address The email address to send to
* @param string $name
*
+ * @throws Exception
+ *
* @return bool true on success, false if address already used or invalid in some way
*/
public function addCC($address, $name = '')
@@ -953,6 +1011,8 @@ class PHPMailer
* @param string $address The email address to send to
* @param string $name
*
+ * @throws Exception
+ *
* @return bool true on success, false if address already used or invalid in some way
*/
public function addBCC($address, $name = '')
@@ -966,6 +1026,8 @@ class PHPMailer
* @param string $address The email address to reply to
* @param string $name
*
+ * @throws Exception
+ *
* @return bool true on success, false if address already used or invalid in some way
*/
public function addReplyTo($address, $name = '')
@@ -994,10 +1056,12 @@ class PHPMailer
$pos = strrpos($address, '@');
if (false === $pos) {
// At-sign is missing.
- $error_message = sprintf('%s (%s): %s',
+ $error_message = sprintf(
+ '%s (%s): %s',
$this->lang('invalid_address'),
$kind,
- $address);
+ $address
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
@@ -1045,9 +1109,11 @@ class PHPMailer
protected function addAnAddress($kind, $address, $name = '')
{
if (!in_array($kind, ['to', 'cc', 'bcc', 'Reply-To'])) {
- $error_message = sprintf('%s: %s',
+ $error_message = sprintf(
+ '%s: %s',
$this->lang('Invalid recipient kind'),
- $kind);
+ $kind
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
@@ -1057,10 +1123,12 @@ class PHPMailer
return false;
}
if (!static::validateAddress($address)) {
- $error_message = sprintf('%s (%s): %s',
+ $error_message = sprintf(
+ '%s (%s): %s',
$this->lang('invalid_address'),
$kind,
- $address);
+ $address
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
@@ -1093,7 +1161,7 @@ class PHPMailer
* Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available.
* Note that quotes in the name part are removed.
*
- * @see http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
+ * @see http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
*
* @param string $addrstr The address list string
* @param bool $useimap Whether to use the IMAP extension to parse the list
@@ -1163,12 +1231,15 @@ class PHPMailer
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
// Don't validate now addresses with IDN. Will be done in send().
$pos = strrpos($address, '@');
- if (false === $pos or
- (!$this->has8bitChars(substr($address, ++$pos)) or !static::idnSupported()) and
- !static::validateAddress($address)) {
- $error_message = sprintf('%s (From): %s',
+ if (false === $pos
+ or (!$this->has8bitChars(substr($address, ++$pos)) or !static::idnSupported())
+ and !static::validateAddress($address)
+ ) {
+ $error_message = sprintf(
+ '%s (From): %s',
$this->lang('invalid_address'),
- $address);
+ $address
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
@@ -1304,7 +1375,7 @@ class PHPMailer
* - Conversion to punycode is impossible (e.g. required PHP functions are not available)
* or fails for any reason (e.g. domain contains characters not allowed in an IDN).
*
- * @see PHPMailer::$CharSet
+ * @see PHPMailer::$CharSet
*
* @param string $address The email address to convert
*
@@ -1370,8 +1441,8 @@ class PHPMailer
*/
public function preSend()
{
- if ('smtp' == $this->Mailer or
- ('mail' == $this->Mailer and stripos(PHP_OS, 'WIN') === 0)
+ if ('smtp' == $this->Mailer
+ or ('mail' == $this->Mailer and stripos(PHP_OS, 'WIN') === 0)
) {
//SMTP mandates RFC-compliant line endings
//and it's also used with mail() on Windows
@@ -1418,10 +1489,12 @@ class PHPMailer
}
$this->$address_kind = $this->punyencodeAddress($this->$address_kind);
if (!static::validateAddress($this->$address_kind)) {
- $error_message = sprintf('%s (%s): %s',
+ $error_message = sprintf(
+ '%s (%s): %s',
$this->lang('invalid_address'),
$address_kind,
- $this->$address_kind);
+ $this->$address_kind
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
@@ -1538,7 +1611,7 @@ class PHPMailer
/**
* Send mail using the $Sendmail program.
*
- * @see PHPMailer::$Sendmail
+ * @see PHPMailer::$Sendmail
*
* @param string $header The message headers
* @param string $body The message body
@@ -1668,7 +1741,7 @@ class PHPMailer
/**
* Send mail using the PHP mail() function.
*
- * @see http://www.php.net/manual/en/book.mail.php
+ * @see http://www.php.net/manual/en/book.mail.php
*
* @param string $header The message headers
* @param string $body The message body
@@ -1789,7 +1862,7 @@ class PHPMailer
// Attempt to send to all recipients
foreach ([$this->to, $this->cc, $this->bcc] as $togroup) {
foreach ($togroup as $to) {
- if (!$this->smtp->recipient($to[0])) {
+ if (!$this->smtp->recipient($to[0], $this->dsn)) {
$error = $this->smtp->getError();
$bad_rcpt[] = ['to' => $to[0], 'error' => $error['detail']];
$isSent = false;
@@ -1902,19 +1975,19 @@ class PHPMailer
}
$prefix = '';
$secure = $this->SMTPSecure;
- $tls = ('tls' == $this->SMTPSecure);
- if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
+ $tls = (static::ENCRYPTION_STARTTLS == $this->SMTPSecure);
+ if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and static::ENCRYPTION_SMTPS == $this->SMTPSecure)) {
$prefix = 'ssl://';
$tls = false; // Can't have SSL and TLS at the same time
- $secure = 'ssl';
+ $secure = static::ENCRYPTION_SMTPS;
} elseif ('tls' == $hostinfo[2]) {
$tls = true;
// tls doesn't use a prefix
- $secure = 'tls';
+ $secure = static::ENCRYPTION_STARTTLS;
}
//Do we need the OpenSSL extension?
$sslext = defined('OPENSSL_ALGO_SHA256');
- if ('tls' === $secure or 'ssl' === $secure) {
+ if (static::ENCRYPTION_STARTTLS === $secure or static::ENCRYPTION_SMTPS === $secure) {
//Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
if (!$sslext) {
throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL);
@@ -2114,8 +2187,8 @@ class PHPMailer
}
return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
- $addr[0]
- ) . '>';
+ $addr[0]
+ ) . '>';
}
/**
@@ -2357,7 +2430,7 @@ class PHPMailer
if (null !== $this->Priority) {
$result .= $this->headerLine('X-Priority', $this->Priority);
}
- if ('' == $this->XMailer) {
+ if ('' === $this->XMailer) {
$result .= $this->headerLine(
'X-Mailer',
'PHPMailer ' . self::VERSION . ' (https://github.com/PHPMailer/PHPMailer)'
@@ -2400,19 +2473,19 @@ class PHPMailer
switch ($this->message_type) {
case 'inline':
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
- $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
+ $result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
case 'attach':
case 'inline_attach':
case 'alt_attach':
case 'alt_inline_attach':
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_MIXED . ';');
- $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
+ $result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
case 'alt':
case 'alt_inline':
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
- $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
+ $result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
default:
// Catches case 'plain': and case '':
@@ -2504,7 +2577,7 @@ class PHPMailer
if (static::ENCODING_8BIT == $bodyEncoding and !$this->has8bitChars($this->Body)) {
$bodyEncoding = static::ENCODING_7BIT;
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
- $bodyCharSet = 'us-ascii';
+ $bodyCharSet = static::CHARSET_ASCII;
}
//If lines are too long, and we're not already using an encoding that will shorten them,
//change to quoted-printable transfer encoding for the body part only
@@ -2518,7 +2591,7 @@ class PHPMailer
if (static::ENCODING_8BIT == $altBodyEncoding and !$this->has8bitChars($this->AltBody)) {
$altBodyEncoding = static::ENCODING_7BIT;
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
- $altBodyCharSet = 'us-ascii';
+ $altBodyCharSet = static::CHARSET_ASCII;
}
//If lines are too long, and we're not already using an encoding that will shorten them,
//change to quoted-printable transfer encoding for the alt body part only
@@ -2546,7 +2619,8 @@ class PHPMailer
$body .= $mimepre;
$body .= $this->textLine('--' . $this->boundary[1]);
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
+ $body .= $this->textLine(' boundary="' . $this->boundary[2] . '";');
+ $body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2564,7 +2638,14 @@ class PHPMailer
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= static::$LE;
if (!empty($this->Ical)) {
- $body .= $this->getBoundary($this->boundary[1], '', static::CONTENT_TYPE_TEXT_CALENDAR . '; method=REQUEST', '');
+ $method = static::ICAL_METHOD_REQUEST;
+ foreach (static::$IcalMethods as $imethod) {
+ if (stripos($this->Ical, 'METHOD:' . $imethod) !== false) {
+ $method = $imethod;
+ break;
+ }
+ }
+ $body .= $this->getBoundary($this->boundary[1], '', static::CONTENT_TYPE_TEXT_CALENDAR . '; method=' . $method, '');
$body .= $this->encodeString($this->Ical, $this->Encoding);
$body .= static::$LE;
}
@@ -2577,7 +2658,8 @@ class PHPMailer
$body .= static::$LE;
$body .= $this->textLine('--' . $this->boundary[1]);
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
+ $body .= $this->textLine(' boundary="' . $this->boundary[2] . '";');
+ $body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, static::CONTENT_TYPE_TEXT_HTML, $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2590,7 +2672,7 @@ class PHPMailer
$body .= $mimepre;
$body .= $this->textLine('--' . $this->boundary[1]);
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
+ $body .= $this->textLine(' boundary="' . $this->boundary[2] . '"');
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, static::CONTENT_TYPE_PLAINTEXT, $altBodyEncoding);
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
@@ -2599,7 +2681,14 @@ class PHPMailer
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= static::$LE;
if (!empty($this->Ical)) {
- $body .= $this->getBoundary($this->boundary[2], '', static::CONTENT_TYPE_TEXT_CALENDAR . '; method=REQUEST', '');
+ $method = static::ICAL_METHOD_REQUEST;
+ foreach (static::$IcalMethods as $imethod) {
+ if (stripos($this->Ical, 'METHOD:' . $imethod) !== false) {
+ $method = $imethod;
+ break;
+ }
+ }
+ $body .= $this->getBoundary($this->boundary[2], '', static::CONTENT_TYPE_TEXT_CALENDAR . '; method=' . $method, '');
$body .= $this->encodeString($this->Ical, $this->Encoding);
}
$body .= $this->endBoundary($this->boundary[2]);
@@ -2610,14 +2699,15 @@ class PHPMailer
$body .= $mimepre;
$body .= $this->textLine('--' . $this->boundary[1]);
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
+ $body .= $this->textLine(' boundary="' . $this->boundary[2] . '"');
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, static::CONTENT_TYPE_PLAINTEXT, $altBodyEncoding);
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
$body .= static::$LE;
$body .= $this->textLine('--' . $this->boundary[2]);
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
+ $body .= $this->textLine(' boundary="' . $this->boundary[3] . '";');
+ $body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[3], $bodyCharSet, static::CONTENT_TYPE_TEXT_HTML, $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2646,12 +2736,11 @@ class PHPMailer
if (!defined('PKCS7_TEXT')) {
throw new Exception($this->lang('extension_missing') . 'openssl');
}
- // @TODO would be nice to use php://temp streams here
- $file = tempnam(sys_get_temp_dir(), 'mail');
- if (false === file_put_contents($file, $body)) {
- throw new Exception($this->lang('signing') . ' Could not write temp file');
- }
- $signed = tempnam(sys_get_temp_dir(), 'signed');
+
+ $file = tempnam(sys_get_temp_dir(), 'srcsign');
+ $signed = tempnam(sys_get_temp_dir(), 'mailsign');
+ file_put_contents($file, $body);
+
//Workaround for PHP bug https://bugs.php.net/bug.php?id=69197
if (empty($this->sign_extracerts_file)) {
$sign = @openssl_pkcs7_sign(
@@ -2672,6 +2761,7 @@ class PHPMailer
$this->sign_extracerts_file
);
}
+
@unlink($file);
if ($sign) {
$body = file_get_contents($signed);
@@ -2806,8 +2896,13 @@ class PHPMailer
*
* @return bool
*/
- public function addAttachment($path, $name = '', $encoding = self::ENCODING_BASE64, $type = '', $disposition = 'attachment')
- {
+ public function addAttachment(
+ $path,
+ $name = '',
+ $encoding = self::ENCODING_BASE64,
+ $type = '',
+ $disposition = 'attachment'
+ ) {
try {
if (!static::isPermittedPath($path) || !@is_file($path)) {
throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
@@ -2818,11 +2913,15 @@ class PHPMailer
$type = static::filenameToType($path);
}
- $filename = basename($path);
+ $filename = static::mb_pathinfo($path, PATHINFO_BASENAME);
if ('' == $name) {
$name = $filename;
}
+ if (!$this->validateEncoding($encoding)) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
+
$this->attachment[] = [
0 => $path,
1 => $filename,
@@ -2923,14 +3022,18 @@ class PHPMailer
}
if (!empty($cid)) {
- $mime[] = sprintf('Content-ID: <%s>%s', $cid, static::$LE);
+ $mime[] = sprintf(
+ 'Content-ID: <%s>%s',
+ $this->encodeHeader($this->secureHeader($cid)),
+ static::$LE
+ );
}
// If a filename contains any of these chars, it should be quoted,
// but not otherwise: RFC2183 & RFC2045 5.1
// Fixes a warning in IETF's msglint MIME checker
// Allow for bypassing the Content-Disposition header totally
- if (!(empty($disposition))) {
+ if (!empty($disposition)) {
$encoded_name = $this->encodeHeader($this->secureHeader($name));
if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
$mime[] = sprintf(
@@ -3015,6 +3118,8 @@ class PHPMailer
* @param string $str The text to encode
* @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
*
+ * @throws Exception
+ *
* @return string
*/
public function encodeString($str, $encoding = self::ENCODING_BASE64)
@@ -3044,6 +3149,9 @@ class PHPMailer
break;
default:
$this->setError($this->lang('encoding') . $encoding);
+ if ($this->exceptions) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
break;
}
@@ -3086,51 +3194,57 @@ class PHPMailer
break;
}
- //RFCs specify a maximum line length of 78 chars, however mail() will sometimes
- //corrupt messages with headers longer than 65 chars. See #818
- $lengthsub = 'mail' == $this->Mailer ? 13 : 0;
- $maxlen = static::STD_LINE_LENGTH - $lengthsub;
- // Try to select the encoding which should produce the shortest output
- if ($matchcount > strlen($str) / 3) {
- // More than a third of the content will need encoding, so B encoding will be most efficient
- $encoding = 'B';
- //This calculation is:
- // max line length
- // - shorten to avoid mail() corruption
- // - Q/B encoding char overhead ("` =??[QB]??=`")
- // - charset name length
- $maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
- if ($this->hasMultiBytes($str)) {
- // Use a custom function which correctly encodes and wraps long
- // multibyte strings without breaking lines within a character
- $encoded = $this->base64EncodeWrapMB($str, "\n");
- } else {
- $encoded = base64_encode($str);
- $maxlen -= $maxlen % 4;
- $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
- }
- $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
- } elseif ($matchcount > 0) {
- //1 or more chars need encoding, use Q-encode
- $encoding = 'Q';
- //Recalc max line length for Q encoding - see comments on B encode
- $maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
- $encoded = $this->encodeQ($str, $position);
- $encoded = $this->wrapText($encoded, $maxlen, true);
- $encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
- $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
- } elseif (strlen($str) > $maxlen) {
- //No chars need encoding, but line is too long, so fold it
- $encoded = trim($this->wrapText($str, $maxlen, false));
- if ($str == $encoded) {
- //Wrapping nicely didn't work, wrap hard instead
- $encoded = trim(chunk_split($str, static::STD_LINE_LENGTH, static::$LE));
- }
- $encoded = str_replace(static::$LE, "\n", trim($encoded));
- $encoded = preg_replace('/^(.*)$/m', ' \\1', $encoded);
+ if ($this->has8bitChars($str)) {
+ $charset = $this->CharSet;
} else {
- //No reformatting needed
- return $str;
+ $charset = static::CHARSET_ASCII;
+ }
+
+ // Q/B encoding adds 8 chars and the charset ("` =??[QB]??=`").
+ $overhead = 8 + strlen($charset);
+
+ if ('mail' == $this->Mailer) {
+ $maxlen = static::MAIL_MAX_LINE_LENGTH - $overhead;
+ } else {
+ $maxlen = static::STD_LINE_LENGTH - $overhead;
+ }
+
+ // Select the encoding that produces the shortest output and/or prevents corruption.
+ if ($matchcount > strlen($str) / 3) {
+ // More than 1/3 of the content needs encoding, use B-encode.
+ $encoding = 'B';
+ } elseif ($matchcount > 0) {
+ // Less than 1/3 of the content needs encoding, use Q-encode.
+ $encoding = 'Q';
+ } elseif (strlen($str) > $maxlen) {
+ // No encoding needed, but value exceeds max line length, use Q-encode to prevent corruption.
+ $encoding = 'Q';
+ } else {
+ // No reformatting needed
+ $encoding = false;
+ }
+
+ switch ($encoding) {
+ case 'B':
+ if ($this->hasMultiBytes($str)) {
+ // Use a custom function which correctly encodes and wraps long
+ // multibyte strings without breaking lines within a character
+ $encoded = $this->base64EncodeWrapMB($str, "\n");
+ } else {
+ $encoded = base64_encode($str);
+ $maxlen -= $maxlen % 4;
+ $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
+ }
+ $encoded = preg_replace('/^(.*)$/m', ' =?' . $charset . "?$encoding?\\1?=", $encoded);
+ break;
+ case 'Q':
+ $encoded = $this->encodeQ($str, $position);
+ $encoded = $this->wrapText($encoded, $maxlen, true);
+ $encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
+ $encoded = preg_replace('/^(.*)$/m', ' =?' . $charset . "?$encoding?\\1?=", $encoded);
+ break;
+ default:
+ return $str;
}
return trim(static::normalizeBreaks($encoded));
@@ -3286,6 +3400,10 @@ class PHPMailer
* @param string $encoding File encoding (see $Encoding)
* @param string $type File extension (MIME) type
* @param string $disposition Disposition to use
+ *
+ * @throws Exception
+ *
+ * @return bool True on successfully adding an attachment
*/
public function addStringAttachment(
$string,
@@ -3294,21 +3412,38 @@ class PHPMailer
$type = '',
$disposition = 'attachment'
) {
- // If a MIME type is not specified, try to work it out from the file name
- if ('' == $type) {
- $type = static::filenameToType($filename);
+ try {
+ // If a MIME type is not specified, try to work it out from the file name
+ if ('' == $type) {
+ $type = static::filenameToType($filename);
+ }
+
+ if (!$this->validateEncoding($encoding)) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
+
+ // Append to $attachment array
+ $this->attachment[] = [
+ 0 => $string,
+ 1 => $filename,
+ 2 => static::mb_pathinfo($filename, PATHINFO_BASENAME),
+ 3 => $encoding,
+ 4 => $type,
+ 5 => true, // isStringAttachment
+ 6 => $disposition,
+ 7 => 0,
+ ];
+ } catch (Exception $exc) {
+ $this->setError($exc->getMessage());
+ $this->edebug($exc->getMessage());
+ if ($this->exceptions) {
+ throw $exc;
+ }
+
+ return false;
}
- // Append to $attachment array
- $this->attachment[] = [
- 0 => $string,
- 1 => $filename,
- 2 => basename($filename),
- 3 => $encoding,
- 4 => $type,
- 5 => true, // isStringAttachment
- 6 => $disposition,
- 7 => 0,
- ];
+
+ return true;
}
/**
@@ -3328,38 +3463,58 @@ class PHPMailer
* @param string $type File MIME type
* @param string $disposition Disposition to use
*
+ * @throws Exception
+ *
* @return bool True on successfully adding an attachment
*/
- public function addEmbeddedImage($path, $cid, $name = '', $encoding = self::ENCODING_BASE64, $type = '', $disposition = 'inline')
- {
- if (!static::isPermittedPath($path) || !@is_file($path)) {
- $this->setError($this->lang('file_access') . $path);
+ public function addEmbeddedImage(
+ $path,
+ $cid,
+ $name = '',
+ $encoding = self::ENCODING_BASE64,
+ $type = '',
+ $disposition = 'inline'
+ ) {
+ try {
+ if (!static::isPermittedPath($path) || !@is_file($path)) {
+ throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
+ }
+
+ // If a MIME type is not specified, try to work it out from the file name
+ if ('' == $type) {
+ $type = static::filenameToType($path);
+ }
+
+ if (!$this->validateEncoding($encoding)) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
+
+ $filename = static::mb_pathinfo($path, PATHINFO_BASENAME);
+ if ('' == $name) {
+ $name = $filename;
+ }
+
+ // Append to $attachment array
+ $this->attachment[] = [
+ 0 => $path,
+ 1 => $filename,
+ 2 => $name,
+ 3 => $encoding,
+ 4 => $type,
+ 5 => false, // isStringAttachment
+ 6 => $disposition,
+ 7 => $cid,
+ ];
+ } catch (Exception $exc) {
+ $this->setError($exc->getMessage());
+ $this->edebug($exc->getMessage());
+ if ($this->exceptions) {
+ throw $exc;
+ }
return false;
}
- // If a MIME type is not specified, try to work it out from the file name
- if ('' == $type) {
- $type = static::filenameToType($path);
- }
-
- $filename = basename($path);
- if ('' == $name) {
- $name = $filename;
- }
-
- // Append to $attachment array
- $this->attachment[] = [
- 0 => $path,
- 1 => $filename,
- 2 => $name,
- 3 => $encoding,
- 4 => $type,
- 5 => false, // isStringAttachment
- 6 => $disposition,
- 7 => $cid,
- ];
-
return true;
}
@@ -3378,6 +3533,8 @@ class PHPMailer
* @param string $type MIME type - will be used in preference to any automatically derived type
* @param string $disposition Disposition to use
*
+ * @throws Exception
+ *
* @return bool True on successfully adding an attachment
*/
public function addStringEmbeddedImage(
@@ -3388,26 +3545,62 @@ class PHPMailer
$type = '',
$disposition = 'inline'
) {
- // If a MIME type is not specified, try to work it out from the name
- if ('' == $type and !empty($name)) {
- $type = static::filenameToType($name);
+ try {
+ // If a MIME type is not specified, try to work it out from the name
+ if ('' == $type and !empty($name)) {
+ $type = static::filenameToType($name);
+ }
+
+ if (!$this->validateEncoding($encoding)) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
+
+ // Append to $attachment array
+ $this->attachment[] = [
+ 0 => $string,
+ 1 => $name,
+ 2 => $name,
+ 3 => $encoding,
+ 4 => $type,
+ 5 => true, // isStringAttachment
+ 6 => $disposition,
+ 7 => $cid,
+ ];
+ } catch (Exception $exc) {
+ $this->setError($exc->getMessage());
+ $this->edebug($exc->getMessage());
+ if ($this->exceptions) {
+ throw $exc;
+ }
+
+ return false;
}
- // Append to $attachment array
- $this->attachment[] = [
- 0 => $string,
- 1 => $name,
- 2 => $name,
- 3 => $encoding,
- 4 => $type,
- 5 => true, // isStringAttachment
- 6 => $disposition,
- 7 => $cid,
- ];
-
return true;
}
+ /**
+ * Validate encodings.
+ *
+ * @param $encoding
+ *
+ * @return bool
+ */
+ protected function validateEncoding($encoding)
+ {
+ return in_array(
+ $encoding,
+ [
+ self::ENCODING_7BIT,
+ self::ENCODING_QUOTED_PRINTABLE,
+ self::ENCODING_BASE64,
+ self::ENCODING_8BIT,
+ self::ENCODING_BINARY,
+ ],
+ true
+ );
+ }
+
/**
* Check if an embedded attachment is present with this cid.
*
@@ -3783,7 +3976,7 @@ class PHPMailer
// Do not change absolute URLs, including anonymous protocol
and !preg_match('#^[a-z][a-z0-9+.-]*:?//#i', $url)
) {
- $filename = basename($url);
+ $filename = static::mb_pathinfo($url, PATHINFO_BASENAME);
$directory = dirname($url);
if ('.' == $directory) {
$directory = '';
@@ -4014,7 +4207,7 @@ class PHPMailer
* Multi-byte-safe pathinfo replacement.
* Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe.
*
- * @see http://www.php.net/manual/en/function.pathinfo.php#107461
+ * @see http://www.php.net/manual/en/function.pathinfo.php#107461
*
* @param string $path A filename or path, does not need to exist as a file
* @param int|string $options Either a PATHINFO_* constant,
@@ -4026,7 +4219,7 @@ class PHPMailer
{
$ret = ['dirname' => '', 'basename' => '', 'extension' => '', 'filename' => ''];
$pathinfo = [];
- if (preg_match('#^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$#im', $path, $pathinfo)) {
+ if (preg_match('#^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^.\\\\/]+?)|))[\\\\/.]*$#m', $path, $pathinfo)) {
if (array_key_exists(1, $pathinfo)) {
$ret['dirname'] = $pathinfo[1];
}
@@ -4063,9 +4256,9 @@ class PHPMailer
* You should avoid this function - it's more verbose, less efficient, more error-prone and
* harder to debug than setting properties directly.
* Usage Example:
- * `$mail->set('SMTPSecure', 'tls');`
+ * `$mail->set('SMTPSecure', static::ENCRYPTION_STARTTLS);`
* is the same as:
- * `$mail->SMTPSecure = 'tls';`.
+ * `$mail->SMTPSecure = static::ENCRYPTION_STARTTLS;`.
*
* @param string $name The property name to set
* @param mixed $value The value to set the property to
@@ -4221,7 +4414,7 @@ class PHPMailer
* Uses the 'relaxed' algorithm from RFC6376 section 3.4.2.
* Canonicalized headers should *always* use CRLF, regardless of mailer setting.
*
- * @see https://tools.ietf.org/html/rfc6376#section-3.4.2
+ * @see https://tools.ietf.org/html/rfc6376#section-3.4.2
*
* @param string $signHeader Header
*
@@ -4229,12 +4422,14 @@ class PHPMailer
*/
public function DKIM_HeaderC($signHeader)
{
- //Unfold all header continuation lines
- //Also collapses folded whitespace.
//Note PCRE \s is too broad a definition of whitespace; RFC5322 defines it as `[ \t]`
//@see https://tools.ietf.org/html/rfc5322#section-2.2
//That means this may break if you do something daft like put vertical tabs in your headers.
- $signHeader = preg_replace('/\r\n[ \t]+/', ' ', $signHeader);
+ //Unfold header lines
+ $signHeader = preg_replace('/\r\n[ \t]+/m', '', $signHeader);
+ //Collapse internal whitespace to a single space
+// $signHeader = preg_replace('/[ \t]+/', ' ', $signHeader);
+ //Break headers out into an array
$lines = explode("\r\n", $signHeader);
foreach ($lines as $key => $line) {
//If the header is missing a :, skip it as it's invalid
@@ -4246,12 +4441,12 @@ class PHPMailer
list($heading, $value) = explode(':', $line, 2);
//Lower-case header name
$heading = strtolower($heading);
- //Collapse white space within the value
- $value = preg_replace('/[ \t]{2,}/', ' ', $value);
+ //Collapse white space within the value, also convert WSP to space
+ $value = preg_replace('/[ \t]+/', ' ', $value);
//RFC6376 is slightly unclear here - it says to delete space at the *end* of each value
//But then says to delete space before and after the colon.
//Net result is the same as trimming both ends of the value.
- //by elimination, the same applies to the field name
+ //By elimination, the same applies to the field name
$lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t");
}
@@ -4263,7 +4458,7 @@ class PHPMailer
* Uses the 'simple' algorithm from RFC6376 section 3.4.3.
* Canonicalized bodies should *always* use CRLF, regardless of mailer setting.
*
- * @see https://tools.ietf.org/html/rfc6376#section-3.4.3
+ * @see https://tools.ietf.org/html/rfc6376#section-3.4.3
*
* @param string $body Message Body
*
@@ -4346,7 +4541,7 @@ class PHPMailer
$extraHeaderKeys .= ':' . $key;
$extraHeaderValues .= $value . "\r\n";
if ($this->DKIM_copyHeaderFields) {
- $extraCopyHeaderFields .= "\t|" . str_replace('|', '=7C', $this->DKIM_QP($value)) . ";\r\n";
+ $extraCopyHeaderFields .= ' |' . str_replace('|', '=7C', $this->DKIM_QP($value)) . ";\r\n";
}
}
if ($this->DKIM_copyHeaderFields) {
@@ -4354,10 +4549,10 @@ class PHPMailer
$to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
$date = str_replace('|', '=7C', $this->DKIM_QP($date_header));
$subject = str_replace('|', '=7C', $this->DKIM_QP($subject_header));
- $copiedHeaderFields = "\tz=$from\r\n" .
- "\t|$to\r\n" .
- "\t|$date\r\n" .
- "\t|$subject;\r\n" .
+ $copiedHeaderFields = " z=$from\r\n" .
+ " |$to\r\n" .
+ " |$date\r\n" .
+ " |$subject;\r\n" .
$extraCopyHeaderFields;
}
$body = $this->DKIM_BodyC($body);
@@ -4374,12 +4569,12 @@ class PHPMailer
$DKIMlen . '; s=' .
$this->DKIM_selector .
";\r\n" .
- "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
- "\th=From:To:Date:Subject" . $extraHeaderKeys . ";\r\n" .
- "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
+ ' t=' . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
+ ' h=From:To:Date:Subject' . $extraHeaderKeys . ";\r\n" .
+ ' d=' . $this->DKIM_domain . ';' . $ident . "\r\n" .
$copiedHeaderFields .
- "\tbh=" . $DKIMb64 . ";\r\n" .
- "\tb=";
+ ' bh=' . $DKIMb64 . ";\r\n" .
+ ' b=';
$toSign = $this->DKIM_HeaderC(
$from_header . "\r\n" .
$to_header . "\r\n" .
diff --git a/vendor/phpmailer/phpmailer/src/POP3.php b/vendor/phpmailer/phpmailer/src/POP3.php
index 66cf2730..e6ad6310 100644
--- a/vendor/phpmailer/phpmailer/src/POP3.php
+++ b/vendor/phpmailer/phpmailer/src/POP3.php
@@ -3,13 +3,13 @@
* PHPMailer POP-Before-SMTP Authentication Class.
* PHP Version 5.5.
*
- * @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
+ * @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
*
* @author Marcus Bointon (Synchro/coolbru)
* @author Jim Jagielski (jimjag)
* @author Andy Prevost (codeworxtech)
* @author Brent R. Matzelle (original founder)
- * @copyright 2012 - 2017 Marcus Bointon
+ * @copyright 2012 - 2019 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@@ -29,14 +29,14 @@ namespace PHPMailer\PHPMailer;
* and then loop through your mail sending script. Providing this process doesn't
* take longer than the verification period lasts on your POP3 server, you should be fine.
* 3) This is really ancient technology; you should only need to use it to talk to very old systems.
- * 4) This POP3 class is deliberately lightweight and incomplete, and implements just
+ * 4) This POP3 class is deliberately lightweight and incomplete, implementing just
* enough to do authentication.
* If you want a more complete class there are other POP3 classes for PHP available.
*
- * @author Richard Davey (original author)
- * @author Marcus Bointon (Synchro/coolbru)
- * @author Jim Jagielski (jimjag)
- * @author Andy Prevost (codeworxtech)
+ * @author Richard Davey (original author)
+ * @author Marcus Bointon (Synchro/coolbru)
+ * @author Jim Jagielski (jimjag)
+ * @author Andy Prevost (codeworxtech)
*/
class POP3
{
@@ -45,7 +45,7 @@ class POP3
*
* @var string
*/
- const VERSION = '6.0.7';
+ const VERSION = '6.1.1';
/**
* Default POP3 port number.
diff --git a/vendor/phpmailer/phpmailer/src/SMTP.php b/vendor/phpmailer/phpmailer/src/SMTP.php
index da85442b..77df57ce 100644
--- a/vendor/phpmailer/phpmailer/src/SMTP.php
+++ b/vendor/phpmailer/phpmailer/src/SMTP.php
@@ -9,7 +9,7 @@
* @author Jim Jagielski (jimjag)
* @author Andy Prevost (codeworxtech)
* @author Brent R. Matzelle (original founder)
- * @copyright 2012 - 2017 Marcus Bointon
+ * @copyright 2012 - 2019 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@@ -24,8 +24,8 @@ namespace PHPMailer\PHPMailer;
* PHPMailer RFC821 SMTP email transport class.
* Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
*
- * @author Chris Ryan
- * @author Marcus Bointon
+ * @author Chris Ryan
+ * @author Marcus Bointon
*/
class SMTP
{
@@ -34,7 +34,7 @@ class SMTP
*
* @var string
*/
- const VERSION = '6.0.7';
+ const VERSION = '6.1.1';
/**
* SMTP line break constant.
@@ -59,26 +59,36 @@ class SMTP
/**
* Debug level for no output.
+ *
+ * @var int
*/
const DEBUG_OFF = 0;
/**
* Debug level to show client -> server messages.
+ *
+ * @var int
*/
const DEBUG_CLIENT = 1;
/**
* Debug level to show client -> server and server -> client messages.
+ *
+ * @var int
*/
const DEBUG_SERVER = 2;
/**
* Debug level to show connection status, client -> server and server -> client messages.
+ *
+ * @var int
*/
const DEBUG_CONNECTION = 3;
/**
* Debug level to show all messages.
+ *
+ * @var int
*/
const DEBUG_LOWLEVEL = 4;
@@ -745,7 +755,7 @@ class SMTP
*
* @return bool
*
- * @see hello()
+ * @see hello()
*/
protected function sendHello($hello, $host)
{
@@ -853,14 +863,35 @@ class SMTP
* Implements from RFC 821: RCPT TO: .
*
* @param string $address The address the message is being sent to
+ * @param string $dsn Comma separated list of DSN notifications. NEVER, SUCCESS, FAILURE
+ * or DELAY. If you specify NEVER all other notifications are ignored.
*
* @return bool
*/
- public function recipient($address)
+ public function recipient($address, $dsn = '')
{
+ if (empty($dsn)) {
+ $rcpt = 'RCPT TO:<' . $address . '>';
+ } else {
+ $dsn = strtoupper($dsn);
+ $notify = [];
+
+ if (strpos($dsn, 'NEVER') !== false) {
+ $notify[] = 'NEVER';
+ } else {
+ foreach (['SUCCESS', 'FAILURE', 'DELAY'] as $value) {
+ if (strpos($dsn, $value) !== false) {
+ $notify[] = $value;
+ }
+ }
+ }
+
+ $rcpt = 'RCPT TO:<' . $address . '> NOTIFY=' . implode(',', $notify);
+ }
+
return $this->sendCommand(
'RCPT TO',
- 'RCPT TO:<' . $address . '>',
+ $rcpt,
[250, 251]
);
}
@@ -904,7 +935,7 @@ class SMTP
$this->last_reply = $this->get_lines();
// Fetch SMTP code and possible error code explanation
$matches = [];
- if (preg_match('/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/', $this->last_reply, $matches)) {
+ if (preg_match('/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]{1,2}) )?/', $this->last_reply, $matches)) {
$code = $matches[1];
$code_ex = (count($matches) > 2 ? $matches[2] : null);
// Cut off error code from each response line
@@ -1289,7 +1320,7 @@ class SMTP
* If no reply has been received yet, it will return null.
* If no pattern was matched, it will return false.
*
- * @return bool|null|string
+ * @return bool|string|null
*/
protected function recordLastTransactionID()
{
@@ -1315,7 +1346,7 @@ class SMTP
* If no reply has been received yet, it will return null.
* If no pattern was matched, it will return false.
*
- * @return bool|null|string
+ * @return bool|string|null
*
* @see recordLastTransactionID()
*/
diff --git a/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/BucketStyleListener.php b/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/BucketStyleListener.php
index a7f29b8e..0288d32a 100644
--- a/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/BucketStyleListener.php
+++ b/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/BucketStyleListener.php
@@ -47,7 +47,6 @@ class BucketStyleListener implements EventSubscriberInterface {
* @param Event $event Event emitted.
*/
public function onCommandAfterPrepare(Event $event) {
-
$command = $event['command'];
$bucket = $command['Bucket'];
$request = $command->getRequest();
@@ -81,7 +80,7 @@ class BucketStyleListener implements EventSubscriberInterface {
$bucket = $bucket.'-'.$this->appId;
}
$request->getParams()->set('bucket', $bucket)->set('key', $key);
-
+
$realHost = $bucket. '.' . $request->getHost();
if($this->ipport != null) {
$request->setHost($this->ipport);
diff --git a/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/Client.php b/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/Client.php
index 53bb78db..1042386f 100644
--- a/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/Client.php
+++ b/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/Client.php
@@ -12,7 +12,7 @@ use Qcloud\Cos\Signature;
use Qcloud\Cos\TokenListener;
class Client extends GSClient {
- const VERSION = '1.3.3';
+ const VERSION = '1.3.4';
private $region; // string: region.
private $credentials;
diff --git a/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/Signature.php b/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/Signature.php
index 2b1b46cf..28eb41eb 100644
--- a/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/Signature.php
+++ b/vendor/qcloud/cos-sdk-v5/src/Qcloud/Cos/Signature.php
@@ -11,9 +11,10 @@ class Signature {
public function __destruct() {
}
public function signRequest(RequestInterface $request) {
+ $host = $request->getHeader('Host');
$signTime = (string)(time() - 60) . ';' . (string)(time() + 3600);
$httpString = strtolower($request->getMethod()) . "\n" . urldecode($request->getPath()) .
- "\n\nhost=" . $request->getHost() . "\n";
+ "\n\nhost=" . $host . "\n";
$sha1edHttpString = sha1($httpString);
$stringToSign = "sha1\n$signTime\n$sha1edHttpString\n";
$signKey = hash_hmac('sha1', $signTime, $this->secretKey);
@@ -27,9 +28,10 @@ class Signature {
RequestInterface $request,
$expires = "10 minutes"
) {
+ $host = $request->getHeader('Host');
$signTime = (string)(time() - 60) . ';' . (string)(strtotime($expires));
$httpString = strtolower($request->getMethod()) . "\n" . urldecode($request->getPath()) .
- "\n\nhost=" . $request->getHost() . "\n";
+ "\n\nhost=" . $host . "\n";
$sha1edHttpString = sha1($httpString);
$stringToSign = "sha1\n$signTime\n$sha1edHttpString\n";
$signKey = hash_hmac('sha1', $signTime, $this->secretKey);
diff --git a/vendor/qiniu/php-sdk/.travis.yml b/vendor/qiniu/php-sdk/.travis.yml
index cada8cd0..e4eee7be 100644
--- a/vendor/qiniu/php-sdk/.travis.yml
+++ b/vendor/qiniu/php-sdk/.travis.yml
@@ -7,6 +7,8 @@ php:
- 5.6
- 7.0
+dist: trusty
+
before_script:
- export QINIU_TEST_ENV="travis"
- travis_retry composer self-update
diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php
index c3247579..9b462f31 100644
--- a/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php
+++ b/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php
@@ -170,23 +170,16 @@ final class CdnManager
public static function createTimestampAntiLeechUrl($rawUrl, $encryptKey, $durationInSeconds)
{
$parsedUrl = parse_url($rawUrl);
-
$deadline = time() + $durationInSeconds;
$expireHex = dechex($deadline);
-
$path = isset($parsedUrl['path']) ? $parsedUrl['path'] : '';
- $path = implode('/', array_map('rawurlencode', explode('/', $path)));
$strToSign = $encryptKey . $path . $expireHex;
$signStr = md5($strToSign);
-
- $url = $parsedUrl['scheme'].'://'.$parsedUrl['host'].$path;
-
if (isset($parsedUrl['query'])) {
- $signedUrl = $url . '&sign=' . $signStr . '&t=' . $expireHex;
+ $signedUrl = $rawUrl . '&sign=' . $signStr . '&t=' . $expireHex;
} else {
- $signedUrl = $url . '?sign=' . $signStr . '&t=' . $expireHex;
+ $signedUrl = $rawUrl . '?sign=' . $signStr . '&t=' . $expireHex;
}
-
return $signedUrl;
}
}
diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Config.php b/vendor/qiniu/php-sdk/src/Qiniu/Config.php
index ec75df68..c80cd309 100644
--- a/vendor/qiniu/php-sdk/src/Qiniu/Config.php
+++ b/vendor/qiniu/php-sdk/src/Qiniu/Config.php
@@ -3,7 +3,7 @@ namespace Qiniu;
final class Config
{
- const SDK_VER = '7.2.9';
+ const SDK_VER = '7.2.10';
const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改
diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php b/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php
index 0fd0019a..a7dc11e1 100755
--- a/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php
+++ b/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php
@@ -33,7 +33,7 @@ class AppClient
if (!empty($maxUsers)) {
$params['maxUsers'] = $maxUsers;
}
- if (!empty($noAutoKickUser)) {
+ if ($noAutoKickUser !== null) {
$params['noAutoKickUser'] = $noAutoKickUser;
}
$body = json_encode($params);
@@ -65,7 +65,7 @@ class AppClient
if (!empty($maxUsers)) {
$params['maxUsers'] = $maxUsers;
}
- if (!empty($noAutoKickUser)) {
+ if ($noAutoKickUser !== null) {
$params['noAutoKickUser'] = $noAutoKickUser;
}
if (!empty($mergePublishRtmp)) {
diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php b/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php
index 592d6ba7..f19a124f 100644
--- a/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php
+++ b/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php
@@ -33,7 +33,7 @@ class Sms
"signature_id":
}
*/
- public function createSignature(string $signature, string $source, string $pics = null)
+ public function createSignature($signature, $source, $pics = null)
{
$params['signature'] = $signature;
$params['source'] = $source;
@@ -62,7 +62,7 @@ class Sms
"signature": string
}
*/
- public function updateSignature(string $id, string $signature, string $source, string $pics = null)
+ public function updateSignature($id, $signature, $source, $pics = null)
{
$params['signature'] = $signature;
$params['source'] = $source;
@@ -96,7 +96,7 @@ class Sms
"page_size": int,
}
*/
- public function checkSignature(string $audit_status = null, int $page = 1, int $page_size = 20)
+ public function checkSignature($audit_status = null, $page = 1, $page_size = 20)
{
$url = sprintf(
@@ -116,7 +116,7 @@ class Sms
* id 签名id string 类型,必填,
* @retrun : 请求成功 HTTP 状态码为 200
*/
- public function deleteSignature(string $id)
+ public function deleteSignature($id)
{
$url = $this->baseURL . 'signature/' . $id;
list(, $err) = $this->delete($url);
@@ -139,11 +139,11 @@ class Sms
}
*/
public function createTemplate(
- string $name,
- string $template,
- string $type,
- string $description,
- string $signture_id
+ $name,
+ $template,
+ $type,
+ $description,
+ $signture_id
) {
$params['name'] = $name;
$params['template'] = $template;
@@ -181,7 +181,7 @@ class Sms
"page_size": int
}
*/
- public function queryTemplate(string $audit_status = null, int $page = 1, int $page_size = 20)
+ public function queryTemplate($audit_status = null, $page = 1, $page_size = 20)
{
$url = sprintf(
@@ -205,11 +205,11 @@ class Sms
* @retrun : 请求成功 HTTP 状态码为 200
*/
public function updateTemplate(
- string $id,
- string $name,
- string $template,
- string $description,
- string $signature_id
+ $id,
+ $name,
+ $template,
+ $description,
+ $signature_id
) {
$params['name'] = $name;
$params['template'] = $template;
@@ -226,7 +226,7 @@ class Sms
* id :模板id string 类型,必填,
* @retrun : 请求成功 HTTP 状态码为 200
*/
- public function deleteTemplate(string $id)
+ public function deleteTemplate($id)
{
$url = $this->baseURL . 'template/' . $id;
list(, $err) = $this->delete($url);
@@ -243,7 +243,7 @@ class Sms
"job_id": string
}
*/
- public function sendMessage(string $template_id, array $mobiles, array $parameters = null)
+ public function sendMessage($template_id, $mobiles, $parameters = null)
{
$params['template_id'] = $template_id;
$params['mobiles'] = $mobiles;
@@ -256,7 +256,7 @@ class Sms
return $ret;
}
- public function imgToBase64(string $img_file)
+ public function imgToBase64($img_file)
{
$img_base64 = '';
if (file_exists($img_file)) {
diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php
index e38f433e..0a2413dd 100644
--- a/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php
+++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php
@@ -59,7 +59,7 @@ final class BucketManager
$line = 'false',
$shared = 'false'
) {
- $path = '/v3/buckets?region=' . $region . '&line=' . $line . '&shared=' . $share;
+ $path = '/v3/buckets?region=' . $region . '&line=' . $line . '&shared=' . $shared;
$info = $this->ucPost($path);
return $info;
}
diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php
index 209df11a..8fbd504c 100644
--- a/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php
+++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php
@@ -46,7 +46,7 @@ final class UploadManager
$data,
$params = null,
$mime = 'application/octet-stream',
- $fname = null
+ $fname = "default_filename"
) {
$params = self::trimParams($params);
diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php
index 3c45bbdf..892197da 100755
--- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php
+++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php
@@ -25,7 +25,7 @@ class CdnManagerTest extends \PHPUnit_Framework_TestCase
$this->cdnManager = new CdnManager($testAuth);
$this->encryptKey = $timestampAntiLeechEncryptKey;
- $this->imgUrl = $customDomain . '/24.jpg';
+ $this->imgUrl = $customDomain . '/sdktest.png';
}
public function testCreateTimestampAntiLeechUrl()
diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php
index 82990f2a..5373ab37 100755
--- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php
+++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php
@@ -8,7 +8,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase
public function test()
{
global $testAuth;
- $base_url = 'http://private-res.qiniudn.com/gogopher.jpg';
+ $base_url = 'http://sdk.peterpy.cn/gogopher.jpg';
$private_url = $testAuth->privateDownloadUrl($base_url);
$response = Client::get($private_url);
$this->assertEquals(200, $response->statusCode);
@@ -17,7 +17,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase
public function testFop()
{
global $testAuth;
- $base_url = 'http://private-res.qiniudn.com/gogopher.jpg?exif';
+ $base_url = 'http://sdk.peterpy.cn/gogopher.jpg?exif';
$private_url = $testAuth->privateDownloadUrl($base_url);
$response = Client::get($private_url);
$this->assertEquals(200, $response->statusCode);
diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php
index e1ea730e..6cbdb7f7 100755
--- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php
+++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php
@@ -8,7 +8,7 @@ class FopTest extends \PHPUnit_Framework_TestCase
{
public function testExifPub()
{
- $fop = new Operation('testres.qiniudn.com');
+ $fop = new Operation('sdk.peterpy.cn');
list($exif, $error) = $fop->execute('gogopher.jpg', 'exif');
$this->assertNull($error);
$this->assertNotNull($exif);
diff --git a/vendor/qiniu/php-sdk/tests/bootstrap.php b/vendor/qiniu/php-sdk/tests/bootstrap.php
index c300057c..5cbce357 100755
--- a/vendor/qiniu/php-sdk/tests/bootstrap.php
+++ b/vendor/qiniu/php-sdk/tests/bootstrap.php
@@ -21,7 +21,7 @@ $dummyAuth = new Auth($dummyAccessKey, $dummySecretKey);
//cdn
$timestampAntiLeechEncryptKey = getenv('QINIU_TIMESTAMP_ENCRPTKEY');
-$customDomain = "http://phpsdk.peterpy.cn";
+$customDomain = "http://sdk.peterpy.cn";
$tid = getenv('TRAVIS_JOB_NUMBER');
if (!empty($tid)) {
diff --git a/vendor/upyun/sdk/.gitattributes b/vendor/upyun/sdk/.gitattributes
new file mode 100644
index 00000000..7cf65400
--- /dev/null
+++ b/vendor/upyun/sdk/.gitattributes
@@ -0,0 +1,6 @@
+* text=auto
+
+/examples export-ignore
+/tests export-ignore
+/doc.md export-ignore
+/phpunit.xml export-ignore
diff --git a/vendor/upyun/sdk/README.md b/vendor/upyun/sdk/README.md
index 12f49b7e..8eda96a7 100644
--- a/vendor/upyun/sdk/README.md
+++ b/vendor/upyun/sdk/README.md
@@ -95,6 +95,15 @@ $file = fopen('/local/path/file', 'r');
$client->write('/save/path', $file);
```
+#### 使用并行式断点续传上传文件
+
+```
+$serviceConfig->setUploadType('BLOCK_PARALLEL');
+$client = new Upyun($serviceConfig);
+$file = fopen('/local/path/file', 'r');
+$client->write('/save/path', $file);
+```
+
#### 上传图片并转换格式为 `png`,详见[上传作图](http://docs.upyun.com/cloud/image/#_2)
```
diff --git a/vendor/upyun/sdk/doc.md b/vendor/upyun/sdk/doc.md
deleted file mode 100644
index 6da98893..00000000
--- a/vendor/upyun/sdk/doc.md
+++ /dev/null
@@ -1,517 +0,0 @@
-# SDK 文档
-
-又拍云 php sdk 中所有封装的接口,均通过 `Upyun\Upyun` 类封装,后续新版本也会保持
-该类方法向下兼容,sdk 中其他类及其方法不保证兼容性。如果有使用疑问欢迎提 [issues](https://github.com/upyun/php-sdk/issues)
-
-## 方法列表
-
-* [Upyun](#upyun)
- * [__construct](#__construct)
- * [setConfig](#setconfig) 更新服务配置
- * [write](#write) 上传一个文件到又拍云存储
- * [read](#read) 读取云存储文件/目录内容
- * [has](#has) 判断文件是否存在于又拍云存储
- * [info](#info) 获取云存储文件/目录的基本信息
- * [getMimetype](#getmimetype) 获取云存储文件类型
- * [delete](#delete) 删除文件或者目录
- * [createDir](#createdir) 创建目录
- * [deleteDir](#deletedir) 删除文件或者目录
- * [usage](#usage) 获取目录下存储使用量
- * [purge](#purge) 刷新缓存
- * [process](#process) 异步云处理
- * [queryProcessStatus](#queryprocessstatus) 查询异步云处理任务进度
- * [queryProcessResult](#queryprocessresult) 查询异步云处理任务结果
-
-## Upyun
-
-`Upyun\Upyun` 类实现了又拍云云存储和云处理的所有接口,通过该类可以实现文件上传、下载;图片视频等多媒体资源云处理。
-本文档中,提到的"服务"是指又拍云文件加速回又拍云源类型的服务(即原先的存储类服务)。
-
-* 命名空间: `\Upyun\Upyun`
-
-
-### __construct
-
-Upyun constructor.
-
-```php
-Upyun::__construct( \Upyun\Config $config )
-```
-
-**参数列表:**
-
-- **\Upyun\Config** `$config`
- 服务配置
-
----
-
-### setConfig
-
-更新服务配置
-
-```php
-Upyun::setConfig( \Upyun\Config $config )
-```
-
- 当需要操作的新的服务时,使用该方法传入新的服务配置即可
-
-**参数列表:**
-
-- **\Upyun\Config** `$config`
- 服务配置
-
----
-
-
-### write
-
-上传一个文件到又拍云存储
-
-```php
-Upyun::write( string $path, string|resource $content, array $params = array(), boolean $withAsyncProcess = false )
-```
-
- 上传的文件格式支持文件流或者字符串方式上传。除简单的文件上传外,针对多媒体资源(图片、音视频),还可以设置同步/异步预处理多媒体资源,例如:图片的裁剪缩放,音视频的转码截图等等众多又拍云强大的云处理功能
-
-
-**参数列表:**
-
-
-- **string** `$path`
- 被上传的文件在又拍云存储服务中保存的路径
-
-- **string|resource** `$content`
- 被上传的文件内容(字符串),或者打开该文件获得的文件句柄(文件流)。当上传本地大文件时,推荐使用文件流的方式上传
-
-- **array** `$params`
- 上传文件时,附加的自定义参数。支持 Content-MD5 Content-Type Content-Secret 等,详见 [上传参数](http://docs.upyun.com/api/rest_api/#_2),例如:
- - 设置文件[保护秘钥](http://docs.upyun.com/api/rest_api/#Content-Secret) `write($path, $content, array('Content-Secret' => 'my-secret'))`;
- - 添加[文件元信息](http://docs.upyun.com/api/rest_api/#metadata) `write($path, $content, array('X-Upyun-Meta-Foo' =>
- 'bar'))`
- - [图片同步预处理](http://docs.upyun.com/cloud/image/#_5) `write($path, $content, array('x-gmkerl-thumb' => '/format/png'))`
-
-- **boolean** `$withAsyncProcess`
- 默认为 `false`,当上传图片或者音视频资源时,可以设置该参数为 `true`,开启图片音视频的[异步处理功能](http://docs.upyun.com/api/form_api/#_6) ,例如:
- ```
- // 以下参数会将新上传的图片,再异步生成另一份 png 格式的图片,原图不受影响
- write($path, $content, array(
- 'apps' => array(
- array(
- 'name' => 'thumb', //异步图片处理任务
- 'x-gmkerl-thumb' => '/format/png', // 格式化图片为 png 格式
- 'save_as': '/iamge/png/new.png', // 处理成功后的图片保存路径
- 'notify_url': 'http://your.notify.url' // 异步任务完成后的回调地址
- )
- )
- ), true);
- ```
-
-
-**返回值:**
-
-若文件是图片则返回图片基本信息,如:`array('x-upyun-width' => 123, 'x-upyun-height' => 50, 'x-upyun-frames'
-=> 1, 'x-upyun-file-type' => 'JPEG')`,否则返回空数组。当使用异步预处理功能时,返回结果为布尔值,成功为 `true`。
-
-
-
----
-
-
-### read
-
-读取云存储文件/目录内容
-
-```php
-Upyun::read( string $path, resource $saveHandler = NULL, array $params = array() )
-```
-
-
-
-
-**参数列表:**
-
-
-- **string** `$path`
- 又拍云存储中的文件或者目录路径
-
-- **resource** `$saveHandler`
- 文件内容写入本地文件流。例如 `$saveHandler = fopen('/local/file', 'w')
- `。当设置该参数时,将以文件流的方式,直接将又拍云中的文件写入本地的文件流,或其他可以写入的流
-
-- **array** `$params`
- 可选参数,读取目录内容时,需要设置三个参数: `X-List-Iter` 分页开始位置(第一页不需要设置),`X-List-Limit` 获取的文件数量(默认 100,最大
- 10000),`X-List-Order` 结果以时间正序或者倒序
-
-
-**返回值:**
-
-$return 当读取文件且没有设置 `$saveHandler` 参数时,返回一个字符串类型,表示文件内容;设置了 `$saveHandler` 参数时,返回布尔值
-`true`。当读取目录时,返回一个数组,表示目录下的文件列表。目录下文件内容过多时,需要通过判断返回数组中的 `is_end` 属性,进行分页读取内容
-
-
-
----
-
-
-### has
-
-判断文件是否存在于又拍云存储
-
-```php
-Upyun::has( string $path )
-```
-
- 注意: 对刚删除的文件, 立即调用该方法可能会返回 true, 因为服务端执行删除操作后可能会有很短暂的延迟.
-
-
-**参数列表:**
-
-
-- **string** `$path`
- 云存储的文件路径
-
-
-**返回值:**
-
-存在时返回 `true`,否则返回 `false`
-
-
-
----
-
-
-### info
-
-获取云存储文件/目录的基本信息
-
-```php
-Upyun::info( string $path, array $otherHeaders)
-```
-
-
-
-
-**参数列表:**
-
-
-- **string** `$path`
- 云存储的文件路径
-
-- **string** `$otherHeaders`
- 设置了后,方法将返回其他 http header 中的信息,默认为空
-
-**返回值:**
-
-返回一个数组,默认包含以下 key
-- `x-upyun-file-type` 当 $path 是目录时,值为 *folder*,当 $path 是文件时,值为 *file*,
-- `x-upyun-file-size` 文件大小
-- `x-upyun-file-date` 文件的创建时间
-
-
-
----
-
-### getMimetype
-
-获取云存储文件的文档类型
-
-```php
-Upyun::getMimetype( string $path )
-```
-
-
-
-
-**参数列表:**
-
-
-- **string** `$path`
- 云存储的文件路径
-
-
-**返回值:**
-
-文档类型,e.g: `appcation/json`,获取失败返回空字符串
-
-
-
----
-
-
-### delete
-
-删除文件或者目录
-
-```php
-Upyun::delete( string $path, boolean $async = false )
-```
-
-
-
-
-**参数列表:**
-
-
-- **string** `$path`
- 文件或目录在又拍云存储的路径
-
-- **boolean** `$async`
- 是否异步删除,默认为 false,表示同步删除。当需要批量删除大量文件时,必须选择异步删除
-
-
-**返回值:**
-
-删除成功返回 true,否则 false
-
-
-
----
-
-
-### createDir
-
-创建目录
-
-```php
-Upyun::createDir( string $path )
-```
-
-
-
-
-**参数列表:**
-
-
-- **string** `$path`
- 需要在又拍云存储创建的目录路径
-
-
-**返回值:**
-
-创建成功返回 true,否则返回 false
-
-
-
----
-
-
-### deleteDir
-
-删除文件或者目录
-
-```php
-Upyun::deleteDir( string $path )
-```
-
-
-
-
-**参数列表:**
-
-
-- **string** `$path`
- 需要被删除的云存储文件或目录路径
-
-
-**返回值:**
-
-成功返回 true,否则 false
-
-
-
----
-
-
-### usage
-
-获取目录下存储使用量
-
-```php
-Upyun::usage( string $path = '/' )
-```
-
-
-
-
-**参数列表:**
-
-
-- **string** `$path`
- 云存储目录路径,默认为根目录,表示整个云存储服务使用的空间大小
-
-
-**返回值:**
-
-存储使用量,单位字节
-
-
-
----
-
-
-### purge
-
-刷新缓存
-
-```php
-Upyun::purge( array|string $urls )
-```
-
-
-
-
-**参数列表:**
-
-
-- **array|string** `$urls`
- 需要刷新的文件 url 列表
-
-
-**返回值:**
-
-刷新失败的 url 列表,若全部刷新成功则为空数组
-
-
-
----
-
-
-### process
-
-异步云处理
-
-```php
-Upyun::process( array $tasks, string $type, string $source )
-```
-
- 该方法是基于[又拍云云处理](http://docs.upyun.com/cloud/) 服务实现,可以实现音视频的转码、切片、剪辑;文件的压缩解压缩;文件拉取功能
-
- 注意:
- - 所有需要调用该方法处理的资源,必须已经上传到云存储服务
- - 使用 `process` 之前,必须配置 `config->processNotifyUrl`,否则会提交任务失败
-
-例如视频转码:
-```
- process(array(
- array(
- 'type' => 'video', // video 表示视频任务, audio 表示音频任务
- 'avopts' => '/s/240p(4:3)/as/1/r/30', // 处理参数,`s` 表示输出的分辨率,`r` 表示视频帧率,`as` 表示是否自动调整分辨率
- 'save_as' => '/video/240/new.mp4', // 新视频在又拍云存储的保存路径
- ),
- ... // 同时还可以添加其他任务
-), Upyun::$PROCESS_TYPE_MEDIA, $source)
-```
-注意,被处理的资源需要已经上传到又拍云云存储
-
-
-**参数列表:**
-
-
-- **array** `$tasks`
- 需要处理的任务
-
-- **string** `$type`
- 异步云处理任务类型,可选值:
- - `Upyun::$PROCESS_TYPE_MEDIA` 异步音视频处理
- - `Upyun::$PROCESS_TYPE_ZIP` 文件压缩
- - `Upyun::$PROCESS_TYPE_UNZIP` 文件解压
- - `Upyun::$PROCESS_TYPE_SYNC_FILE` 文件拉取
- - `Upyun::$PROCESS_TYPE_STITCH` 图片拼接
-
-- **string** `$source`
- 可选参数,处理异步音视频任务时,需要传递该参数,表示需要处理的文件路径
-
-
-**返回值:**
-
-任务 ID,提交了多少任务,便会返回多少任务 ID,与提交任务的顺序保持一致。可以通过任务 ID 查询处理进度。格式如下:
-```
-array(
- '35f0148d414a688a275bf915ba7cebb2',
- '98adbaa52b2f63d6d7f327a0ff223348',
-)
-```
-
-
-
----
-
-
-### queryProcessStatus
-
-音视频预处理任务进度查询
-
-```php
-Upyun::queryProcessStatus( array $taskIds )
-```
-
- 根据 `process` 方法返回的任务 ID,通过该访问查询处理进度
-
-
-**参数列表:**
-
-
-- **array** `$taskIds`
- 任务 ID
-
-
-**返回值:**
-
-查询失败返回布尔值 `false`,否则返回每个任务的百分比进度信息,格式如下:
-```
-array(
- '35f0148d414a688a275bf915ba7cebb2' => 100, // 100 表示任务完成
- 'c3103189fa906a5354d29bd807e8dc51' => 35,
- '98adbaa52b2f63d6d7f327a0ff223348' => null, // null 表示任务未开始,或异常
-)
-```
-
-
-
----
-
-
-### queryProcessResult
-
-音视频预处理任务结果查询
-
-```php
-Upyun::queryProcessResult( array $taskIds )
-```
-
- 根据 `process` 方法返回的任务 ID,通过该访问查询处理结果,会包含每个任务详细信息
-
-
-**参数列表:**
-
-
-- **array** `$taskIds`
- 任务 ID
-
-
-**返回值:**
-
-查询失败返回 `false`,否则返回每个任务的处理结果,格式如下:
-```
-array(
- '9d9c32b63a1034834e77672c6f51f661' => array(
- 'path' => array('/v2.mp4'),
- 'signature' => '4042c1f07f546d28',
- 'status_code' => 200,
- 'service' => 'your_storage_service',
- 'description' => 'OK',
- 'task_id' => '9d9c32b63a1034834e77672c6f51f661',
- 'timestamp' => 1472010684
- )
-)
-```
-
-
-
----
-
-
-
-
---------
-> This document was automatically generated from source code comments on 2017-02-06 using [phpDocumentor](http://www.phpdoc.org/) and [cvuorinen/phpdoc-markdown-public](https://github.com/cvuorinen/phpdoc-markdown-public)
diff --git a/vendor/upyun/sdk/examples/client-upload/Readme.md b/vendor/upyun/sdk/examples/client-upload/Readme.md
deleted file mode 100644
index 9d025c8b..00000000
--- a/vendor/upyun/sdk/examples/client-upload/Readme.md
+++ /dev/null
@@ -1,13 +0,0 @@
-## 客户端上传
-
-本示例展示了如何使用表单 API, 直接从客户端进行安全的文件上传, 这种方式不需要客户服务器进行中转, 节省了客户服务器流量, 并且支持 HTTP/HTTPS 两种协议
-
-DEMO 使用 `sdkimg` 空间进行演示, 上传成功后, 访问路径为 `http://sdkimg.b0.upaiyun.com/` 拼接保存路径
-
-#### 运行示例
-
-- `cd examples/client-upload`
-- `php -S localhost:9000`
-
-打开浏览器访问 `http://localhost:9000`, 选则文件上传即可.
-示例中使用 body 签名,避免 header 签名存在跨域失败的情况,因为 `Access-Control-Allow-Headers: *` 兼容性不好,是刚设定的协议[标准](https://github.com/whatwg/fetch)
diff --git a/vendor/upyun/sdk/examples/client-upload/index.html b/vendor/upyun/sdk/examples/client-upload/index.html
deleted file mode 100644
index b2a39ab9..00000000
--- a/vendor/upyun/sdk/examples/client-upload/index.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
- Document
-
-
-
-
-
-
-
-
-
-
-
diff --git a/vendor/upyun/sdk/examples/client-upload/normalize.css b/vendor/upyun/sdk/examples/client-upload/normalize.css
deleted file mode 100644
index 73454f7f..00000000
--- a/vendor/upyun/sdk/examples/client-upload/normalize.css
+++ /dev/null
@@ -1,427 +0,0 @@
-/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
-
-/**
- * 1. Set default font family to sans-serif.
- * 2. Prevent iOS text size adjust after orientation change, without disabling
- * user zoom.
- */
-
-html {
- font-family: sans-serif; /* 1 */
- -ms-text-size-adjust: 100%; /* 2 */
- -webkit-text-size-adjust: 100%; /* 2 */
-}
-
-/**
- * Remove default margin.
- */
-
-body {
- margin: 0;
-}
-
-/* HTML5 display definitions
- ========================================================================== */
-
-/**
- * Correct `block` display not defined for any HTML5 element in IE 8/9.
- * Correct `block` display not defined for `details` or `summary` in IE 10/11
- * and Firefox.
- * Correct `block` display not defined for `main` in IE 11.
- */
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-main,
-menu,
-nav,
-section,
-summary {
- display: block;
-}
-
-/**
- * 1. Correct `inline-block` display not defined in IE 8/9.
- * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
- */
-
-audio,
-canvas,
-progress,
-video {
- display: inline-block; /* 1 */
- vertical-align: baseline; /* 2 */
-}
-
-/**
- * Prevent modern browsers from displaying `audio` without controls.
- * Remove excess height in iOS 5 devices.
- */
-
-audio:not([controls]) {
- display: none;
- height: 0;
-}
-
-/**
- * Address `[hidden]` styling not present in IE 8/9/10.
- * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
- */
-
-[hidden],
-template {
- display: none;
-}
-
-/* Links
- ========================================================================== */
-
-/**
- * Remove the gray background color from active links in IE 10.
- */
-
-a {
- background-color: transparent;
-}
-
-/**
- * Improve readability when focused and also mouse hovered in all browsers.
- */
-
-a:active,
-a:hover {
- outline: 0;
-}
-
-/* Text-level semantics
- ========================================================================== */
-
-/**
- * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
- */
-
-abbr[title] {
- border-bottom: 1px dotted;
-}
-
-/**
- * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
- */
-
-b,
-strong {
- font-weight: bold;
-}
-
-/**
- * Address styling not present in Safari and Chrome.
- */
-
-dfn {
- font-style: italic;
-}
-
-/**
- * Address variable `h1` font-size and margin within `section` and `article`
- * contexts in Firefox 4+, Safari, and Chrome.
- */
-
-h1 {
- font-size: 2em;
- margin: 0.67em 0;
-}
-
-/**
- * Address styling not present in IE 8/9.
- */
-
-mark {
- background: #ff0;
- color: #000;
-}
-
-/**
- * Address inconsistent and variable font size in all browsers.
- */
-
-small {
- font-size: 80%;
-}
-
-/**
- * Prevent `sub` and `sup` affecting `line-height` in all browsers.
- */
-
-sub,
-sup {
- font-size: 75%;
- line-height: 0;
- position: relative;
- vertical-align: baseline;
-}
-
-sup {
- top: -0.5em;
-}
-
-sub {
- bottom: -0.25em;
-}
-
-/* Embedded content
- ========================================================================== */
-
-/**
- * Remove border when inside `a` element in IE 8/9/10.
- */
-
-img {
- border: 0;
-}
-
-/**
- * Correct overflow not hidden in IE 9/10/11.
- */
-
-svg:not(:root) {
- overflow: hidden;
-}
-
-/* Grouping content
- ========================================================================== */
-
-/**
- * Address margin not present in IE 8/9 and Safari.
- */
-
-figure {
- margin: 1em 40px;
-}
-
-/**
- * Address differences between Firefox and other browsers.
- */
-
-hr {
- -moz-box-sizing: content-box;
- box-sizing: content-box;
- height: 0;
-}
-
-/**
- * Contain overflow in all browsers.
- */
-
-pre {
- overflow: auto;
-}
-
-/**
- * Address odd `em`-unit font size rendering in all browsers.
- */
-
-code,
-kbd,
-pre,
-samp {
- font-family: monospace, monospace;
- font-size: 1em;
-}
-
-/* Forms
- ========================================================================== */
-
-/**
- * Known limitation: by default, Chrome and Safari on OS X allow very limited
- * styling of `select`, unless a `border` property is set.
- */
-
-/**
- * 1. Correct color not being inherited.
- * Known issue: affects color of disabled elements.
- * 2. Correct font properties not being inherited.
- * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
- */
-
-button,
-input,
-optgroup,
-select,
-textarea {
- color: inherit; /* 1 */
- font: inherit; /* 2 */
- margin: 0; /* 3 */
-}
-
-/**
- * Address `overflow` set to `hidden` in IE 8/9/10/11.
- */
-
-button {
- overflow: visible;
-}
-
-/**
- * Address inconsistent `text-transform` inheritance for `button` and `select`.
- * All other form control elements do not inherit `text-transform` values.
- * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
- * Correct `select` style inheritance in Firefox.
- */
-
-button,
-select {
- text-transform: none;
-}
-
-/**
- * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
- * and `video` controls.
- * 2. Correct inability to style clickable `input` types in iOS.
- * 3. Improve usability and consistency of cursor style between image-type
- * `input` and others.
- */
-
-button,
-html input[type="button"], /* 1 */
-input[type="reset"],
-input[type="submit"] {
- -webkit-appearance: button; /* 2 */
- cursor: pointer; /* 3 */
-}
-
-/**
- * Re-set default cursor for disabled elements.
- */
-
-button[disabled],
-html input[disabled] {
- cursor: default;
-}
-
-/**
- * Remove inner padding and border in Firefox 4+.
- */
-
-button::-moz-focus-inner,
-input::-moz-focus-inner {
- border: 0;
- padding: 0;
-}
-
-/**
- * Address Firefox 4+ setting `line-height` on `input` using `!important` in
- * the UA stylesheet.
- */
-
-input {
- line-height: normal;
-}
-
-/**
- * It's recommended that you don't attempt to style these elements.
- * Firefox's implementation doesn't respect box-sizing, padding, or width.
- *
- * 1. Address box sizing set to `content-box` in IE 8/9/10.
- * 2. Remove excess padding in IE 8/9/10.
- */
-
-input[type="checkbox"],
-input[type="radio"] {
- box-sizing: border-box; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * Fix the cursor style for Chrome's increment/decrement buttons. For certain
- * `font-size` values of the `input`, it causes the cursor style of the
- * decrement button to change from `default` to `text`.
- */
-
-input[type="number"]::-webkit-inner-spin-button,
-input[type="number"]::-webkit-outer-spin-button {
- height: auto;
-}
-
-/**
- * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
- * 2. Address `box-sizing` set to `border-box` in Safari and Chrome
- * (include `-moz` to future-proof).
- */
-
-input[type="search"] {
- -webkit-appearance: textfield; /* 1 */
- -moz-box-sizing: content-box;
- -webkit-box-sizing: content-box; /* 2 */
- box-sizing: content-box;
-}
-
-/**
- * Remove inner padding and search cancel button in Safari and Chrome on OS X.
- * Safari (but not Chrome) clips the cancel button when the search input has
- * padding (and `textfield` appearance).
- */
-
-input[type="search"]::-webkit-search-cancel-button,
-input[type="search"]::-webkit-search-decoration {
- -webkit-appearance: none;
-}
-
-/**
- * Define consistent border, margin, and padding.
- */
-
-fieldset {
- border: 1px solid #c0c0c0;
- margin: 0 2px;
- padding: 0.35em 0.625em 0.75em;
-}
-
-/**
- * 1. Correct `color` not being inherited in IE 8/9/10/11.
- * 2. Remove padding so people aren't caught out if they zero out fieldsets.
- */
-
-legend {
- border: 0; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * Remove default vertical scrollbar in IE 8/9/10/11.
- */
-
-textarea {
- overflow: auto;
-}
-
-/**
- * Don't inherit the `font-weight` (applied by a rule above).
- * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
- */
-
-optgroup {
- font-weight: bold;
-}
-
-/* Tables
- ========================================================================== */
-
-/**
- * Remove most spacing between table cells.
- */
-
-table {
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-td,
-th {
- padding: 0;
-}
\ No newline at end of file
diff --git a/vendor/upyun/sdk/examples/client-upload/policy.php b/vendor/upyun/sdk/examples/client-upload/policy.php
deleted file mode 100644
index 46fa47b0..00000000
--- a/vendor/upyun/sdk/examples/client-upload/policy.php
+++ /dev/null
@@ -1,21 +0,0 @@
-setFormApiKey('Mv83tlocuzkmfKKUFbz2s04FzTw=');
-
-$data['save-key'] = $_GET['save_path'];
-$data['expiration'] = time() + 120;
-$data['bucket'] = BUCKET;
-$policy = Util::base64Json($data);
-$method = 'POST';
-$uri = '/' . $data['bucket'];
-$signature = Signature::getBodySignature($config, $method, $uri, null, $policy);
-echo json_encode(array(
- 'policy' => $policy,
- 'authorization' => $signature
-));
diff --git a/vendor/upyun/sdk/examples/list-all-file.php b/vendor/upyun/sdk/examples/list-all-file.php
deleted file mode 100644
index 8be8d05d..00000000
--- a/vendor/upyun/sdk/examples/list-all-file.php
+++ /dev/null
@@ -1,35 +0,0 @@
-read('/', null, array(
- 'X-List-Limit' => 100,
- 'X-List-Iter' => $start,
- ));
-
- if (is_array($list['files'])) {
- foreach ($list['files'] as $file) {
- $total++;
- if ($file['type'] === 'N') {
- echo '文件名: ';
- } else {
- echo '目录名: ';
- }
- echo $file['name'];
- echo ' 大小:' . $file['size'];
- echo ' 修改时间:' . date('Y-m-d H:i:s', $file['time']);
- echo "\n";
- }
- }
- $start = $list['iter'];
-} while (!$list['is_end']);
-
-echo '总共存有文件 ' . $total . ' 个';
diff --git a/vendor/upyun/sdk/phpunit.xml b/vendor/upyun/sdk/phpunit.xml
deleted file mode 100644
index adfa7f61..00000000
--- a/vendor/upyun/sdk/phpunit.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- ./tests/SignatureTest.php
- ./tests/UpyunTest.php
-
-
-
-
- ./src/
-
-
-
-
-
-
diff --git a/vendor/upyun/sdk/src/Upyun/Api/Rest.php b/vendor/upyun/sdk/src/Upyun/Api/Rest.php
index f63d775e..be4b0a04 100644
--- a/vendor/upyun/sdk/src/Upyun/Api/Rest.php
+++ b/vendor/upyun/sdk/src/Upyun/Api/Rest.php
@@ -105,4 +105,28 @@ class Rest
}
return $this;
}
+
+ public function toRequest()
+ {
+ $url = $this->endpoint . $this->storagePath;
+ $body = null;
+ if ($this->file && $this->method === 'PUT') {
+ $body = $this->file;
+ }
+
+ $request = new Psr7\Request(
+ $this->method,
+ Util::encodeURI($url),
+ $this->headers,
+ $body
+ );
+ $authHeader = Signature::getHeaderSign($this->config,
+ $this->method,
+ $request->getUri()->getPath()
+ );
+ foreach ($authHeader as $head => $value) {
+ $request = $request->withHeader($head, $value);
+ }
+ return $request;
+ }
}
diff --git a/vendor/upyun/sdk/src/Upyun/Config.php b/vendor/upyun/sdk/src/Upyun/Config.php
index b32b8098..1b99b6c4 100644
--- a/vendor/upyun/sdk/src/Upyun/Config.php
+++ b/vendor/upyun/sdk/src/Upyun/Config.php
@@ -32,7 +32,7 @@ class Config
public $useSsl;
/**
- * @var string 上传使用的接口类型,可以设置为 `REST`:使用 rest api 上传,`AUTO` 根据文件大小自动判断,`BLOCK` 使用断点续传
+ * @var string 上传使用的接口类型,可以设置为 `REST`:使用 rest api 上传,`AUTO` 根据文件大小自动判断,`BLOCK` 使用串行式断点续传,`BLOCK_PARALLEL` 使用并行式断点续传
* 当上传小文件时,不推荐使用断点续传;上传时如果设置了异步预处理`withAsyncProcess=true`,将会使用表单 api 上传
*/
public $uploadType = 'AUTO';
@@ -42,6 +42,11 @@ class Config
*/
public $sizeBoundary = 31457280;
+ /**
+ * @var int 并行式断点续传的并发数
+ */
+ public $concurrency = 5;
+
/**
* @var int request timeout seconds
*/
@@ -144,4 +149,14 @@ class Config
{
return $this->useSsl ? 'https://' : 'http://';
}
+
+ public function setUploadType($uploadType)
+ {
+ $this->uploadType = $uploadType;
+ }
+
+ public function setConcurrency($concurrency)
+ {
+ $this->concurrency = $concurrency;
+ }
}
diff --git a/vendor/upyun/sdk/src/Upyun/Uploader.php b/vendor/upyun/sdk/src/Upyun/Uploader.php
index 862644e3..95e6f2f5 100644
--- a/vendor/upyun/sdk/src/Upyun/Uploader.php
+++ b/vendor/upyun/sdk/src/Upyun/Uploader.php
@@ -4,6 +4,8 @@ namespace Upyun;
use Upyun\Api\Rest;
use Upyun\Api\Form;
use GuzzleHttp\Psr7;
+use GuzzleHttp\Pool;
+use GuzzleHttp\Client;
class Uploader
{
@@ -37,13 +39,15 @@ class Uploader
->withHeaders($params)
->withFile($stream)
->send();
+ } elseif ($this->config->uploadType === 'BLOCK_PARALLEL') {
+ return $this->concurrentPointUpload($path, $stream, $params);
} else {
return $this->pointUpload($path, $stream, $params);
}
}
/**
- * 断点续传
+ * 串行式断点续传
* @param $path
* @param $stream
* @param $params
@@ -108,7 +112,8 @@ class Uploader
private function needUseBlock($fileSize)
{
- if ($this->config->uploadType === 'BLOCK') {
+ if ($this->config->uploadType === 'BLOCK' ||
+ $this->config->uploadType === 'BLOCK_PARALLEL') {
return true;
} elseif ($this->config->uploadType === 'AUTO' &&
$fileSize >= $this->config->sizeBoundary) {
@@ -117,4 +122,81 @@ class Uploader
return false;
}
}
+
+ /**
+ * 并行式断点续传
+ * @param $path
+ * @param $stream
+ * @param $params
+ *
+ * @return mixed|\Psr\Http\Message\ResponseInterface
+ * @throws \Exception
+ */
+ private function concurrentPointUpload($path, $stream, $params)
+ {
+ $req = new Rest($this->config);
+
+ $headers = array();
+ if (is_array($params)) {
+ foreach ($params as $key => $val) {
+ $headers['X-Upyun-Meta-' . $key] = $val;
+ }
+ }
+ $res = $req->request('PUT', $path)
+ ->withHeaders(array_merge(array(
+ 'X-Upyun-Multi-Disorder' => 'true',
+ 'X-Upyun-Multi-Stage' => 'initiate',
+ 'X-Upyun-Multi-Type' => Psr7\mimetype_from_filename($path),
+ 'X-Upyun-Multi-Length' => $stream->getSize(),
+ ), $headers))
+ ->send();
+ if ($res->getStatusCode() !== 204) {
+ throw new \Exception('init request failed when poinit upload!');
+ }
+
+ $init = Util::getHeaderParams($res->getHeaders());
+ $uuid = $init['x-upyun-multi-uuid'];
+ $requests = function ($req, $path, $stream, $uuid) {
+ $blockSize = 1024 * 1024;
+ $total = ceil($stream->getSize() / $blockSize);
+ for ($i = 0; $i < $total; $i++) {
+ $fileBlock = $stream->read($blockSize);
+ yield $req->request('PUT', $path)
+ ->withHeaders(array(
+ 'X-Upyun-Multi-Stage' => 'upload',
+ 'X-Upyun-Multi-Uuid' => $uuid,
+ 'X-Upyun-Part-Id' => $i
+ ))
+ ->withFile(Psr7\stream_for($fileBlock))
+ ->toRequest();
+ }
+ };
+ $client = new Client([
+ 'timeout' => $this->config->timeout,
+ ]);
+ $pool = new Pool($client, $requests($req, $path, $stream, $uuid), [
+ 'concurrency' => $this->config->concurrency,
+ 'fulfilled' => function ($res) {
+ if ($res->getStatusCode() !== 204) {
+ throw new \Exception('upload request failed when poinit upload!');
+ }
+ },
+ 'rejected' => function () {
+ throw new \Exception('upload request failed when poinit upload!');
+ },
+ ]);
+ $promise = $pool->promise();
+ $promise->wait();
+
+ $res = $req->request('PUT', $path)
+ ->withHeaders(array(
+ 'X-Upyun-Multi-Uuid' => $uuid,
+ 'X-Upyun-Multi-Stage' => 'complete'
+ ))
+ ->send();
+ if ($res->getStatusCode() != 204 && $res->getStatusCode() != 201) {
+ throw new \Exception('end request failed when poinit upload!');
+ }
+ return $res;
+ }
}
diff --git a/vendor/upyun/sdk/src/Upyun/Upyun.php b/vendor/upyun/sdk/src/Upyun/Upyun.php
index 08cfa125..caa0c841 100644
--- a/vendor/upyun/sdk/src/Upyun/Upyun.php
+++ b/vendor/upyun/sdk/src/Upyun/Upyun.php
@@ -377,7 +377,7 @@ class Upyun
case self::$PROCESS_TYPE_SYNC_FILE:
$options['app_name'] = 'spiderman';
break;
- case self::$PROCESS_TYPE_SYNC_FILE:
+ case self::$PROCESS_TYPE_CONVERT:
$options['app_name'] = 'uconvert';
break;
case self::$PROCESS_TYPE_STITCH:
@@ -460,7 +460,7 @@ class Upyun
* @param string $file 需要剪辑的又拍云云存储中的 m3u8 文件路径
* @param string $saveAs 剪辑完成后新的 m3u8 文件保存路径
* @param array $slice 需要被保留或删除的片段。
- * @param bool $$isInclude 默认为 `true` 表示 `$slice` 参数描述的片段被保留,否则表示 `$slice` 参数描述的片段被删除
+ * @param bool $isInclude 默认为 `true` 表示 `$slice` 参数描述的片段被保留,否则表示 `$slice` 参数描述的片段被删除
* @param bool $index 指定 `$slice` 参数的格式,默认为 `false` 表示使用时间范围描述片段,单位秒:`[<开始时间>, <结束时间>]`;`true` 表示使用 `m3u8` 文件的分片序号,从 0 开始,这种方式可以一次对多个片段操作
*
* @return array 见 [m3u8 剪辑 - 响应](http://docs.upyun.com/cloud/sync_video/#_6)
@@ -473,7 +473,7 @@ class Upyun
'save_as' => $saveAs,
'index' => $index,
];
- if ($$isInclude) {
+ if ($isInclude) {
$params['include'] = $slice;
} else {
$params['exclude'] = $slice;
diff --git a/vendor/upyun/sdk/tests/SignatureTest.php b/vendor/upyun/sdk/tests/SignatureTest.php
deleted file mode 100644
index 0fd88f1f..00000000
--- a/vendor/upyun/sdk/tests/SignatureTest.php
+++ /dev/null
@@ -1,25 +0,0 @@
-config = new Config('bucket', 'operator', 'password');
- }
-
- public function testGetBodySignature()
- {
- $sign = Signature::getBodySignature($this->config, 'POST', '/bucket');
- $this->assertEquals($sign, 'UPYUN operator:Xx3G6+DAvUyCL2Y2npSW/giTFI8=');
- }
-}
diff --git a/vendor/upyun/sdk/tests/UpyunTest.php b/vendor/upyun/sdk/tests/UpyunTest.php
deleted file mode 100644
index b6721252..00000000
--- a/vendor/upyun/sdk/tests/UpyunTest.php
+++ /dev/null
@@ -1,272 +0,0 @@
-setFormApiKey('Mv83tlocuzkmfKKUFbz2s04FzTw=');
- $config->processNotifyUrl = 'http://localhost:9999';
- self::$upyun = new Upyun($config);
- self::$tempFilePath = __DIR__ . '/assets/test.txt';
- touch(self::$tempFilePath);
- }
-
- public static function tearDownAfterClass()
- {
- unlink(self::$tempFilePath);
- }
-
- public function testWriteString()
- {
- $filename = '/中文/测试 +.txt';
- $content = 'test file content';
- self::$upyun->write($filename, $content);
- $size = getUpyunFileSize($filename);
- $this->assertEquals($size, strlen($content));
- }
-
- public function testWriteStream()
- {
- $filename = 'test.jpeg';
- $f = fopen(__DIR__ . '/assets/sample.jpeg', 'rb');
- if (!$f) {
- throw new \Exception('open test file failed!');
- }
- self::$upyun->write($filename, $f);
- $size = getUpyunFileSize($filename);
- $this->assertEquals($size, PIC_SIZE);
- }
-
- public function testWriteWithAsyncProcess()
- {
- $filename = 'test_async.jpeg';
- $newFilename = 'test_async.png';
- $f = fopen(__DIR__ . '/assets/sample.jpeg', 'rb');
- if (!$f) {
- throw new \Exception('open test file failed!');
- }
- $result = self::$upyun->write($filename, $f, array(
- 'apps' => array(
- array(
- 'name' => 'thumb',
- 'x-gmkerl-thumb' => '/format/png/fw/50',
- 'save_as' => $newFilename,
- )
- )
- ), true);
- $size = getUpyunFileSize($filename);
- $this->assertEquals($size, PIC_SIZE);
- $this->assertEquals($result, true);
- }
-
- public function testWriteWithException()
- {
- $fs = new Upyun(new Config(BUCKET, USER_NAME, 'error-password'));
- try {
- $fs->write('test.txt', 'test file content');
- } catch (\Exception $e) {
- return ;
- }
- throw new \Exception('should get sign error.');
- }
-
- /**
- * @depends testWriteString
- */
- public function testReadFile()
- {
- $name = 'test-read.txt';
- $str = 'test file content 2';
- self::$upyun->write($name, $str);
-
- //读取内容写入字符串
- $content = self::$upyun->read($name);
- $this->assertEquals($content, $str);
-
- //读取内容写入文件流
- $this->assertTrue(self::$upyun->read($name, fopen(self::$tempFilePath, 'wb')));
- $this->assertEquals($str, file_get_contents(self::$tempFilePath));
- }
-
- /**
- * @depends testWriteString
- * @depends testReadFile
- */
- public function testDeleteFile()
- {
- self::$upyun->write('test-delete.txt', 'test file content 3');
- self::$upyun->delete('test-delete.txt');
- try {
- self::$upyun->read('test-delete.txt');
- } catch (\Exception $e) {
- return ;
- }
- throw new \Exception('delete file failed');
- }
-
- /**
- * @expectedException \Exception
- */
- public function testDeleteNotExistsFile()
- {
- self::$upyun->delete('not-exists-test.txt');
- }
-
- /**
- */
- public function testHas()
- {
- $name = 'test-has.txt';
- self::$upyun->write($name, 'test file content 4');
- $this->assertEquals(self::$upyun->has($name), true);
- self::$upyun->delete($name);
- sleep(5);
- $this->assertEquals(self::$upyun->has($name), false);
- }
-
- /**
- * @depends testWriteString
- * @depends testDeleteFile
- */
- public function testInfo()
- {
- self::$upyun->write('test-info.txt', 'test file content 4');
- $info = self::$upyun->info('test-info.txt');
- $this->assertEquals($info['x-upyun-file-type'], 'file');
- $this->assertEquals($info['x-upyun-file-size'], 19);
- }
-
- /**
- * @depends testInfo
- */
- public function testGetMimetype()
- {
- $type = self::$upyun->getMimetype('test-info.txt');
- $this->assertEquals($type, 'text/plain');
- }
-
- /**
- */
- public function testCreateDir()
- {
- self::$upyun->createDir('/test-dir');
- $this->assertEquals(self::$upyun->has('/test-dir'), true);
- self::$upyun->createDir('/test-dir2/');
- $this->assertEquals(self::$upyun->has('/test-dir2'), true);
- }
-
- public function testReadDir()
- {
- $list = self::$upyun->read('/test-dir2/');
- $this->assertEquals($list['is_end'], true);
- self::$upyun->write('/test-dir2/test.txt', 'test file content 5');
- $list = self::$upyun->read('/test-dir2/');
- $this->assertEquals($list['is_end'], true);
- $this->assertEquals(count($list['files']), 1);
- $file = $list['files'][0];
- $this->assertEquals($file['name'], 'test.txt');
- $this->assertEquals($file['type'], 'N');
- $this->assertEquals($file['size'], 19);
- }
-
- /**
- * @depends testCreateDir
- */
- public function testDeleteDir()
- {
- $result = self::$upyun->createDir('/test-delete-dir');
- $this->assertEquals($result, true);
- sleep(5);
- $result = self::$upyun->deleteDir('/test-delete-dir');
- $this->assertEquals($result, true);
- }
-
- public function testUsage()
- {
- $size = self::$upyun->usage();
- $this->assertTrue($size > 0);
- }
-
- public function testPurge()
- {
- $urls = self::$upyun->purge(getFileUrl('test.txt'));
- $this->assertTrue(empty($urls));
-
- $invalidUrl = 'http://xxxx.b0.xxxxxxxx-upyun.com/test.txt';
- $urls = self::$upyun->purge($invalidUrl);
- $this->assertTrue(count($urls) === 1);
- $this->assertTrue($urls[0] === $invalidUrl);
- }
-
- public function testProcess()
- {
- $source = 'php-sdk-sample.mp4';
- self::$upyun->write($source, fopen(__DIR__ . '/assets/SampleVideo_640x360_1mb.mp4', 'r'));
- $result = self::$upyun->process(array(
- array('type' => 'video', 'avopts' => '/s/240p(4:3)/as/1/r/30', 'return_info' => true, 'save_as' => '/video/result.mp4')
- ), Upyun::$PROCESS_TYPE_MEDIA, $source);
- $this->assertTrue(strlen($result[0]) === 32);
- self::$taskId = $result[0];
-
- // test zip
- $result2 = self::$upyun->process(array(array(
- 'sources' => ['./php-sdk-sample.mp4'],
- 'save_as' => '/php-sdk-sample-mp4.zip'
- )), Upyun::$PROCESS_TYPE_ZIP);
- $this->assertTrue(strlen($result2[0]) === 32);
- }
-
- /**
- * @depends testProcess
- */
- public function testQueryProcessStatus()
- {
- sleep(5);
- $status = self::$upyun->queryProcessStatus(array(self::$taskId));
- $this->assertTrue(array_key_exists(self::$taskId, $status));
- }
-
- /**
- * @depends testProcess
- */
- public function testQueryProcessResult()
- {
- sleep(5);
- $result = self::$upyun->queryProcessResult(array(self::$taskId));
- $this->assertTrue($result[self::$taskId]['path'][0] === '/video/result.mp4');
- $this->assertTrue($result[self::$taskId]['status_code'] === 200);
- }
-
- public function testAvMeta()
- {
- $source = 'php-sdk-sample.mp4';
- self::$upyun->write($source, fopen(__DIR__ . '/assets/SampleVideo_640x360_1mb.mp4', 'r'));
- $result = self::$upyun->avMeta('/php-sdk-sample.mp4');
- $this->assertTrue(count($result) === 2);
- $this->assertTrue($result['streams'][0]['type'] === 'video');
- }
-
- public function testSnapshot()
- {
- $source = 'php-sdk-sample.mp4';
- self::$upyun->write($source, fopen(__DIR__ . '/assets/SampleVideo_640x360_1mb.mp4', 'r'));
- $result = self::$upyun->snapshot('/php-sdk-sample.mp4', '/snapshot.jpg', '00:00:01', '720x480', 'jpg');
- $this->assertTrue($result['status_code'] === 200);
- }
-}
diff --git a/vendor/upyun/sdk/tests/assets/SampleVideo_640x360_1mb.mp4 b/vendor/upyun/sdk/tests/assets/SampleVideo_640x360_1mb.mp4
deleted file mode 100644
index 02c2060b..00000000
Binary files a/vendor/upyun/sdk/tests/assets/SampleVideo_640x360_1mb.mp4 and /dev/null differ
diff --git a/vendor/upyun/sdk/tests/assets/sample.jpeg b/vendor/upyun/sdk/tests/assets/sample.jpeg
deleted file mode 100644
index dbfe17d3..00000000
Binary files a/vendor/upyun/sdk/tests/assets/sample.jpeg and /dev/null differ
diff --git a/vendor/upyun/sdk/tests/bootstrap.php b/vendor/upyun/sdk/tests/bootstrap.php
deleted file mode 100644
index 04f822f4..00000000
--- a/vendor/upyun/sdk/tests/bootstrap.php
+++ /dev/null
@@ -1,31 +0,0 @@
-