After you made a change two lines above the message here has magically disappeared from github, so I'm pasting it again:

I guess that's not the same result as PHP counterpart produces in this case.
Could you follow up with this question for full compatibility with PHP implementation?