Language: PHP
Label: vulnerable
CWE: CWE-1103 \u2014 Use of Platform-Dependent Third Party Components
The product relies on third-party components that do
					not provide equivalent functionality across all desirable
					platforms.

Code:
            $object = new \stdClass();
            foreach ($this->{$property} as $key => $item) {
                if (is_numeric($key) === false && is_array($item)) {
                    $object->{$key} = $item;
                } else {
                    $key = $item->{$keyField};
                    if (!Generator::isDefault($key) && empty($object->{$key})) {
                        if ($item instanceof \JsonSerializable) {
                            $object->{$key} = $item->jsonSerialize();
                        } else {
                            $object->{$key} = $item;
                        }
                        unset($object->{$key}->{$keyField});
                    }
                }
            }
            $data->{$property} = $object;
        }

        // $ref
        if (isset($data->ref)) {
            // Only specific https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#reference-object
            $ref = ['$ref' => $data->ref];
            if ($this->_context->version == OpenApi::VERSION_3_1_0) {
                $defaultValues = get_class_vars(get_class($this));
                foreach (['summary', 'description'] as $prop) {
                    if (property_exists($this, $prop)) {
                        if ($this->{$prop} !== $defaultValues[$prop]) {
                            $ref[$prop] = $data->{$prop};
                        }
                    }
                }
            }
            $data = (object) $ref;
        }

        if ($this->_context->version == OpenApi::VERSION_3_1_0) {
            if (isset($data->nullable)) {
                if (true === $data->nullable) {
                    $data->type = (array) $data->type;
                    $data->type[] = 'null';
                }
                unset($data->nullable);
            }
        }

        return $data;
    }