Skip to content

Commit 9dfdb9c

Browse files
committed
Merge branch '8.0' into 8.1
* 8.0: Add notes about unsafe `PARSE_*` flags for yaml
2 parents 90f8119 + 9febca4 commit 9dfdb9c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

components/yaml.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@ representation of the object.
241241
parsers will likely not recognize the ``php/object`` tag and non-PHP
242242
implementations certainly won't - use with discretion!
243243

244+
.. danger::
245+
246+
Parsing ``!php/object`` tags uses PHP deserialization internally. Never
247+
enable ``PARSE_OBJECT`` for untrusted YAML contents.
248+
244249
Parsing and Dumping Objects as Maps
245250
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
246251

@@ -326,6 +331,11 @@ syntax to parse them as proper PHP constants::
326331
$parameters = Yaml::parse($yaml, Yaml::PARSE_CONSTANT);
327332
// $parameters = ['foo' => 'PHP_INT_SIZE', 'bar' => 8];
328333

334+
.. warning::
335+
336+
Enabling ``PARSE_CONSTANT`` allows YAML contents to resolve arbitrary PHP
337+
constants and enum cases. Only enable it for trusted input.
338+
329339
Parsing PHP Enumerations
330340
~~~~~~~~~~~~~~~~~~~~~~~~
331341

0 commit comments

Comments
 (0)