Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1887261

Browse filesBrowse files
committed
bug #18072 [serializer][ObjectNormalizer] fixed Undefined attributeName. (aitboudad)
This PR was merged into the 3.1-dev branch. Discussion ---------- [serializer][ObjectNormalizer] fixed Undefined attributeName. | Q | A | ------------- | --- | Branch | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ Commits ------- ee087a1 [serializer][ObjectNormalizer] fixed Undefined attributeName.
2 parents 15bb452 + ee087a1 commit 1887261
Copy full SHA for 1887261

File tree

1 file changed

+2
-1
lines changed
Filter options

1 file changed

+2
-1
lines changed

‎src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ protected function extractAttributes($object, $format = null, array $context = a
5757
}
5858

5959
$name = $reflMethod->name;
60+
$attributeName = null;
6061

6162
if (0 === strpos($name, 'get') || 0 === strpos($name, 'has')) {
6263
// getters and hassers
@@ -66,7 +67,7 @@ protected function extractAttributes($object, $format = null, array $context = a
6667
$attributeName = lcfirst(substr($name, 2));
6768
}
6869

69-
if ($this->isAllowedAttribute($object, $attributeName)) {
70+
if (null !== $attributeName && $this->isAllowedAttribute($object, $attributeName)) {
7071
$attributes[$attributeName] = true;
7172
}
7273
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.