1

I'm having some trouble using a 3rd party API, which throws the following PHP error

preg_replace(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 42  in /.../SoapClient.php on line 20

Can some one help me with understating what this regex means,

[\x{0}-\x{8}\x{B}-\x{C}\x{E}-\x{1F}\x{D800}-\x{DFFF}]

This is the value it tries to match

5f42caa3-1f41-4ff3-8b6c-3f79e45ed0f1

This is the code bit in the API,

$result = preg_replace('/[\x{0}-\x{8}\x{B}-\x{C}\x{E}-\x{1F}\x{D800}-\x{DFFF}]/u', '', $result);

UPDATE:

By the way I found in the internet making "D"s in the Regex to "E"s will fix the issue, and surpassingly it did fix the issue,

New RegEx,

 [\x{0}-\x{8}\x{B}-\x{C}\x{E}-\x{1F}\x{E800}-\x{EFFF}]

But I dont know its a real fix or not, so still my question is valid.

3
  • The regex matches a character in the range given, but I don't think it will match what you claim it is trying to match. Commented Feb 10, 2014 at 1:21
  • Yep but why it works when I change the Ds Es.. is another thing I dont get... any ideas :( Commented Feb 10, 2014 at 1:44
  • 1
    It works, because you changed the range of characters to something allowed by the engine. The original range contains surrogate, which is not allowed by PCRE. Commented Feb 10, 2014 at 1:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.