[PHP-CVS] cvs: php4 /ext/standard html.c

2003-03-08 Thread Stefan Esser
sesser  Sat Mar  8 09:51:16 2003 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  wrong place.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.74 php4/ext/standard/html.c:1.75
--- php4/ext/standard/html.c:1.74   Sat Mar  8 09:37:01 2003
+++ php4/ext/standard/html.cSat Mar  8 09:51:16 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.74 2003/03/08 14:37:01 sesser Exp $ */
+/* $Id: html.c,v 1.75 2003/03/08 14:51:16 sesser Exp $ */
 
 #include "php.h"
 #if PHP_WIN32
@@ -840,7 +840,6 @@
}
 
replaced = php_escape_html_entities(str, str_len, &len, all, quote_style, 
hint_charset TSRMLS_CC);
-   efree(str);
RETVAL_STRINGL(replaced, len, 0);
 }
 /* }}} */



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



[PHP-CVS] cvs: php4 /ext/standard html.c

2003-03-08 Thread Stefan Esser
sesser  Sat Mar  8 09:37:01 2003 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  fixing memory leak
  
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.73 php4/ext/standard/html.c:1.74
--- php4/ext/standard/html.c:1.73   Thu Mar  6 18:07:27 2003
+++ php4/ext/standard/html.cSat Mar  8 09:37:01 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.73 2003/03/06 23:07:27 ddhill Exp $ */
+/* $Id: html.c,v 1.74 2003/03/08 14:37:01 sesser Exp $ */
 
 #include "php.h"
 #if PHP_WIN32
@@ -840,6 +840,7 @@
}
 
replaced = php_escape_html_entities(str, str_len, &len, all, quote_style, 
hint_charset TSRMLS_CC);
+   efree(str);
RETVAL_STRINGL(replaced, len, 0);
 }
 /* }}} */



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



[PHP-CVS] cvs: php4 /ext/standard html.c /ext/standard/tests/strings bug21338.phpt

2003-01-02 Thread Ilia Alshanetsky
iliaa   Thu Jan  2 14:49:30 2003 EDT

  Added files: 
/php4/ext/standard/tests/stringsbug21338.phpt 

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Fixed bug #21338 (crash inside html_entity_decode() when "" is passed).
  Added test case for the bug.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.68 php4/ext/standard/html.c:1.69
--- php4/ext/standard/html.c:1.68   Tue Dec 31 11:07:42 2002
+++ php4/ext/standard/html.cThu Jan  2 14:49:30 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.68 2002/12/31 16:07:42 sebastian Exp $ */
+/* $Id: html.c,v 1.69 2003/01/02 19:49:30 iliaa Exp $ */
 
 #include "php.h"
 #if PHP_WIN32
@@ -674,6 +674,9 @@

ret = estrdup(old);
retlen = oldlen;
+   if (!retlen) {
+   goto empty_source;
+   }

if (all) {
/* look for a match in the maps for this charset */
@@ -722,7 +725,7 @@
efree(ret);
ret = replaced;
}
-   
+empty_source:  
*newlen = retlen;
return ret;
 }

Index: php4/ext/standard/tests/strings/bug21338.phpt
+++ php4/ext/standard/tests/strings/bug21338.phpt
--TEST--
Bug #20934 (html_entity_decode() crash when "" is passed)
--FILE--

--EXPECT--
string(0) ""
string(0) ""



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-12-12 Thread Ilia Alshanetsky
iliaa   Thu Dec 12 09:50:58 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Fixed misspelling of the Greek letter lambda,
  noticed by [EMAIL PROTECTED]
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.66 php4/ext/standard/html.c:1.67
--- php4/ext/standard/html.c:1.66   Thu Dec 12 08:25:51 2002
+++ php4/ext/standard/html.cThu Dec 12 09:50:58 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.66 2002/12/12 13:25:51 moriyoshi Exp $ */
+/* $Id: html.c,v 1.67 2002/12/12 14:50:58 iliaa Exp $ */
 
 #include "php.h"
 #if PHP_WIN32
