Bug #71897 [Com]: ASCII 0x7F Delete control character permitted in identifiers

From: Date: Fri, 25 Mar 2016 12:02:27 +0000
Subject: Bug #71897 [Com]: ASCII 0x7F Delete control character permitted in identifiers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200091@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
 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:

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.


Previous Comments:
------------------------------------------------------------------------
[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


Thread (4 messages)

« previous php.bugs (#200091) next »