Doc #71746 [Opn]: UTF-8 codepoint escape sequences allow arbitrary number of leading zeros

From: Date: Sun, 10 Apr 2016 17:41:43 +0000
Subject: Doc #71746 [Opn]: UTF-8 codepoint escape sequences allow arbitrary number of leading zeros
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13404@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71746&edit=1 ID: 71746 User updated by: temp at temp dot ru Reported by: temp at temp dot ru Summary: UTF-8 codepoint escape sequences allow arbitrary number of leading zeros Status: Open Type: Documentation Problem -Package: *Compile Issues +Package: Documentation problem PHP Version: 7.0.4 Block user comment: N Private report: N New Comment: changing package to doc Previous Comments: ------------------------------------------------------------------------ [2016-03-08 21:28:55] ajf@php.net Note that the language specification is explicit here, it says "Implementations MUST support leading zeroes", and specifies that hexadecimal digits can be uppercase or lowercase: https://github.com/php/php-langspec/blob/2888f580bd887e6a37e0821beca714843fc095e1/spec/09-lexical-structure.md#double-quoted-string-literals ------------------------------------------------------------------------ [2016-03-08 21:25:30] ajf@php.net This is a documentation bug. It was fully my intention to allow however many leading zeros you like, and whatever capitalisation you like. ------------------------------------------------------------------------ [2016-03-08 21:19:17] yohgaki@php.net However, ES6 seems to have the same spec. https://mathiasbynens.be/notes/javascript-escapes#unicode-code-point IMO, this should be fixed as it only introduces complexity for validations. ------------------------------------------------------------------------ [2016-03-08 21:12:04] yohgaki@php.net This must be fixed. Recent Unicode does not allow this kind of redundant expressions. ------------------------------------------------------------------------ [2016-03-08 15:43:37] temp at temp dot ru Description: ------------ PHP documentation specifies the following format of UTF-8 codepoint escape sequences: \u{[0-9a-f]{1,6}} However, it's currently possible to use them like this: <?php echo "\u{0000000000000000000000000000000000000000000000000041}"; //Works Moreover, it's currently possible to use capital hexadecimal letters despite documentation says, that only lower-case letters are allowed: <?php echo "\u{AA}"; //Works I'm not sure if these are documentation or compiler bugs. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71746&edit=1

« previous php.doc.bugs (#13404) next »