php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71746 UTF-8 codepoint escape sequences allow arbitrary number of leading zeros
Submitted: 2016-03-08 15:43 UTC Modified: 2018-11-23 09:19 UTC
From: dragondreamer at live dot com Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: 7.0.4 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dragondreamer at live dot com
New email:
PHP Version: OS:

 

 [2016-03-08 15:43 UTC] dragondreamer at live dot com
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.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-08 21:12 UTC] yohgaki@php.net
This must be fixed. Recent Unicode does not allow this kind of redundant expressions.
 [2016-03-08 21:19 UTC] 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:25 UTC] ajf@php.net
-Type: Bug +Type: Documentation Problem
 [2016-03-08 21:25 UTC] 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:28 UTC] 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-04-10 17:41 UTC] temp at temp dot ru
-Package: *Compile Issues +Package: Documentation problem
 [2016-04-10 17:41 UTC] temp at temp dot ru
changing package to doc
 [2016-04-11 07:59 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=338989
Log: unicode escape sequence allows uppercase and any number of digits (doc bug #71746)
 [2016-04-11 08:03 UTC] salathe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: salathe
 [2016-04-11 08:03 UTC] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2018-11-23 09:19 UTC] dragondreamer at live dot com
-: temp at temp dot ru +: dragondreamer at live dot com
 [2018-11-23 09:19 UTC] dragondreamer at live dot com
Edit e-mail address
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 22:01:31 2024 UTC