Skip to content

Commit cb78e32

Browse files
authored
Merge branch 'master' into feature/readme_update_security_master
2 parents 23e8a9c + 242c40a commit cb78e32

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
[![Build Status](https://img.shields.io/jenkins/s/https/jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-core-master-java-8.svg)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-core-master-java-8)
44

5+
[![Build Status](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master/badge/icon?subject=jenkins%20build)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master/)
6+
7+
[![Build Status](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master-java7/badge/icon?subject=jenkins%20build%20-%20java%207)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master-java7/)
8+
59
- Master (2.4.5): [![Build Status](https://img.shields.io/travis/swagger-api/swagger-codegen/master.svg?label=Petstore%20Integration%20Test)](https://travis-ci.org/swagger-api/swagger-codegen)
610
[![Java Test](https://img.shields.io/jenkins/s/https/jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master.svg)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master)
711
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/swagger-api/swagger-codegen?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/swaggerhub-bot/swagger-codegen)
@@ -892,6 +896,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
892896
- [Mindera](http://mindera.com/)
893897
- [Mporium](http://mporium.com/)
894898
- [Neverfail](https://neverfail.com/)
899+
- [NexCap](http://www.nexess-solutions.com/fr/plateforme-iot/)
895900
- [NTT DATA](http://www.nttdata.com/)
896901
- [nViso](http://www.nviso.ch/)
897902
- [Okiok](https://www.okiok.com)

modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ class ObjectSerializer
4949
$data[$property] = self::sanitizeForSerialization($value);
5050
}
5151
return $data;
52+
} elseif ($data instanceof \stdClass) {
53+
foreach ($data as $property => $value) {
54+
$data->$property = self::sanitizeForSerialization($value);
55+
}
56+
return $data;
5257
} elseif (is_object($data)) {
5358
$values = [];
5459
$formats = $data::swaggerFormats();

samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public static function sanitizeForSerialization($data, $type = null, $format = n
5959
$data[$property] = self::sanitizeForSerialization($value);
6060
}
6161
return $data;
62+
} elseif ($data instanceof \stdClass) {
63+
foreach ($data as $property => $value) {
64+
$data->$property = self::sanitizeForSerialization($value);
65+
}
66+
return $data;
6267
} elseif (is_object($data)) {
6368
$values = [];
6469
$formats = $data::swaggerFormats();

samples/client/petstore/php/SwaggerClient-php/tests/ObjectSerializerTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@
55
// test object serializer
66
class ObjectSerializerTest extends \PHPUnit_Framework_TestCase
77
{
8+
/**
9+
* Test the sanitizeForSerialization method with a stdClass.
10+
*/
11+
public function testSanitizeForSerializationWithStdClass()
12+
{
13+
// Initialize the ObjectSerializer.
14+
$s = new ObjectSerializer();
15+
16+
// Build a stdClass object.
17+
$obj = new \stdClass();
18+
$obj->prop1 = 'val1';
19+
$obj->prop2 = 'val2';
20+
21+
// Call the method.
22+
$serialized = $s->sanitizeForSerialization($obj);
23+
24+
// Assert that the stdClass object is sanitized as expected.
25+
$this->assertEquals('val1', $serialized->prop1);
26+
$this->assertEquals('val2', $serialized->prop2);
27+
}
28+
829
// test sanitizeFilename
930
public function testSanitizeFilename()
1031
{

0 commit comments

Comments
 (0)