Doc #76984 [Opn->Nab]: class name with unicode characters are accepted

From: Date: Tue, 09 Oct 2018 13:22:55 +0000
Subject: Doc #76984 [Opn->Nab]: class name with unicode characters are accepted
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16063@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76984&edit=1 ID: 76984 Updated by: salathe@php.net Reported by: info at developiu dot it Summary: class name with unicode characters are accepted -Status: Open +Status: Not a bug Type: Documentation Problem Package: Documentation problem Operating System: linux (centos 7) PHP Version: 7.1.22 Block user comment: N Private report: N New Comment: In UTF-8, the character Հ is encoded with the two bytes: \xD5 \x80 (https://www.compart.com/en/unicode/U+0540) These bytes match the regex quoted from the manual. Previous Comments: ------------------------------------------------------------------------ [2018-10-09 13:01:41] info at developiu dot it Description: ------------ --- From manual page: http://www.php.net/language.oop5.basic --- 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: --------------- <?php class Հ {} var_dump(new Հ); Expected result: ---------------- a parse error Actual result: -------------- class Հ#1 (0) { } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76984&edit=1

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