Skip to content

dump() does not throw exception as shown in the docs #7516

@samayo

Description

@samayo

There seems to be a mistake in the doc, right here. It shows the code in the second example throws an error, which I will copy here as:

$data = new \stdClass(); // by default objects are invalid.
Yaml::dump($data, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE); // throws an exception

echo $yaml; // { foo: bar }

I have Yaml 3.2.3 and I can't produce the same result, also the third line doesn't seem to have any effect than throw a syntax error, since it is undefined. Even if it was defined in the previous block, the output isn't as shown in the example above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    YamlbughasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions