Closed
Description
Symfony version(s) affected
6.4.18
Description
The Yaml Component (6.4.18) has an issue parsing objects with inline comments.
ℹ️ This issue is not present in version 6.4.13.
How to reproduce
use Symfony\Component\Yaml\Yaml;
$yml = <<<'YML'
arguments:
- {
connect_timeout: 3, # Float describing the number of seconds to wait while trying to connect to a server
timeout: 30 # Float describing the timeout of the request in seconds
}
YML;
var_dump(Yaml::parse($yml));
Output:
array(1) {
["arguments"]=>
array(1) {
[0]=>
array(2) {
["connect_timeout"]=>
int(3)
["timeout"]=>
string(59) "30 # Float describing the timeout of the request in seconds"
}
}
}
✅ Expected: integer value 30
in second element of array:
[
"arguments" => [
[
"connect_timeout" => 3,
"timeout" => 30
]
]
]
❌ Actual: string value 30 # Float describing the timeout of the request in seconds
in second element of array:
[
"arguments" => [
[
"connect_timeout" => 3,
"timeout" => "30 # Float describing the timeout of the request in seconds"
]
]
]
Possible Solution
No response
Additional Context
No response