|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #76984 class name with unicode characters are accepted
Submitted: 2018-10-09 13:01 UTC Modified: 2018-10-09 13:22 UTC
From: info at developiu dot it Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 7.1.22 OS: linux (centos 7)
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.
Block user comment
Status: Assign to:
Bug Type:
From: info at developiu dot it
New email:
PHP Version: OS:


 [2018-10-09 13:01 UTC] info at developiu dot it
From manual page:

in this page it is said "The class name can be any valid label, provided it is not a PHP reserved word. A valid class name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: ^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$."

from the regular expression class names with unicode charaters shbould not be accepted, but this is not true.

Test script:

class Հ {}

var_dump(new Հ);

Expected result:
a parse error

Actual result:
class Հ#1 (0) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-09 13:22 UTC]
-Status: Open +Status: Not a bug
 [2018-10-09 13:22 UTC]
In UTF-8, the character Հ is encoded with the two bytes: \xD5 \x80 (
These bytes match the regex quoted from the manual.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 23 22:01:26 2020 UTC