Skip to content

[PHP] addd binary support to response and body parameter #1891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 15, 2016

Conversation

wing328
Copy link
Contributor

@wing328 wing328 commented Jan 14, 2016

PHPUnit 4.7.2 by Sebastian Bergmann and contributors.

....................

Time: 14.33 seconds, Memory: 18.00Mb

OK (20 tests, 3074 assertions)

@wing328 wing328 force-pushed the php_binary_support branch from 7915a65 to fee8ace Compare January 15, 2016 03:43
wing328 added a commit that referenced this pull request Jan 15, 2016
[PHP] addd binary support to response and body parameter
@wing328 wing328 merged commit e0738d2 into swagger-api:master Jan 15, 2016
@@ -241,6 +241,8 @@ class ObjectSerializer
$values[] = $this->deserialize($value, $subClass);
}
$deserialized = $values;
} elseif ($class === 'ByteArray') { // byte array
$deserialized = unpack('C*', (string)$data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize the mapped type is a technically a byte array but this seems more natural to return as a string. Even printing this data is complicated as it's an array of integers and PHP's pack cannot be called with an Array.

$string = "";
foreach($deserialized as $int) {
  $string = $string . pack("C", $int);
}

Compare with string returned:

echo $deserialized;

File operations also don't support this unpacked format either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants