Skip to content

Commit dbea8e0

Browse files
committed
AC-10815 - API Input validation
1 parent c7d58d0 commit dbea8e0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,6 @@ public function process($serviceClassName, $serviceMethodName, array $inputArray
228228
private function getConstructorData(string $className, array $data): array
229229
{
230230
$preferenceClass = $this->config->getPreference($className);
231-
if (is_subclass_of($preferenceClass, \SimpleXMLElement::class)
232-
|| is_subclass_of($preferenceClass, \DOMElement::class)) {
233-
return [];
234-
}
235231
$class = new ClassReflection($preferenceClass ?: $className);
236232

237233
try {
@@ -270,7 +266,7 @@ private function getConstructorData(string $className, array $data): array
270266
*
271267
* @param string $className
272268
* @param array $data
273-
* @return object the newly created and populated object
269+
* @return object|null the newly created and populated object
274270
* @throws \Exception
275271
* @throws SerializationException
276272
* @SuppressWarnings(PHPMD.NPathComplexity)
@@ -282,6 +278,10 @@ protected function _createFromArray($className, $data)
282278
// convert to string directly to avoid situations when $className is object
283279
// which implements __toString method like \ReflectionObject
284280
$className = (string) $className;
281+
if (is_subclass_of($className, \SimpleXMLElement::class)
282+
|| is_subclass_of($className, \DOMElement::class)) {
283+
return null;
284+
}
285285
$class = new ClassReflection($className);
286286
if (is_subclass_of($className, self::EXTENSION_ATTRIBUTES_TYPE)) {
287287
$className = substr($className, 0, -strlen('Interface'));

0 commit comments

Comments
 (0)