Bug #71897 [Com]: ASCII 0x7F Delete control character permitted in identifiers
Edit report at https://bugs.php.net/bug.php?id=71897&edit=1
ID: 71897
Comment by: ajf@php.net
Reported by: ajf@php.net
Summary: ASCII 0x7F Delete control character permitted in
identifiers
Status: Assigned
Type: Bug
Package: Scripting Engine problem
Operating System: *
PHP Version: Irrelevant
Assigned To: ajf
Block user comment: N
Private report: N
New Comment:
A correction: \x7F doesn't hide the preceding character, at least not in my terminal emulator.
I think I was confusing it with \x08 (ASCII Backspace).
Previous Comments:
------------------------------------------------------------------------
[2016-03-25 10:47:53] ajf@php.net
Description:
------------
Identifiers in PHP source code conform to the regex /[_a-zA-Z\x7F-\xFF][_0-9a-zA-Z\x7F-\xFF]*/. Most
of this regex is pretty standard: it allows alphanumeric ASCII characters and underscores, plus any
character with the 8th bit set (presumably to allow any extension of ASCII, such as Latin-1 or
UTF-8, to be used).
But there's one part of this I find rather curious: why is \x7F included? It's not a
high-byte/8-bit character, it's a 7-bit ASCII character, and a control character at that.
Unless there's some ASCII extension which reuses that value as a printing character, I assume
it must be a mistake to include this character. As a control character, it is invisible and
difficult to type. Worse, if you were to include it within an identifier, it would hide the
preceding printing character (because \x7F moves the cursor back one column in terminal emulators).
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71897&edit=1
Thread (4 messages)