@@ -130,7 +130,7 @@
/* 938 - 944 are not mapped */
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta",
-   "iota", "kappa", "lamda", "mu", "nu", "x1", "omicron", "p1", "rho",
+   "iota", "kappa", "lambda", "mu", "nu", "x1", "omicron", "p1", "rho",
"sigmaf", "sigma", "tau", "upsilon", "ph1", "ch1", "ps1", "omega",
/* 970 - 976 are not mapped */
NULL, NULL, NULL, NULL, NULL, NULL, NULL,



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-12-12 Thread Moriyoshi Koizumi
moriyoshi   Thu Dec 12 08:25:52 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Fixed bug #20934 (htmlspecialchars returns latin1 from UTF-8)
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.65 php4/ext/standard/html.c:1.66
--- php4/ext/standard/html.c:1.65   Sat Nov 16 03:30:31 2002
+++ php4/ext/standard/html.cThu Dec 12 08:25:51 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.65 2002/11/16 08:30:31 sebastian Exp $ */
+/* $Id: html.c,v 1.66 2002/12/12 13:25:51 moriyoshi Exp $ */
 
 #include "php.h"
 #if PHP_WIN32
@@ -801,11 +801,10 @@
 
}
if (!is_basic) {
-   if (this_char > 0xff) {
-   /* a wide char without a named entity; pass 
through the original sequence */
+   /* a wide char without a named entity; pass through 
+the original sequence */
+   if (mbseqlen > 1) {
memcpy(replaced + len, mbsequence, mbseqlen);
len += mbseqlen;
-
} else {
replaced[len++] = (unsigned char)this_char;
}



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-11-16 Thread Sebastian Bergmann
sebastian   Sat Nov 16 03:30:31 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Fix Win32 build.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.64 php4/ext/standard/html.c:1.65
--- php4/ext/standard/html.c:1.64   Fri Nov 15 11:13:36 2002
+++ php4/ext/standard/html.cSat Nov 16 03:30:31 2002
@@ -18,10 +18,14 @@
+--+
 */
 
-/* $Id: html.c,v 1.64 2002/11/15 16:13:36 moriyoshi Exp $ */
+/* $Id: html.c,v 1.65 2002/11/16 08:30:31 sebastian Exp $ */
 
 #include "php.h"
+#if PHP_WIN32
+#include "config.w32.h"
+#else
 #include "php_config.h"
+#endif
 #include "reg.h"
 #include "html.h"
 #include "php_string.h"



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




Re: [PHP-CVS] cvs: php4 /ext/standard html.c

2002-11-15 Thread Moriyoshi Koizumi
Oops, I forgot it.
Thanks.

Moriyoshi

Jani Taskinen <[EMAIL PROTECTED]> wrote:

> 
>MFH?
> 
> On Fri, 15 Nov 2002, Moriyoshi Koizumi wrote:
> 
> >moriyoshiFri Nov 15 11:13:36 2002 EDT
> >
> >  Modified files:  
> >/php4/ext/standard   html.c 
> >  Log:
> >  Include php_config.h for HAVE_MBSTRING
> >  
> >  
> >Index: php4/ext/standard/html.c
> >diff -u php4/ext/standard/html.c:1.63 php4/ext/standard/html.c:1.64
> >--- php4/ext/standard/html.c:1.63Mon Nov 11 08:31:08 2002
> >+++ php4/ext/standard/html.c Fri Nov 15 11:13:36 2002
> >@@ -18,9 +18,10 @@
> >+--+
> > */
> > 
> >-/* $Id: html.c,v 1.63 2002/11/11 13:31:08 moriyoshi Exp $ */
> >+/* $Id: html.c,v 1.64 2002/11/15 16:13:36 moriyoshi Exp $ */
> > 
> > #include "php.h"
> >+#include "php_config.h"
> > #include "reg.h"
> > #include "html.h"
> > #include "php_string.h"
> >
> >
> >
> >
> 
> -- 
> <- For Sale! ->
> 
> 
> -- 
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP-CVS] cvs: php4 /ext/standard html.c

2002-11-15 Thread Jani Taskinen

   MFH?

On Fri, 15 Nov 2002, Moriyoshi Koizumi wrote:

>moriyoshi  Fri Nov 15 11:13:36 2002 EDT
>
>  Modified files:  
>/php4/ext/standard html.c 
>  Log:
>  Include php_config.h for HAVE_MBSTRING
>  
>  
>Index: php4/ext/standard/html.c
>diff -u php4/ext/standard/html.c:1.63 php4/ext/standard/html.c:1.64
>--- php4/ext/standard/html.c:1.63  Mon Nov 11 08:31:08 2002
>+++ php4/ext/standard/html.c   Fri Nov 15 11:13:36 2002
>@@ -18,9 +18,10 @@
>+--+
> */
> 
>-/* $Id: html.c,v 1.63 2002/11/11 13:31:08 moriyoshi Exp $ */
>+/* $Id: html.c,v 1.64 2002/11/15 16:13:36 moriyoshi Exp $ */
> 
> #include "php.h"
>+#include "php_config.h"
> #include "reg.h"
> #include "html.h"
> #include "php_string.h"
>
>
>
>

-- 
<- For Sale! ->


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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-11-15 Thread Moriyoshi Koizumi
moriyoshi   Fri Nov 15 11:13:36 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Include php_config.h for HAVE_MBSTRING
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.63 php4/ext/standard/html.c:1.64
--- php4/ext/standard/html.c:1.63   Mon Nov 11 08:31:08 2002
+++ php4/ext/standard/html.cFri Nov 15 11:13:36 2002
@@ -18,9 +18,10 @@
+--+
 */
 
-/* $Id: html.c,v 1.63 2002/11/11 13:31:08 moriyoshi Exp $ */
+/* $Id: html.c,v 1.64 2002/11/15 16:13:36 moriyoshi Exp $ */
 
 #include "php.h"
+#include "php_config.h"
 #include "reg.h"
 #include "html.h"
 #include "php_string.h"



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-11-11 Thread Moriyoshi Koizumi
moriyoshi   Mon Nov 11 08:31:10 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Added support for windows code pages.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.62 php4/ext/standard/html.c:1.63
--- php4/ext/standard/html.c:1.62   Mon Nov 11 08:28:34 2002
+++ php4/ext/standard/html.cMon Nov 11 08:31:08 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.62 2002/11/11 13:28:34 moriyoshi Exp $ */
+/* $Id: html.c,v 1.63 2002/11/11 13:31:08 moriyoshi Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -288,11 +288,15 @@
{ "utf-8",  cs_utf_8 },
{ "cp1252", cs_cp1252 },
{ "Windows-1252",   cs_cp1252 },
+   { "1252",   cs_cp1252 }, 
{ "BIG5",   cs_big5 },
+   { "950",cs_big5 },
{ "GB2312", cs_gb2312 },
+   { "936",cs_gb2312 },
{ "BIG5-HKSCS", cs_big5hkscs },
{ "Shift_JIS",  cs_sjis },
{ "SJIS",   cs_sjis },
+   { "932",cs_sjis },
{ "EUCJP",  cs_eucjp },
{ "EUC-JP", cs_eucjp },
{ NULL }



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-11-11 Thread Moriyoshi Koizumi
moriyoshi   Mon Nov 11 08:28:34 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  WS
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.61 php4/ext/standard/html.c:1.62
--- php4/ext/standard/html.c:1.61   Tue Oct 29 10:05:07 2002
+++ php4/ext/standard/html.cMon Nov 11 08:28:34 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.61 2002/10/29 15:05:07 moriyoshi Exp $ */
+/* $Id: html.c,v 1.62 2002/11/11 13:28:34 moriyoshi Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -291,10 +291,10 @@
{ "BIG5",   cs_big5 },
{ "GB2312", cs_gb2312 },
{ "BIG5-HKSCS", cs_big5hkscs },
-   { "Shift_JIS",  cs_sjis },
-   { "SJIS",   cs_sjis },
-   { "EUCJP",  cs_eucjp },
-   { "EUC-JP", cs_eucjp },
+   { "Shift_JIS",  cs_sjis },
+   { "SJIS",   cs_sjis },
+   { "EUCJP",  cs_eucjp },
+   { "EUC-JP", cs_eucjp },
{ NULL }
 };
 



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-10-29 Thread Moriyoshi Koizumi
moriyoshi   Tue Oct 29 10:05:08 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  WS fix
  
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.60 php4/ext/standard/html.c:1.61
--- php4/ext/standard/html.c:1.60   Fri Oct 25 09:12:05 2002
+++ php4/ext/standard/html.cTue Oct 29 10:05:07 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.60 2002/10/25 13:12:05 moriyoshi Exp $ */
+/* $Id: html.c,v 1.61 2002/10/29 15:05:07 moriyoshi Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -345,7 +345,7 @@

MB_WRITE((unsigned char)this_char);

-   switch (charset){
+   switch (charset) {
case cs_utf_8:
{
unsigned long utf = 0;
@@ -634,8 +634,8 @@
int found = 0;

/* 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){
+   for (i = 0; charset_map[i].codeset; i++) {
+   if (strncasecmp(charset_hint, charset_map[i].codeset, len) == 
+0) {
charset = charset_map[i].charset;
found = 1;
break;
@@ -668,7 +668,7 @@

if (all) {
/* look for a match in the maps for this charset */
-   for (j = 0; entity_map[j].charset != cs_terminator; j++){
+   for (j = 0; entity_map[j].charset != cs_terminator; j++) {
if (entity_map[j].charset != charset)
continue;
 
@@ -701,7 +701,7 @@
}
}
 
-   for (j = 0; basic_entities[j].charcode != 0; j++)   {
+   for (j = 0; basic_entities[j].charcode != 0; j++) {
 
if (basic_entities[j].flags && (quote_style & basic_entities[j].flags) 
== 0)
continue;
@@ -756,8 +756,7 @@
for (j = 0; entity_map[j].charset != cs_terminator; j++) {
if (entity_map[j].charset == charset
&& this_char >= entity_map[j].basechar
-   && this_char <= entity_map[j].endchar)
-   {
+   && this_char <= entity_map[j].endchar) 
+{
rep = (unsigned 
char*)entity_map[j].table[this_char - entity_map[j].basechar];
if (rep == NULL) {
/* there is no entity for this 
position; fall through and



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-10-25 Thread Moriyoshi Koizumi
moriyoshi   Fri Oct 25 09:12:05 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Fix build if mbstring is enabled as shared extension.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.59 php4/ext/standard/html.c:1.60
--- php4/ext/standard/html.c:1.59   Thu Oct 24 18:04:28 2002
+++ php4/ext/standard/html.cFri Oct 25 09:12:05 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.59 2002/10/24 22:04:28 moriyoshi Exp $ */
+/* $Id: html.c,v 1.60 2002/10/25 13:12:05 moriyoshi Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -282,9 +282,12 @@
enum entity_charset charset;
 } charset_map[] = {
{ "ISO-8859-1", cs_8859_1 },
+   { "ISO8859-1",  cs_8859_1 },
{ "ISO-8859-15",cs_8859_15 },
+   { "ISO8859-15", cs_8859_15 },
{ "utf-8",  cs_utf_8 },
{ "cp1252", cs_cp1252 },
+   { "Windows-1252",   cs_cp1252 },
{ "BIG5",   cs_big5 },
{ "GB2312", cs_gb2312 },
{ "BIG5-HKSCS", cs_big5hkscs },
@@ -525,82 +528,108 @@
int i;
enum entity_charset charset = cs_8859_1;
int len = 0;
+   zval *uf_result = NULL;
 
/* Guarantee default behaviour for backwards compatibility */
if (charset_hint == NULL)
return cs_8859_1;
 
-   if ((len = strlen(charset_hint)) == 0) {
+   if ((len = strlen(charset_hint)) != 0) {
+   goto det_charset;
+   }
 #if HAVE_MBSTRING
+#if !defined(COMPILE_DL_MBSTRING)
/* XXX: Ugly things. Why don't we look for a more sophisticated way? */
-   switch (MBSTRG(internal_encoding)) {
-   case mbfl_no_encoding_8859_1:
-   return cs_8859_1;
-
-   case mbfl_no_encoding_utf8:
-   return cs_utf_8;
-
-   case mbfl_no_encoding_euc_jp:
-   case mbfl_no_encoding_eucjp_win:
-   return cs_eucjp;
-
-   case mbfl_no_encoding_sjis:
-   case mbfl_no_encoding_sjis_win:
-   case mbfl_no_encoding_sjis_mac:
-   return cs_sjis;
-
-   case mbfl_no_encoding_cp1252:
-   return cs_cp1252;
-
-   case mbfl_no_encoding_8859_15:
-   return cs_8859_15;
-
-   case mbfl_no_encoding_big5:
-   return cs_big5;
-
-   case mbfl_no_encoding_euc_cn:
-   case mbfl_no_encoding_hz:
-   case mbfl_no_encoding_cp936:
-   return cs_gb2312;
+   switch (MBSTRG(current_internal_encoding)) {
+   case mbfl_no_encoding_8859_1:
+   return cs_8859_1;
+
+   case mbfl_no_encoding_utf8:
+   return cs_utf_8;
+
+   case mbfl_no_encoding_euc_jp:
+   case mbfl_no_encoding_eucjp_win:
+   return cs_eucjp;
+
+   case mbfl_no_encoding_sjis:
+   case mbfl_no_encoding_sjis_win:
+   case mbfl_no_encoding_sjis_mac:
+   return cs_sjis;
+
+   case mbfl_no_encoding_cp1252:
+   return cs_cp1252;
+
+   case mbfl_no_encoding_8859_15:
+   return cs_8859_15;
+
+   case mbfl_no_encoding_big5:
+   return cs_big5;
+
+   case mbfl_no_encoding_euc_cn:
+   case mbfl_no_encoding_hz:
+   case mbfl_no_encoding_cp936:
+   return cs_gb2312;
+   }
+#else
+   {
+   zval nm_mb_internal_encoding;
+
+   ZVAL_STRING(&nm_mb_internal_encoding, "mb_internal_encoding", 0);
+
+   if (call_user_function_ex(CG(function_table), NULL, 
+&nm_mb_internal_encoding, &uf_result, 0, NULL, 1, NULL TSRMLS_CC) != FAILURE) {
+
+   charset_hint = Z_STRVAL_P(uf_result);
+   len = Z_STRLEN_P(uf_result);
+   
+   goto det_charset;
}
+   }
+#endif
 #endif
-   charset_hint = SG(default_charset);
-   if (charset_hint == NULL || (len=strlen(charset_hint)) == 0) {
-   /* try to detect the charset for the locale */
+
+   charset_hint = SG(default_charset);
+   if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) {
+   goto det_charset;
+   }
+
+   /* try to detect the charset for the locale */
 #if HAVE_NL_LANGINFO && HAVE_LOCALE_H && defined(CODESET)
-   charset_hint = nl_la

[PHP-CVS] cvs: php4 /ext/standard html.c

2002-10-24 Thread Moriyoshi Koizumi
moriyoshi   Thu Oct 24 18:04:29 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Improved determine_charset() to look up SG(default_charset) value 
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.58 php4/ext/standard/html.c:1.59
--- php4/ext/standard/html.c:1.58   Thu Oct 24 17:10:45 2002
+++ php4/ext/standard/html.cThu Oct 24 18:04:28 2002
@@ -18,12 +18,13 @@
+--+
 */
 
-/* $Id: html.c,v 1.58 2002/10/24 21:10:45 moriyoshi Exp $ */
+/* $Id: html.c,v 1.59 2002/10/24 22:04:28 moriyoshi Exp $ */
 
 #include "php.h"
 #include "reg.h"
 #include "html.h"
 #include "php_string.h"
+#include "SAPI.h"
 #if HAVE_LOCALE_H
 #include 
 #endif
@@ -529,7 +530,7 @@
if (charset_hint == NULL)
return cs_8859_1;
 
-   if (strlen(charset_hint) == 0)  {
+   if ((len = strlen(charset_hint)) == 0) {
 #if HAVE_MBSTRING
/* XXX: Ugly things. Why don't we look for a more sophisticated way? */
switch (MBSTRG(internal_encoding)) {
@@ -563,46 +564,45 @@
return cs_gb2312;
}
 #endif
-   /* try to detect the charset for the locale */
+   charset_hint = SG(default_charset);
+   if (charset_hint == NULL || (len=strlen(charset_hint)) == 0) {
+   /* try to detect the charset for the locale */
 #if HAVE_NL_LANGINFO && HAVE_LOCALE_H && defined(CODESET)
-   charset_hint = nl_langinfo(CODESET);
+   charset_hint = nl_langinfo(CODESET);
 #endif
 #if HAVE_LOCALE_H
-   if (charset_hint == NULL) {
-   /* try to figure out the charset from the locale */
-   char *localename;
-   char *dot, *at;
-
-   /* lang[_territory][.codeset][@modifier] */
-   localename = setlocale(LC_CTYPE, NULL);
-
-   dot = strchr(localename, '.');
-   if (dot) {
-   dot++;
-   /* locale specifies a codeset */
-   at = strchr(dot, '@');
-   if (at)
-   len = at - dot;
-   else
-   len = strlen(dot);
-   charset_hint = dot;
+   if (charset_hint == NULL) {
+   /* try to figure out the charset from the locale */
+   char *localename;
+   char *dot, *at;
+
+   /* lang[_territory][.codeset][@modifier] */
+   localename = setlocale(LC_CTYPE, NULL);
+
+   dot = strchr(localename, '.');
+   if (dot) {
+   dot++;
+   /* locale specifies a codeset */
+   at = strchr(dot, '@');
+   if (at)
+   len = at - dot;
+   else
+   len = strlen(dot);
+   charset_hint = dot;
+   } else {
+   /* no explicit name; see if the name itself
+* is the charset */
+   charset_hint = localename;
+   len = strlen(charset_hint);
+   }
} else {
-   /* no explicit name; see if the name itself
-* is the charset */
-   charset_hint = localename;
len = strlen(charset_hint);
}
-   } else
-   len = strlen(charset_hint);
-#else
-   if (charset_hint)
-   len = strlen(charset_hint);
 #endif
+   }
}
if (charset_hint) {
int found = 0;
-   if (!len)
-   len = strlen(charset_hint);

/* now walk the charset map and look for the codeset */
for (i = 0; charset_map[i].codeset; i++){



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-10-24 Thread Moriyoshi Koizumi
moriyoshi   Thu Oct 24 17:10:45 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Fixed ISO-8859-1 handling.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.57 php4/ext/standard/html.c:1.58
--- php4/ext/standard/html.c:1.57   Thu Oct 24 15:52:30 2002
+++ php4/ext/standard/html.cThu Oct 24 17:10:45 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.57 2002/10/24 19:52:30 moriyoshi Exp $ */
+/* $Id: html.c,v 1.58 2002/10/24 21:10:45 moriyoshi Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -533,6 +533,9 @@
 #if HAVE_MBSTRING
/* XXX: Ugly things. Why don't we look for a more sophisticated way? */
switch (MBSTRG(internal_encoding)) {
+   case mbfl_no_encoding_8859_1:
+   return cs_8859_1;
+
case mbfl_no_encoding_utf8:
return cs_utf_8;
 



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-10-23 Thread Marcus Börger
helly   Wed Oct 23 19:09:08 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  fix warning
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.55 php4/ext/standard/html.c:1.56
--- php4/ext/standard/html.c:1.55   Tue Oct 22 16:11:48 2002
+++ php4/ext/standard/html.cWed Oct 23 19:09:08 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.55 2002/10/22 20:11:48 moriyoshi Exp $ */
+/* $Id: html.c,v 1.56 2002/10/23 23:09:08 helly Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -715,7 +715,7 @@
 
if (all) {
/* look for a match in the maps for this charset */
-   unsigned char *rep;
+   unsigned char *rep = NULL;
 
 
for (j = 0; entity_map[j].charset != cs_terminator; j++) {



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-10-03 Thread Andrey Hristov

andrey  Thu Oct  3 08:06:53 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  few ws fixes.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.53 php4/ext/standard/html.c:1.54
--- php4/ext/standard/html.c:1.53   Thu Sep 26 14:13:32 2002
+++ php4/ext/standard/html.cThu Oct  3 08:06:52 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.53 2002/09/26 18:13:32 sebastian Exp $ */
+/* $Id: html.c,v 1.54 2002/10/03 12:06:52 andrey Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -336,7 +336,7 @@

MB_WRITE((unsigned char)this_char);

-   switch(charset) {
+   switch (charset){
case cs_utf_8:
{
unsigned long utf = 0;
@@ -350,9 +350,8 @@
if (this_char < 0x80) {
more = 0;
break;
-   }
-   else if (this_char < 0xc0) {
-   switch(stat){
+   } else if (this_char < 0xc0) {
+   switch (stat) {
case 0x10:  /* 2, 2nd */
case 0x21:  /* 3, 3rd */
case 0x32:  /* 4, 4th */
@@ -416,7 +415,7 @@
this_char = str[pos++];
MB_WRITE((unsigned char)this_char);
}
-   } while(more);
+   } while (more);
}
break;
case cs_big5:
@@ -428,8 +427,7 @@
/* peek at the next char */
unsigned char next_char = str[pos];
if ((next_char >= 0x40 && next_char <= 0x73) ||
-   (next_char >= 0xa1 && 
next_char <= 0xfe))
-   {
+   (next_char >= 0xa1 && 
+next_char <= 0xfe)) {
/* yes, this a wide char */
this_char <<= 8;
MB_WRITE(next_char);
@@ -467,8 +465,7 @@
if (this_char >= 0xa1 && this_char <= 0xfe) {
/* peek at the next char */
unsigned char next_char = str[pos];
-   if (next_char >= 0xa1 && next_char <= 0xfe)
-   {
+   if (next_char >= 0xa1 && next_char <= 0xfe) {
/* yes, this a jis kanji char */
this_char <<= 8;
MB_WRITE(next_char);
@@ -479,8 +476,7 @@
} else if (this_char == 0x8e) {
/* peek at the next char */
unsigned char next_char = str[pos];
-   if (next_char >= 0xa1 && next_char <= 0xdf)
-   {
+   if (next_char >= 0xa1 && next_char <= 0xdf) {
/* JIS X 0201 kana */
this_char <<= 8;
MB_WRITE(next_char);
@@ -493,8 +489,7 @@
unsigned char next_char = str[pos];
unsigned char next2_char = str[pos+1];
if ((next_char >= 0xa1 && next_char <= 0xfe) &&
-   (next2_char >= 0xa1 && next2_char <= 
0xfe))
-   {
+   (next2_char >= 0xa1 && next2_char <= 
+0xfe)) {
/* JIS X 0212 hojo-kanji */
this_char <<= 8;
MB_WRITE(next_char);
@@ -510,9 +505,7 @@
break;
}
default:
-   {
-   break;
-   }
+   break;
 

[PHP-CVS] cvs: php4 /ext/standard html.c html.h /ext/wddx php_wddx_api.h wddx.c

2002-09-26 Thread Sebastian Bergmann

sebastian   Thu Sep 26 14:13:32 2002 EDT

  Modified files:  
/php4/ext/standard  html.c html.h 
/php4/ext/wddx  php_wddx_api.h wddx.c 
  Log:
  Fix ZTS build.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.52 php4/ext/standard/html.c:1.53
--- php4/ext/standard/html.c:1.52   Thu Sep 26 12:07:14 2002
+++ php4/ext/standard/html.cThu Sep 26 14:13:32 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.52 2002/09/26 16:07:14 wez Exp $ */
+/* $Id: html.c,v 1.53 2002/09/26 18:13:32 sebastian Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -595,12 +595,12 @@
 
 /* {{{ php_unescape_html_entities
  */
-PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *newlen, 
int all, int quote_style, char *hint_charset)
+PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *newlen, 
+int all, int quote_style, char *hint_charset TSRMLS_DC)
 {
int retlen;
int j, k;
char *replaced, *ret;
-   enum entity_charset charset = determine_charset(hint_charset);
+   enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC);
unsigned char replacement[15];

ret = estrdup(old);
@@ -663,11 +663,11 @@
 
 /* {{{ php_escape_html_entities
  */
-PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, 
int all, int quote_style, char *hint_charset)
+PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, 
+int all, int quote_style, char *hint_charset TSRMLS_DC)
 {
int i, j, maxlen, len;
char *replaced;
-   enum entity_charset charset = determine_charset(hint_charset);
+   enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC);
int matches_map;
 
maxlen = 2 * oldlen;
@@ -766,7 +766,7 @@
return;
}
 
-   replaced = php_escape_html_entities(str, str_len, &len, all, quote_style, 
hint_charset);
+   replaced = php_escape_html_entities(str, str_len, &len, all, quote_style, 
+hint_charset TSRMLS_CC);
RETVAL_STRINGL(replaced, len, 0);
 }
 /* }}} */
@@ -807,7 +807,7 @@
return;
}
 
-   replaced = php_unescape_html_entities(str, str_len, &len, 1, quote_style, 
hint_charset);
+   replaced = php_unescape_html_entities(str, str_len, &len, 1, quote_style, 
+hint_charset TSRMLS_CC);
RETVAL_STRINGL(replaced, len, 0);
 }
 /* }}} */
@@ -828,7 +828,7 @@
int which = HTML_SPECIALCHARS, quote_style = ENT_COMPAT;
int i, j;
char ind[2];
-   enum entity_charset charset = determine_charset(NULL);
+   enum entity_charset charset = determine_charset(NULL TSRMLS_CC);
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &which, 
"e_style) == FAILURE) {
return;
Index: php4/ext/standard/html.h
diff -u php4/ext/standard/html.h:1.14 php4/ext/standard/html.h:1.15
--- php4/ext/standard/html.h:1.14   Fri Mar 15 20:34:52 2002
+++ php4/ext/standard/html.hThu Sep 26 14:13:32 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: html.h,v 1.14 2002/03/16 01:34:52 wez Exp $ */
+/* $Id: html.h,v 1.15 2002/09/26 18:13:32 sebastian Exp $ */
 
 #ifndef HTML_H
 #define HTML_H
@@ -36,6 +36,6 @@
 PHP_FUNCTION(html_entity_decode);
 PHP_FUNCTION(get_html_translation_table);
 
-PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, 
int all, int quote_style, char *hint_charset);
+PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, 
+int all, int quote_style, char *hint_charset TSRMLS_DC);
 
 #endif /* HTML_H */
Index: php4/ext/wddx/php_wddx_api.h
diff -u php4/ext/wddx/php_wddx_api.h:1.16 php4/ext/wddx/php_wddx_api.h:1.17
--- php4/ext/wddx/php_wddx_api.h:1.16   Tue Dec 11 10:30:50 2001
+++ php4/ext/wddx/php_wddx_api.hThu Sep 26 14:13:32 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_wddx_api.h,v 1.16 2001/12/11 15:30:50 sebastian Exp $ */
+/* $Id: php_wddx_api.h,v 1.17 2002/09/26 18:13:32 sebastian Exp $ */
 
 #ifndef PHP_WDDX_API_H
 #define PHP_WDDX_API_H
@@ -59,7 +59,7 @@
 voidphp_wddx_packet_start(wddx_packet *packet, char *comment, int 
comment_len);
 voidphp_wddx_packet_end(wddx_packet *packet);
 
-voidphp_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, 
int name_len);
+voidphp_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, 
+int name_len TSRMLS_DC);
 int php_wddx_deserialize_ex(char *, int, zval *return_value);
 #define php_wddx_gather(packet) estrndup(packet->c, packet->len)
 
Index: php4/ext/wddx/wddx.c
diff -u php4/ext/wddx/wddx.c:1.93 php4/ext/wddx/wddx.c:1.94
--- php4/ext/wddx/wddx.c:1.93  

[PHP-CVS] cvs: php4 /ext/standard html.c

2002-09-26 Thread Wez Furlong

wez Thu Sep 26 12:07:14 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Emit a warning when an unsupported charset is requested in htmlentities.
  Fixed #18521.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.51 php4/ext/standard/html.c:1.52
--- php4/ext/standard/html.c:1.51   Tue Sep 24 06:05:45 2002
+++ php4/ext/standard/html.cThu Sep 26 12:07:14 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.51 2002/09/24 10:05:45 wez Exp $ */
+/* $Id: html.c,v 1.52 2002/09/26 16:07:14 wez Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -521,7 +521,7 @@
 /* {{{ entity_charset determine_charset
  * returns the charset identifier based on current locale or a hint.
  * defaults to iso-8859-1 */
-static enum entity_charset determine_charset(char *charset_hint)
+static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
 {
int i;
enum entity_charset charset = cs_8859_1;
@@ -572,13 +572,21 @@
 #endif
}
if (charset_hint)   {
-   if(!len) len = strlen(charset_hint);
+   int found = 0;
+   if (!len)
+   len = strlen(charset_hint);
+   
/* 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){
charset = charset_map[i].charset;
+   found = 1;
break;
}
+   }
+   if (!found) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "charset `%s' not 
+supported, assuming iso-8859-1",
+   charset_hint);
}
}
return charset;



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




[PHP-CVS] cvs: php4 /ext/standard html.c

2002-09-24 Thread Wez Furlong

wez Tue Sep 24 06:05:46 2002 EDT

  Modified files:  
/php4/ext/standard  html.c 
  Log:
  Fix for #19570: last character in translation table is omitted.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.50 php4/ext/standard/html.c:1.51
--- php4/ext/standard/html.c:1.50   Wed Aug 28 18:14:42 2002
+++ php4/ext/standard/html.cTue Sep 24 06:05:45 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.50 2002/08/28 22:14:42 rasmus Exp $ */
+/* $Id: html.c,v 1.51 2002/09/24 10:05:45 wez Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -835,7 +835,7 @@
for (j=0; entity_map[j].charset != cs_terminator; j++)  {
if (entity_map[j].charset != charset)
continue;
-   for (i = 0; i < entity_map[j].endchar - 
entity_map[j].basechar; i++)
+   for (i = 0; i <= entity_map[j].endchar - 
+entity_map[j].basechar; i++)
{
char buffer[16];
 



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