Bug #71897 [Asn->Csd]: ASCII 0x7F Delete control character permitted in identifiers
| From: | ajf@php.net | Date: | Wed, 04 May 2016 18:32:02 +0000 |
| Subject: | Bug #71897 [Asn->Csd]: ASCII 0x7F Delete control character permitted in identifiers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200896@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71897&edit=1
ID: 71897
Updated by: ajf@php.net
Reported by: ajf@php.net
Summary: ASCII 0x7F Delete control character permitted in
identifiers
-Status: Assigned
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: *
PHP Version: Irrelevant
Assigned To: ajf
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of ajf@ajf.me
Revision: http://git.php.net/?p=php-src.git;a=commit;h=660e88c19d98b8353995d750940d8513bfeca85f
Log: Fix bug #71897
Previous Comments:
------------------------------------------------------------------------
[2016-03-25 12:02:21] ajf@php.net
I can't find anything that matters where \x7F isn't DEL. The 7-bit ASCII-like encodings
based on ISO 646 all leave it alone. The 8-bit ASCII-superset encodings of ISO/IEC 8859 all leave it
alone. The Japanese standards leave it alone.
It'd be surprising if any ASCII-compatible encoding changed \x7F's meaning, too.
So I think this was simply a mistake.
------------------------------------------------------------------------
[2016-03-25 11:22:31] ajf@php.net
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).
------------------------------------------------------------------------
[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