Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
samayo opened this issue Feb 20, 2017 · 2 comments
Closed

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

samayo opened this issue Feb 20, 2017 · 2 comments
Labels
bug hasPR A Pull Request has already been submitted for this issue. Yaml

Comments

@samayo
Copy link
Contributor

samayo commented Feb 20, 2017

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.

@xabbuh
Copy link
Member

xabbuh commented Feb 21, 2017

That's indeed an issue. The example is missing the $inline and $indent arguments (see #7518 for the fix).

@xabbuh xabbuh added the hasPR A Pull Request has already been submitted for this issue. label Feb 21, 2017
@javiereguiluz
Copy link
Member

Closing it as fixed by #7518.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug hasPR A Pull Request has already been submitted for this issue. Yaml
Projects
None yet
Development

No branches or pull requests

4 participants