Edit report at https://bugs.php.net/bug.php?id=20231&edit=1

 ID:                 20231
 Updated by:         ni...@php.net
 Reported by:        hioreanu+php at uchicago dot edu
 Summary:            \v C-style escape sequence in double-quoted strings
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   Linux, FreeBSD
 PHP Version:        4.2.2
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Closing as both \v and \f are supported by now.


Previous Comments:
------------------------------------------------------------------------
[2002-11-03 15:19:00] hioreanu+php at uchicago dot edu

PHP does not seem to recognize the "\v" escape sequence within strings, like C 
does.  This would probably be an issue in the PHP double-quoted string parser.

I'm guessing this has been filed elsewhere as a bug, but I cannot find it (the 
bug search form does not like \v, '\v' or "\v").

Even though this is documented (language.types.string.php), it is still 
unexpected.  Consider the following code:

$s = ereg_replace("[\t\v\n\r ]", '', $s);

The intent is to replace all whitespace, where whitespace is defined similarly 
to isspace(3) (but I forgot '\f', no big deal).  The result is that whitespace 
*and* the "v" character is removed.  The letter v is rare enough in English 
(and vertical tab is almost unheard-of in text) that this can go for a few days 
without being noticed.

In the same vein, \f should also be recognized.  I'm not sure about \a and \b, 
but I would definitely say trigraphs are a bad idea :).

Perhaps only a warning would be enough.  My copy of the C standard states that 
when an unknown escape sequence is encountered, the compiler should emit a 
diagnostic.  That seems like reasonable behaviour.

------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=20231&edit=1

Reply via email to