php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71897 ASCII 0x7F Delete control character permitted in identifiers
Submitted: 2016-03-25 10:47 UTC Modified: 2016-03-25 11:13 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ajf@php.net Assigned: ajf (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ajf@php.net
New email:
PHP Version: OS:

 

 [2016-03-25 10:47 UTC] 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).


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-25 10:52 UTC] ajf@php.net
-Assigned To: +Assigned To: ajf
 [2016-03-25 11:13 UTC] ajf@php.net
-Summary: ASCII 0x7F Delete/Backspace control character permitted in identifiers +Summary: ASCII 0x7F Delete control character permitted in identifiers
 [2016-03-25 11:22 UTC] 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 12:02 UTC] 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-05-04 18:32 UTC] ajf@php.net
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
 [2016-05-04 18:32 UTC] ajf@php.net
-Status: Assigned +Status: Closed
 [2016-07-11 16:08 UTC] nikic@php.net
Automatic comment on behalf of ajf@ajf.me
Revision: http://git.php.net/?p=php-langspec.git;a=commit;h=f75930f6f08b1ec21cf3a16872f8c17b961f1062
Log: Fix bug #71897
 [2016-07-20 11:31 UTC] davey@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC