]> granicus.if.org Git - php/commitdiff
remove \u, \U and \C support in single quotes, as they are meant to contain binary...
authorAntony Dovgal <tony2001@php.net>
Wed, 3 Oct 2007 18:38:35 +0000 (18:38 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 3 Oct 2007 18:38:35 +0000 (18:38 +0000)
fixes bug #42746

README.UNICODE
Zend/zend_language_scanner.l

index d2cce26426145612038f69a9a43c96ef406dfbbd..14d415f7b459f7b00d8792eb5599737dc6904044 100644 (file)
@@ -460,11 +460,6 @@ PHP interprets the contents of strings as follows:
   - a new escape sequence allows specifying a character by its full
     Unicode name, e.g. \C{THAI CHARACTER PHO SAMPHAO} => U+0E20
 
-The single-quoted string is more restrictive than the other two types. So far
-the only escape sequence allowed inside of it was \', which specifies a literal
-single quote. However, single quoted strings now support the new Unicode
-character escape sequences as well.
-
 PHP allows variable interpolation inside the double-quoted and heredoc strings.
 However, the parser separates the string into literal and variable chunks during
 compilation, e.g. "abc $var def" -> "abc" . $var . "def". This means that PHP
index fa1687c3389d0473d6e4f5bc63216cad098b8156..90e1133389feb98c98ab937bd9f825e9f174a3c9 100644 (file)
@@ -1187,64 +1187,6 @@ static int zend_scan_unicode_single_string(zval *zendlval TSRMLS_DC)
                                        *t++ = *s;
                                        Z_USTRLEN_P(zendlval)--;
                                        break;
-                               case 0x43: /*'C'*/
-                                       {
-                                               UChar *p = s+1;
-                                               if (p < end && zend_parse_charname_sequence(&p, end, &codepoint TSRMLS_CC)) {
-                                                       Z_USTRLEN_P(zendlval) -= p - s + 1;
-                                                       s = p;
-                                                       if (U_IS_BMP(codepoint)) {
-                                                               *t++ = (UChar) codepoint;
-                                                       } else {
-                                                               *t++ = (UChar) U16_LEAD(codepoint);
-                                                               *t++ = (UChar) U16_TRAIL(codepoint);
-                                                               Z_USTRLEN_P(zendlval)++;
-                                                       }
-                                               } else {
-                                                       zend_error(E_COMPILE_WARNING, "Invalid \\C{..} sequence");
-                                                       efree(Z_USTRVAL_P(zendlval));
-                                                       return 0;
-                                               }
-                                               break;
-                                       }
-                               case 0x75 /*'u'*/:
-                                       {
-                                               codepoint = 0;
-                                               if (zend_udigits_to_codepoint(s+1, end, &codepoint, 4)) {
-                                                       *t++ = (UChar) codepoint;
-                                                       s += 4;
-                                                       Z_USTRLEN_P(zendlval) -= 5;
-                                               } else {
-                                                       zend_error(E_COMPILE_WARNING,"\\u escape sequence requires exactly 4 hexadecimal digits");
-                                                       efree(Z_USTRVAL_P(zendlval));
-                                                       return 0;
-                                               }
-                                               break;
-                                       }
-                               case 0x55 /*'U'*/:
-                                       {
-                                               codepoint = 0;
-                                               if (zend_udigits_to_codepoint(s+1, end, &codepoint, 6)) {
-                                                       if (U_IS_BMP(codepoint)) {
-                                                               *t++ = (UChar) codepoint;
-                                                               Z_USTRLEN_P(zendlval) -= 7;
-                                                       } else if (codepoint <= 0x10FFFF) {
-                                                               *t++ = (UChar) U16_LEAD(codepoint);
-                                                               *t++ = (UChar) U16_TRAIL(codepoint);
-                                                               Z_USTRLEN_P(zendlval) -= 6;
-                                                       } else {
-                                                               zend_error(E_COMPILE_WARNING,"\\U%06x is above the highest valid codepoint 0x10FFFF", codepoint);
-                                                               efree(Z_USTRVAL_P(zendlval));
-                                                               return 0;
-                                                       }
-                                                       s += 6;
-                                               } else {
-                                                       zend_error(E_COMPILE_WARNING,"\\U escape sequence requires exactly 6 hexadecimal digits");
-                                                       efree(Z_USTRVAL_P(zendlval));
-                                                       return 0;
-                                               }
-                                               break;
-                                       }
                                default:
                                        *t++ = 0x5C; /*'\\'*/
                                        *t++ = *s;