8000 bug #43944 [Yaml] revert using functions provided by polyfill package… · symfony/symfony@ff8aae7 · GitHub
[go: up one dir, main page]

Skip to content

Commit ff8aae7

Browse files
committed
bug #43944 [Yaml] revert using functions provided by polyfill packages (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [Yaml] revert using functions provided by polyfill packages | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #43943 | License | MIT | Doc PR | This reverts #41431 for the same reason for which we merged #42296 (see #42280 and composer/composer#10024 for more information). Commits ------- 3b9b700 revert using functions provided by polyfill packages
2 parents 8a9e826 + 3b9b700 commit ff8aae7

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/Symfony/Component/Yaml/Inline.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,19 @@ public static function dump($value, int $flags = 0): string
211211
*/
212212
public static function isHash($value): bool
213213
{
214-
return !\is_array($value) || !array_is_list($value);
214+
if ($value instanceof \stdClass || $value instanceof \ArrayObject) {
215+
return true;
216+
}
217+
218+
$expectedKey = 0;
219+
220+
foreach ($value as $key => $val) {
221+
if ($key !== $expectedKey++) {
222+
return true;
223+
}
224+
}
225+
226+
return false;
215227
}
216228

217229
/**

src/Symfony/Component/Yaml/composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
"require": {
1919
"php": ">=7.2.5",
2020
"symfony/deprecation-contracts": "^2.1",
21-
"symfony/polyfill-ctype": "^1.8",
22-
"symfony/polyfill-php80": "^1.16",
23-
"symfony/polyfill-php81": "^1.22"
21+
"symfony/polyfill-ctype": "^1.8"
2422
},
2523
"require-dev": {
2624
"symfony/console": "^5.3|^6.0"

0 commit comments

Comments
 (0)
0