From b00bed7774fc0832e0ba2b4b0f4733180bd8f65f Mon Sep 17 00:00:00 2001 From: Ben Burleson Date: Thu, 31 Aug 2017 14:38:47 -0700 Subject: [PATCH 1/4] Add gitignore file --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..9f11b755 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ From e9a57f75eaf27c8de72f816b191fc82dac56dc49 Mon Sep 17 00:00:00 2001 From: Ben Burleson Date: Thu, 31 Aug 2017 14:39:44 -0700 Subject: [PATCH 2/4] Throw exception if we come across a doc form field (tab) type that we don't support yet. --- src/ObjectSerializer.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ObjectSerializer.php b/src/ObjectSerializer.php index 8f0a7cf8..678e6d38 100644 --- a/src/ObjectSerializer.php +++ b/src/ObjectSerializer.php @@ -269,7 +269,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } return $deserialized; - } else { + } elseif (class_exists($class)) { // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -292,6 +292,11 @@ public static function deserialize($data, $class, $httpHeaders = null) } } return $instance; + } else { + throw new ApiException( + "Invalid form field type `" . $class . "` found.", + 400 + ); } } } From 7c1647998f36030a9ea49e185eda4c976047c4d1 Mon Sep 17 00:00:00 2001 From: Ben Burleson Date: Thu, 31 Aug 2017 14:41:41 -0700 Subject: [PATCH 3/4] Remove extra space --- src/ObjectSerializer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ObjectSerializer.php b/src/ObjectSerializer.php index 678e6d38..57bcef46 100644 --- a/src/ObjectSerializer.php +++ b/src/ObjectSerializer.php @@ -293,7 +293,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } return $instance; } else { - throw new ApiException( + throw new ApiException( "Invalid form field type `" . $class . "` found.", 400 ); From a5509c9ea8507210e2360ecffddfd1cec344ee85 Mon Sep 17 00:00:00 2001 From: Ben Burleson Date: Fri, 1 Sep 2017 09:56:34 -0700 Subject: [PATCH 4/4] Apply patch from https://github.com/docusign/docusign-php-client/pull/41 --- src/ObjectSerializer.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ObjectSerializer.php b/src/ObjectSerializer.php index 57bcef46..4961cdc7 100644 --- a/src/ObjectSerializer.php +++ b/src/ObjectSerializer.php @@ -79,7 +79,7 @@ public static function sanitizeForSerialization($data) * * @return string the sanitized filename */ - public function sanitizeFilename($filename) + public static function sanitizeFilename($filename) { if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { return $match[1]; @@ -251,14 +251,17 @@ public static function deserialize($data, $class, $httpHeaders = null) } else { return null; } - } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + } elseif ($class === 'DateTime' || in_array(strtolower($class), ['bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($class !== 'DateTime') { + $class = strtolower($class); + } settype($data, $class); return $data; } elseif ($class === '\SplFileObject') { // determine file name if (array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { - $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . sanitizeFilename($match[1]); + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . self::sanitizeFilename($match[1]); } else { $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); }