Make exception messages and error output binary safe #413
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will probably need an RFC, but until I have time to write one, this PR will have to do to track this.
Previously, exception messages were documented as not being binary safe. The reality was actually more complicated than this:
Exception::$message
itself was binary safe if accessed throughException::getMessage()
, but wasn't binary safe when the full exception string was constructed byException::__toString()
.I dislike arbitrary restrictions and inconsistent behaviour, hence this PR.
9b1069f removes the exception restriction. By itself, that still isn't all that useful, since error output also isn't binary safe. The follow up commits remove that restriction (of course, if your actual stdout/stderr aren't binary safe, you have lost regardless).
Things that would still have to be dealt with before this became mergeable:
Exception::__toString()
. Is that really a problem in practice? Error and exception code aren't speed demons at the best of times.%Z
printf modifier. I presume there is a reason why this has been avoided until now, although I have no idea what that reason might be. This could be worked around if needed.