[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard html.c

2008-11-25 Thread Arnaud Le Blanc
lbarnaudWed Nov 26 02:43:16 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   html.c 
  Log:
  MFB 5.2
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14.2.12r2=1.111.2.2.2.14.2.13diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.14.2.12 
php-src/ext/standard/html.c:1.111.2.2.2.14.2.13
--- php-src/ext/standard/html.c:1.111.2.2.2.14.2.12 Tue Oct 21 22:08:37 2008
+++ php-src/ext/standard/html.c Wed Nov 26 02:43:16 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.111.2.2.2.14.2.12 2008/10/21 22:08:37 lbarnaud Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14.2.13 2008/11/26 02:43:16 lbarnaud Exp $ */
 
 /*
  * HTML entity resources:
@@ -527,6 +527,10 @@
do {
if (this_char  0x80) {
more = 0;
+   if(stat) {
+   /* we didn't finish the 
UTF sequence correctly */
+   *status = FAILURE;
+   }
break;
} else if (this_char  0xc0) {
switch (stat) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard html.c html.h /ext/standard/tests/strings htmlentities-utf-2.phpt htmlentities-utf.phpt

2008-11-25 Thread Arnaud Le Blanc
lbarnaudWed Nov 26 03:00:06 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings htmlentities-utf-2.phpt 

  Modified files:  
/php-src/ext/standard/tests/strings htmlentities-utf.phpt 
/php-src/ext/standard   html.c html.h 
  Log:
  MFH: Added ENT_IGNORE as a compatibility flag for htmlentities() and
  htmlspecialchars() to skip multibyte sequences intead of returning an
  empty string (as iconv's //IGNORE). These functions will still never 
  return an invalid or incomplete multibyte sequence.
  Fixes #43896
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/htmlentities-utf.phpt?r1=1.1.4.2r2=1.1.4.3diff_format=u
Index: php-src/ext/standard/tests/strings/htmlentities-utf.phpt
diff -u php-src/ext/standard/tests/strings/htmlentities-utf.phpt:1.1.4.2 
php-src/ext/standard/tests/strings/htmlentities-utf.phpt:1.1.4.3
--- php-src/ext/standard/tests/strings/htmlentities-utf.phpt:1.1.4.2Wed Oct 
 3 05:05:37 2007
+++ php-src/ext/standard/tests/strings/htmlentities-utf.phptWed Nov 26 
03:00:06 2008
@@ -4,8 +4,12 @@
 output_handler=
 --FILE--
 ?php 
-setlocale (LC_CTYPE, C);
-$strings = array(, \xD0, \xD0\x90, \xD0\x90\xD0, \xD0\x90\xD0\xB0, 
\xE0, A\xE0, \xE0\x80, \xE0\x80\xBE);
[EMAIL PROTECTED] (LC_CTYPE, C);
+$strings = array(b, b\xD0, b\xD0\x90, b\xD0\x90\xD0, 
b\xD0\x90\xD0\xB0, b\xE0, bA\xE0, b\xE0\x80, b\xE0\x79, 
b\xE0\x80\xBE,
+   bVoil\xE0, bClich\xE9s,
+   b\xFE, b\xFE\x41, b\xC3\xA9, b\xC3\x79, b\xF7\xBF\xBF\xBF, 
b\xFB\xBF\xBF\xBF\xBF, b\xFD\xBF\xBF\xBF\xBF\xBF,
+   b\x41\xF7\xF7\x42, b\x42\xFB\xFB\x42, b\x43\xFD\xFD\x42, 
b\x44\xF7\xF7, b\x45\xFB\xFB, b\x46\xFD\xFD
+   );
 foreach($strings as $string) {
$sc_encoded = htmlspecialchars ($string, ENT_QUOTES, utf-8);
var_dump(bin2hex($sc_encoded));
@@ -13,22 +17,54 @@
var_dump(bin2hex($ent_encoded));
 }
 ?
---EXPECT--
-string(8) 266c743b
-string(8) 266c743b
-string(0) 
-string(0) 
-string(4) d090
-string(4) d090
-string(0) 
-string(0) 
-string(8) d090d0b0
-string(8) d090d0b0
-string(0) 
-string(0) 
-string(0) 
-string(0) 
-string(0) 
-string(0) 
-string(8) 2667743b
-string(8) 2667743b
\ No newline at end of file
+--EXPECTF--
+%unicode|string%(8) 266c743b
+%unicode|string%(8) 266c743b
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(4) d090
+%unicode|string%(4) d090
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(8) d090d0b0
+%unicode|string%(8) d090d0b0
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(8) 2667743b
+%unicode|string%(8) 2667743b
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(4) c3a9
+%unicode|string%(16) 266561637574653b
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(8) f7bfbfbf
+%unicode|string%(8) f7bfbfbf
+%unicode|string%(10) fbbfbfbfbf
+%unicode|string%(10) fbbfbfbfbf
+%unicode|string%(12) fdbfbfbfbfbf
+%unicode|string%(12) fdbfbfbfbfbf
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
+%unicode|string%(0) 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14.2.13r2=1.111.2.2.2.14.2.14diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.14.2.13 
php-src/ext/standard/html.c:1.111.2.2.2.14.2.14
--- php-src/ext/standard/html.c:1.111.2.2.2.14.2.13 Wed Nov 26 02:43:16 2008
+++ php-src/ext/standard/html.c Wed Nov 26 03:00:06 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.111.2.2.2.14.2.13 2008/11/26 02:43:16 lbarnaud Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14.2.14 2008/11/26 03:00:06 lbarnaud Exp $ */
 
 /*
  * HTML entity resources:
@@ -485,6 +485,7 @@
 
 #define CHECK_LEN(pos, chars_need) \
if((str_len - (pos))  chars_need) {\
+   *newpos = pos;  \
*status = FAILURE;  \
return 0;   
\
}
@@ -529,6 +530,7 @@
more = 0;
if(stat) {
/* we didn't finish the 
UTF sequence correctly */
+   --pos;
*status = FAILURE;
}
 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard html.c

2008-08-17 Thread Moriyoshi Koizumi
moriyoshi   Mon Aug 18 03:26:22 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   html.c 
  Log:
  - MFH: beware of signedness
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14.2.10r2=1.111.2.2.2.14.2.11diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.14.2.10 
php-src/ext/standard/html.c:1.111.2.2.2.14.2.11
--- php-src/ext/standard/html.c:1.111.2.2.2.14.2.10 Sun Aug 10 13:26:13 2008
+++ php-src/ext/standard/html.c Mon Aug 18 03:26:21 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.111.2.2.2.14.2.10 2008/08/10 13:26:13 lbarnaud Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14.2.11 2008/08/18 03:26:21 moriyoshi Exp $ */
 
 /*
  * HTML entity resources:
@@ -1198,21 +1198,21 @@
if (*s == 'x' || *s == 
'X') {
s++;
while (s  e) {
-   if 
(!isxdigit(*s++)) {
+   if 
(!isxdigit((int)*(unsigned char *)s++)) {

goto encode_amp;
}
}
/* Dec (#90;)*/
} else {
while (s  e) {
-   if 
(!isdigit(*s++)) {
+   if 
(!isdigit((int)*(unsigned char *)s++)) {

goto encode_amp;
}
}
}
} else { /* text entities */
while (s  e) {
-   if 
(!isalnum(*s++)) {
+   if 
(!isalnum((int)*(unsigned char *)s++)) {
goto 
encode_amp;
}
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard html.c /ext/standard/tests/strings bug44703.phpt

2008-04-11 Thread Felipe Pena
felipe  Fri Apr 11 19:06:12 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings bug44703.phpt 

  Modified files:  
/php-src/ext/standard   html.c 
  Log:
  MFB: Fixed bug #44703 (htmlspecialchars() does not detect bad character set 
argument)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14.2.8r2=1.111.2.2.2.14.2.9diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.14.2.8 
php-src/ext/standard/html.c:1.111.2.2.2.14.2.9
--- php-src/ext/standard/html.c:1.111.2.2.2.14.2.8  Tue Jan 29 22:03:01 2008
+++ php-src/ext/standard/html.c Fri Apr 11 19:06:12 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.111.2.2.2.14.2.8 2008/01/29 22:03:01 stas Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14.2.9 2008/04/11 19:06:12 felipe Exp $ */
 
 /*
  * HTML entity resources:
@@ -842,7 +842,7 @@

/* now walk the charset map and look for the codeset */
for (i = 0; charset_map[i].codeset; i++) {
-   if (strncasecmp(charset_hint, charset_map[i].codeset, 
len) == 0) {
+   if (len == strlen(charset_map[i].codeset)  
strncasecmp(charset_hint, charset_map[i].codeset, len) == 0) {
charset = charset_map[i].charset;
found = 1;
break;

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug44703.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug44703.phpt
+++ php-src/ext/standard/tests/strings/bug44703.phpt



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard html.c

2008-01-29 Thread Stanislav Malyshev
stasTue Jan 29 22:03:01 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   html.c 
  Log:
  rm cruft
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14.2.7r2=1.111.2.2.2.14.2.8diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.14.2.7 
php-src/ext/standard/html.c:1.111.2.2.2.14.2.8
--- php-src/ext/standard/html.c:1.111.2.2.2.14.2.7  Mon Jan 28 23:07:12 2008
+++ php-src/ext/standard/html.c Tue Jan 29 22:03:01 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.111.2.2.2.14.2.7 2008/01/28 23:07:12 tony2001 Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14.2.8 2008/01/29 22:03:01 stas Exp $ */
 
 /*
  * HTML entity resources:
@@ -1122,7 +1122,6 @@
maxlen = 128;
replaced = emalloc (maxlen);
len = 0;
-   //Sleep(10*1000);
i = 0;
while (i  oldlen) {
unsigned char mbsequence[16];   /* allow up to 15 characters in 
a multibyte sequence */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard html.c

2008-01-28 Thread Antony Dovgal
tony2001Mon Jan 28 23:07:12 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   html.c 
  Log:
  fix #43927 (koi8r is missing from html_entity_decode())
  patch by andy at demos dot su
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14.2.6r2=1.111.2.2.2.14.2.7diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.14.2.6 
php-src/ext/standard/html.c:1.111.2.2.2.14.2.7
--- php-src/ext/standard/html.c:1.111.2.2.2.14.2.6  Fri Jan 25 18:10:45 2008
+++ php-src/ext/standard/html.c Mon Jan 28 23:07:12 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.111.2.2.2.14.2.6 2008/01/25 18:10:45 scottmac Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14.2.7 2008/01/28 23:07:12 tony2001 Exp $ */
 
 /*
  * HTML entity resources:
@@ -949,6 +949,7 @@
case cs_cp1251:
case cs_8859_5:
case cs_cp866:
+   case cs_koi8r:
replacement[0] = k;
replacement[1] = '\0';
replacement_len = 1;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard html.c

2007-12-11 Thread Jani Taskinen
janiTue Dec 11 11:29:09 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   html.c 
  Log:
  MFH: fix error displaying
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14.2.2r2=1.111.2.2.2.14.2.3diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.14.2.2 
php-src/ext/standard/html.c:1.111.2.2.2.14.2.3
--- php-src/ext/standard/html.c:1.111.2.2.2.14.2.2  Fri Oct  5 15:00:08 2007
+++ php-src/ext/standard/html.c Tue Dec 11 11:29:09 2007
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.111.2.2.2.14.2.2 2007/10/05 15:00:08 jani Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14.2.3 2007/12/11 11:29:09 jani Exp $ */
 
 /*
  * HTML entity resources:
@@ -1132,9 +1132,7 @@
if(status == FAILURE) {
/* invalid MB sequence */
efree(replaced);
-   if(!PG(display_errors)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Invalid multibyte sequence in argument);
-   }
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
multibyte sequence in argument);
*newlen = 0;
return STR_EMPTY_ALLOC();
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard html.c

2007-12-11 Thread Jani Taskinen
janiTue Dec 11 12:26:43 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   html.c 
  Log:
  MFH:- Revert previous patch, it was correct to do this, error is logged if 
logging is enabled
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14.2.3r2=1.111.2.2.2.14.2.4diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.14.2.3 
php-src/ext/standard/html.c:1.111.2.2.2.14.2.4
--- php-src/ext/standard/html.c:1.111.2.2.2.14.2.3  Tue Dec 11 11:29:09 2007
+++ php-src/ext/standard/html.c Tue Dec 11 12:26:43 2007
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.111.2.2.2.14.2.3 2007/12/11 11:29:09 jani Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14.2.4 2007/12/11 12:26:43 jani Exp $ */
 
 /*
  * HTML entity resources:
@@ -1132,7 +1132,9 @@
if(status == FAILURE) {
/* invalid MB sequence */
efree(replaced);
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
multibyte sequence in argument);
+   if(!PG(display_errors)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Invalid multibyte sequence in argument);
+   }
*newlen = 0;
return STR_EMPTY_ALLOC();
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard html.c

2007-10-02 Thread Stanislav Malyshev
stasWed Oct  3 05:05:08 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   html.c 
  Log:
  MFB do not accept partial multibyte sequences in html* functions
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14r2=1.111.2.2.2.14.2.1diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.14 
php-src/ext/standard/html.c:1.111.2.2.2.14.2.1
--- php-src/ext/standard/html.c:1.111.2.2.2.14  Sun May 27 15:57:11 2007
+++ php-src/ext/standard/html.c Wed Oct  3 05:05:08 2007
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.111.2.2.2.14 2007/05/27 15:57:11 nlopess Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14.2.1 2007/10/03 05:05:08 stas Exp $ */
 
 /*
  * HTML entity resources:
@@ -484,18 +484,29 @@
}\
mbseq[mbpos++] = (mbchar); }
 
+#define CHECK_LEN(pos, chars_need) \
+   if((str_len - (pos))  chars_need) {\
+   *status = FAILURE;  \
+   return 0;   
\
+   }
+
 /* {{{ get_next_char
  */
 inline static unsigned short get_next_char(enum entity_charset charset,
unsigned char * str,
+   int str_len,
int * newpos,
unsigned char * mbseq,
-   int * mbseqlen)
+   int * mbseqlen, 
+   int *status)
 {
int pos = *newpos;
int mbpos = 0;
int mbspace = *mbseqlen;
unsigned short this_char = str[pos++];
+   unsigned char next_char;
+
+   *status = SUCCESS;

if (mbspace = 0) {
*mbseqlen = 0;
@@ -555,6 +566,7 @@
break;
default:
/* invalid */
+   *status = 
FAILURE;
more = 0;
}
}
@@ -562,21 +574,27 @@
else if (this_char  0xe0) {
stat = 0x10;/* 2 byte */
utf = (this_char  0x1f)  6;
+   CHECK_LEN(pos, 1);
} else if (this_char  0xf0) {
stat = 0x20;/* 3 byte */
utf = (this_char  0xf)  12;
+   CHECK_LEN(pos, 2);
} else if (this_char  0xf8) {
stat = 0x30;/* 4 byte */
utf = (this_char  0x7)  18;
+   CHECK_LEN(pos, 3);
} else if (this_char  0xfc) {
stat = 0x40;/* 5 byte */
utf = (this_char  0x3)  24;
+   CHECK_LEN(pos, 4);
} else if (this_char  0xfe) {
stat = 0x50;/* 6 byte */
utf = (this_char  0x1)  30;
+   CHECK_LEN(pos, 5);
} else {
/* invalid; bail */
more = 0;
+   *status = FAILURE;
break;
}
 
@@ -594,7 +612,8 @@
/* check if this is the first of a 2-byte 
sequence */
if (this_char = 0xa1  this_char = 0xfe) {
/* peek at the next char */
-   unsigned char next_char = str[pos];
+   CHECK_LEN(pos, 1);
+   next_char = str[pos];
if ((next_char = 0x40  next_char = 
0x7e) ||
(next_char = 0xa1  
next_char = 0xfe)) {
/* yes, this a wide char */
@@ -614,7 +633,8 @@
 (this_char = 0xe0  this_char = 
0xef)
)