From:             [EMAIL PROTECTED]
Operating system: Linux, FreeBSD
PHP version:      4.2.2
PHP Bug Type:     Feature/Change Request
Bug description:  \v C-style escape sequence in double-quoted strings

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 bug report at http://bugs.php.net/?id=20231&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20231&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20231&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20231&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20231&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20231&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20231&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20231&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20231&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20231&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20231&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20231&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20231&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20231&r=isapi

Reply via email to