[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c trunk/sapi/fpm/fpm/fpm_main.c

2011-07-18 Thread Jérôme Loyet
fat  Mon, 18 Jul 2011 21:03:44 +

Revision: http://svn.php.net/viewvc?view=revision&revision=313405

Log:
fix a segfault when passing an empty value to a ini parameter from the web 
server (php_(admin_)?value)

Changed paths:
U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
U   php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c
U   php/php-src/trunk/sapi/fpm/fpm/fpm_main.c

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
===
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-07-18 
21:00:59 UTC (rev 313404)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-07-18 
21:03:44 UTC (rev 313405)
@@ -1430,22 +1430,28 @@
 static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int 
callback_type, void *arg TSRMLS_DC) /* {{{ */
 {
int *mode = (int *)arg;
-   char *key = Z_STRVAL_P(arg1);
-   char *value = Z_STRVAL_P(arg2);
+   char *key;
+   char *value = NULL;
struct key_value_s kv;

-   if (!mode) return;
+   if (!mode || !arg1) return;

if (callback_type != ZEND_INI_PARSER_ENTRY) {
fprintf(stderr, "Passing INI directive through FastCGI: only 
classic entries are allowed\n");
return;
}

+   key = Z_STRVAL_P(arg1);
+
if (!key || strlen(key) < 1) {
fprintf(stderr, "Passing INI directive through FastCGI: empty 
key\n");
return;
}

+   if (arg2) {
+   value = Z_STRVAL_P(arg2);
+   }
+
if (!value) {
fprintf(stderr, "Passing INI directive through FastCGI: empty 
value for key '%s'\n", key);
return;

Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c
===
--- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-07-18 
21:00:59 UTC (rev 313404)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-07-18 
21:03:44 UTC (rev 313405)
@@ -1327,22 +1327,28 @@
 static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int 
callback_type, void *arg TSRMLS_DC) /* {{{ */
 {
int *mode = (int *)arg;
-   char *key = Z_STRVAL_P(arg1);
-   char *value = Z_STRVAL_P(arg2);
+   char *key;
+   char *value = NULL;
struct key_value_s kv;

-   if (!mode) return;
+   if (!mode || !arg1) return;

if (callback_type != ZEND_INI_PARSER_ENTRY) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: only 
classic entries are allowed");
return;
}

+   key = Z_STRVAL_P(arg1);
+
if (!key || strlen(key) < 1) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty 
key");
return;
}

+   if (arg2) {
+   value = Z_STRVAL_P(arg2);
+   }
+
if (!value) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty 
value for key '%s'", key);
return;

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_main.c
===
--- php/php-src/trunk/sapi/fpm/fpm/fpm_main.c   2011-07-18 21:00:59 UTC (rev 
313404)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_main.c   2011-07-18 21:03:44 UTC (rev 
313405)
@@ -1327,22 +1327,28 @@
 static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int 
callback_type, void *arg TSRMLS_DC) /* {{{ */
 {
int *mode = (int *)arg;
-   char *key = Z_STRVAL_P(arg1);
-   char *value = Z_STRVAL_P(arg2);
+   char *key;
+   char *value = NULL;
struct key_value_s kv;

-   if (!mode) return;
+   if (!mode || !arg1) return;

if (callback_type != ZEND_INI_PARSER_ENTRY) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: only 
classic entries are allowed");
return;
}

+   key = Z_STRVAL_P(arg1);
+
if (!key || strlen(key) < 1) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty 
key");
return;
}

+   if (arg2) {
+   value = Z_STRVAL_P(arg2);
+   }
+
if (!value) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty 
value for key '%s'", key);
return;

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS main/php_ini.c

2011-07-18 Thread Pierre Joye
pajoye   Mon, 18 Jul 2011 21:00:59 +

Revision: http://svn.php.net/viewvc?view=revision&revision=313404

Log:
- MFH: Fixed bug #54204 (Can't set a value with a PATH section in php.ini).

Bug: https://bugs.php.net/54204 (Assigned) Can't set a value with a PATH 
section in php.ini
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/main/php_ini.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2011-07-18 20:59:18 UTC (rev 313403)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-07-18 21:00:59 UTC (rev 313404)
@@ -14,6 +14,8 @@
(Pierre)
   . Fixed bug #55014 (Compile failure due to improper use of ctime_r()). (Ilia)
   . Fixed bug #54332 (Crash in zend_mm_check_ptr // Heap corruption). (Dmitry)
+  . Fixed bug #54204 (Can't set a value with a PATH section in php.ini).
+(Pierre)
   . Fixed bug #54305 (Crash in gc_remove_zval_from_buffer). (Dmitry)
   . Fixed bug #53727 (Inconsistent behavior of is_subclass_of with interfaces)
 (Ralph Schindler, Dmitry)

Modified: php/php-src/branches/PHP_5_3/main/php_ini.c
===
--- php/php-src/branches/PHP_5_3/main/php_ini.c 2011-07-18 20:59:18 UTC (rev 
313403)
+++ php/php-src/branches/PHP_5_3/main/php_ini.c 2011-07-18 21:00:59 UTC (rev 
313404)
@@ -832,7 +832,7 @@

 #if PHP_WIN32
memcpy(path_bak, path, path_len);
-   path_bak[path_len - 1] = 0;
+   path_bak[path_len] = 0;
TRANSLATE_SLASHES_LOWER(path_bak);
path = path_bak;
 #endif

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fastcgi.c

2011-07-18 Thread Jérôme Loyet
fat  Mon, 18 Jul 2011 20:59:18 +

Revision: http://svn.php.net/viewvc?view=revision&revision=313403

Log:
remove forgotten debug log

Changed paths:
U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c
===
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-07-18 20:38:57 UTC 
(rev 313402)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-07-18 20:59:18 UTC 
(rev 313403)
@@ -508,7 +508,6 @@
ret = 0;
break;
}
-   zlog(ZLOG_DEBUG, "%s=%s", tmp, s);
zend_hash_update(req->env, tmp, eff_name_len+1, &s, 
sizeof(char*), NULL);
p += name_len + val_len;
}

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

[PHP-CVS] svn: /SVNROOT/ global_avail

2011-07-18 Thread Pierre Joye
pajoye   Mon, 18 Jul 2011 17:08:51 +

Revision: http://svn.php.net/viewvc?view=revision&revision=313397

Log:
- give Ryan tests karma

Changed paths:
U   SVNROOT/global_avail

Modified: SVNROOT/global_avail
===
--- SVNROOT/global_avail2011-07-18 16:54:59 UTC (rev 313396)
+++ SVNROOT/global_avail2011-07-18 17:08:51 UTC (rev 313397)
@@ -243,7 +243,7 @@
 avail|val|pecl/bcompiler,phpdoc
 avail|simenec,ttk|pecl/maxdb,phpdoc/en/reference
 avail|ksadlocha|pecl/simplesql
-avail|eyalt,michael,tomerc,rdohms,wimartin,odoucet,danielc,jmfontaine,jeraimee,tyrael,shein,dtajchreber|php/php-src/*/tests,phpdoc
+avail|eyalt,michael,tomerc,rdohms,wimartin,odoucet,danielc,jmfontaine,jeraimee,tyrael,shein,dtajchreber,yaauie|php/php-src/*/tests,phpdoc
 avail|blindman|pecl/colorer
 avail|mike|pecl/http
 avail|gabe|pecl/intercept

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

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/mbstring/ libmbfl/mbfl/mbfilter.c mbstring.c

2011-07-18 Thread Christopher Jones


And update NEWS too... :)

On 7/18/11 1:41 AM, Pierre Joye wrote:

hi Rui!

It would rock if you could use a sparse checkout and commits :)

Thanks,

On Mon, Jul 18, 2011 at 10:21 AM, Rui Hirokawa  wrote:

hirokawa Mon, 18 Jul 2011 08:21:48 +

Revision: http://svn.php.net/viewvc?view=revision&revision=313365

Log:
added numeric entities encode/decode in hex format.

Changed paths:
U   php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c
U   php/php-src/branches/PHP_5_4/ext/mbstring/mbstring.c

Modified: php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c
===
--- php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c   
2011-07-18 07:55:03 UTC (rev 313364)
+++ php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c   
2011-07-18 08:21:48 UTC (rev 313365)
@@ -2746,7 +2746,9 @@
}
break;
case 2:
-   if (c>= 0x30&&  c<= 0x39) {   /* '0' - '9' */
+   if (c == 0x78) {/* 'x' */
+   pc->status = 4;
+   } else if (c>= 0x30&&  c<= 0x39) { /* '0' - '9' */
pc->cache = c - 0x30;
pc->status = 3;
pc->digit = 1;
@@ -2810,6 +2812,89 @@
(*pc->decoder->filter_function)(c, pc->decoder);
}
break;
+   case 4:
+   if (c>= 0x30&&  c<= 0x39) { /* '0' - '9' */
+   pc->cache = c - 0x30;
+   pc->status = 5;
+   pc->digit = 1;
+   } else if (c>= 0x41&&  c<= 0x46) { /* 'A' - 'F'  */
+   pc->cache = c - 0x41 + 10;
+   pc->status = 5;
+   pc->digit = 1;
+   } else if (c>= 0x61&&  c<= 0x66) { /* 'a' - 'f'  */
+   pc->cache = c - 0x61 + 10;
+   pc->status = 5;
+   pc->digit = 1;
+   } else {
+   pc->status = 0;
+   (*pc->decoder->filter_function)(0x26, pc->decoder); 
/* '&' */
+   (*pc->decoder->filter_function)(0x23, pc->decoder); 
/* '#' */
+   (*pc->decoder->filter_function)(0x78, pc->decoder); 
/* 'x' */
+   (*pc->decoder->filter_function)(c, pc->decoder);
+   }
+   break;
+   case 5:
+   s = 0;
+   f = 0;
+   if ((c>= 0x30&&  c<= 0x39) ||
+   (c>= 0x41&&  c<= 0x46) ||
+   (c>= 0x61&&  c<= 0x66)) { /* '0' - '9' or 'a' - 'f' 
 */
+   if (pc->digit>  9) {
+   pc->status = 0;
+   s = pc->cache;
+   f = 1;
+   } else {
+   if (c>= 0x30&&  c<= 0x39) {
+   s = pc->cache*16 + (c - 0x30);
+   } else if (c>= 0x41&&  c<= 0x46)  {
+   s = pc->cache*16 + (c - 0x41 + 10);
+   } else {
+   s = pc->cache*16 + (c - 0x61 + 10);
+   }
+   pc->cache = s;
+   pc->digit++;
+   }
+   } else {
+   pc->status = 0;
+   s = pc->cache;
+   f = 1;
+   n = 0;
+   size = pc->mapsize;
+   while (n<  size) {
+   mapelm =&(pc->convmap[n*4]);
+   d = s - mapelm[2];
+   if (d>= mapelm[0]&&  d<= mapelm[1]) {
+   f = 0;
+   (*pc->decoder->filter_function)(d, 
pc->decoder);
+   if (c != 0x3b) {/* ';' */
+   (*pc->decoder->filter_function)(c, 
pc->decoder);
+   }
+   break;
+   }
+   n++;
+   }
+   }
+   if (f) {
+   (*pc->decoder->filter_function)(0x26, pc->decoder); 
/* '&' */
+   (*pc->decoder->filter_function)(0x23, pc->decoder); 
/* '#' */
+   (*pc->decoder->filter_function)(0x78, pc->decoder); 
/* 'x' */
+   r = 1;
+   n = pc->digit;
+   while (n>  0) {
+   r *= 16;
+   

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/win32/build/config.w32 trunk/win32/build/config.w32

2011-07-18 Thread Pierre Joye
pajoye   Mon, 18 Jul 2011 12:00:08 +

Revision: http://svn.php.net/viewvc?view=revision&revision=313379

Log:
- not a good idea after all and did not do what I thought it should do

Changed paths:
U   php/php-src/branches/PHP_5_4/win32/build/config.w32
U   php/php-src/trunk/win32/build/config.w32

Modified: php/php-src/branches/PHP_5_4/win32/build/config.w32
===
--- php/php-src/branches/PHP_5_4/win32/build/config.w32 2011-07-18 11:05:10 UTC 
(rev 313378)
+++ php/php-src/branches/PHP_5_4/win32/build/config.w32 2011-07-18 12:00:08 UTC 
(rev 313379)
@@ -151,7 +151,6 @@
// Set some debug/release specific options
ADD_FLAG('CFLAGS', ' /RTC1 ');
}
-   ADD_FLAG('CFLAGS', ' /D_BIND_TO_CURRENT_CRT_VERSION=1 ');
 }

 ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for 
compilation', 'auto');

Modified: php/php-src/trunk/win32/build/config.w32
===
--- php/php-src/trunk/win32/build/config.w322011-07-18 11:05:10 UTC (rev 
313378)
+++ php/php-src/trunk/win32/build/config.w322011-07-18 12:00:08 UTC (rev 
313379)
@@ -151,7 +151,6 @@
// Set some debug/release specific options
ADD_FLAG('CFLAGS', ' /RTC1 ');
}
-   ADD_FLAG('CFLAGS', ' /D_BIND_TO_CURRENT_CRT_VERSION=1 ');
 }

 ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for 
compilation', 'auto');

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/main/php_ini.c trunk/main/php_ini.c

2011-07-18 Thread Pierre Joye
pajoye   Mon, 18 Jul 2011 10:25:36 +

Revision: http://svn.php.net/viewvc?view=revision&revision=313371

Log:
- fix bug #54204, Can't set a value with a PATH section in php.ini

Bug: https://bugs.php.net/54204 (Assigned) Can't set a value with a PATH 
section in php.ini
  
Changed paths:
U   php/php-src/branches/PHP_5_4/main/php_ini.c
U   php/php-src/trunk/main/php_ini.c

Modified: php/php-src/branches/PHP_5_4/main/php_ini.c
===
--- php/php-src/branches/PHP_5_4/main/php_ini.c 2011-07-18 10:19:23 UTC (rev 
313370)
+++ php/php-src/branches/PHP_5_4/main/php_ini.c 2011-07-18 10:25:36 UTC (rev 
313371)
@@ -828,7 +828,7 @@

 #if PHP_WIN32
memcpy(path_bak, path, path_len);
-   path_bak[path_len - 1] = 0;
+   path_bak[path_len] = 0;
TRANSLATE_SLASHES_LOWER(path_bak);
path = path_bak;
 #endif

Modified: php/php-src/trunk/main/php_ini.c
===
--- php/php-src/trunk/main/php_ini.c2011-07-18 10:19:23 UTC (rev 313370)
+++ php/php-src/trunk/main/php_ini.c2011-07-18 10:25:36 UTC (rev 313371)
@@ -828,7 +828,7 @@

 #if PHP_WIN32
memcpy(path_bak, path, path_len);
-   path_bak[path_len - 1] = 0;
+   path_bak[path_len] = 0;
TRANSLATE_SLASHES_LOWER(path_bak);
path = path_bak;
 #endif

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

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/mbstring/ libmbfl/mbfl/mbfilter.c mbstring.c

2011-07-18 Thread Pierre Joye
hi Rui!

It would rock if you could use a sparse checkout and commits :)

Thanks,

On Mon, Jul 18, 2011 at 10:21 AM, Rui Hirokawa  wrote:
> hirokawa                                 Mon, 18 Jul 2011 08:21:48 +
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=313365
>
> Log:
> added numeric entities encode/decode in hex format.
>
> Changed paths:
>    U   php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c
>    U   php/php-src/branches/PHP_5_4/ext/mbstring/mbstring.c
>
> Modified: php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c
> ===
> --- php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c   
> 2011-07-18 07:55:03 UTC (rev 313364)
> +++ php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c   
> 2011-07-18 08:21:48 UTC (rev 313365)
> @@ -2746,7 +2746,9 @@
>                }
>                break;
>        case 2:
> -               if (c >= 0x30 && c <= 0x39) {   /* '0' - '9' */
> +               if (c == 0x78) {        /* 'x' */
> +                       pc->status = 4;
> +               } else if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
>                        pc->cache = c - 0x30;
>                        pc->status = 3;
>                        pc->digit = 1;
> @@ -2810,6 +2812,89 @@
>                        (*pc->decoder->filter_function)(c, pc->decoder);
>                }
>                break;
> +       case 4:
> +               if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
> +                       pc->cache = c - 0x30;
> +                       pc->status = 5;
> +                       pc->digit = 1;
> +               } else if (c >= 0x41 && c <= 0x46) { /* 'A' - 'F'  */
> +                       pc->cache = c - 0x41 + 10;
> +                       pc->status = 5;
> +                       pc->digit = 1;
> +               } else if (c >= 0x61 && c <= 0x66) { /* 'a' - 'f'  */
> +                       pc->cache = c - 0x61 + 10;
> +                       pc->status = 5;
> +                       pc->digit = 1;
> +               } else {
> +                       pc->status = 0;
> +                       (*pc->decoder->filter_function)(0x26, pc->decoder);   
>           /* '&' */
> +                       (*pc->decoder->filter_function)(0x23, pc->decoder);   
>           /* '#' */
> +                       (*pc->decoder->filter_function)(0x78, pc->decoder);   
>           /* 'x' */
> +                       (*pc->decoder->filter_function)(c, pc->decoder);
> +               }
> +               break;
> +       case 5:
> +               s = 0;
> +               f = 0;
> +               if ((c >= 0x30 && c <= 0x39) ||
> +                       (c >= 0x41 && c <= 0x46) ||
> +                       (c >= 0x61 && c <= 0x66)) {     /* '0' - '9' or 'a' - 
> 'f'  */
> +                       if (pc->digit > 9) {
> +                               pc->status = 0;
> +                               s = pc->cache;
> +                               f = 1;
> +                       } else {
> +                               if (c >= 0x30 && c <= 0x39) {
> +                                       s = pc->cache*16 + (c - 0x30);
> +                               } else if (c >= 0x41 && c <= 0x46)  {
> +                                       s = pc->cache*16 + (c - 0x41 + 10);
> +                               } else {
> +                                       s = pc->cache*16 + (c - 0x61 + 10);
> +                               }
> +                               pc->cache = s;
> +                               pc->digit++;
> +                       }
> +               } else {
> +                       pc->status = 0;
> +                       s = pc->cache;
> +                       f = 1;
> +                       n = 0;
> +                       size = pc->mapsize;
> +                       while (n < size) {
> +                               mapelm = &(pc->convmap[n*4]);
> +                               d = s - mapelm[2];
> +                               if (d >= mapelm[0] && d <= mapelm[1]) {
> +                                       f = 0;
> +                                       (*pc->decoder->filter_function)(d, 
> pc->decoder);
> +                                       if (c != 0x3b) {        /* ';' */
> +                                               
> (*pc->decoder->filter_function)(c, pc->decoder);
> +                                       }
> +                                       break;
> +                               }
> +                               n++;
> +                       }
> +               }
> +               if (f) {
> +                       (*pc->decoder->filter_function)(0x26, pc->decoder);   
>           /* '&' */
> +                       (*pc->decoder->filter_function)(0x23, pc->decoder);   
>           /* '#' */
> +                       (*pc->decoder->filter_function)(0x78, pc->decoder);   
>           /* 'x' */
> +                    

[PHP-CVS] svn: /php/php-src/trunk/ext/mbstring/ libmbfl/mbfl/mbfilter.c mbstring.c

2011-07-18 Thread Rui Hirokawa
hirokawa Mon, 18 Jul 2011 08:36:17 +

Revision: http://svn.php.net/viewvc?view=revision&revision=313366

Log:
added numeric entities encode/decode in hex format.

Changed paths:
U   php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfilter.c
U   php/php-src/trunk/ext/mbstring/mbstring.c

Modified: php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfilter.c
===
--- php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfilter.c  2011-07-18 
08:21:48 UTC (rev 313365)
+++ php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfilter.c  2011-07-18 
08:36:17 UTC (rev 313366)
@@ -2746,7 +2746,9 @@
}
break;
case 2:
-   if (c >= 0x30 && c <= 0x39) {   /* '0' - '9' */
+   if (c == 0x78) {/* 'x' */
+   pc->status = 4;
+   } else if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
pc->cache = c - 0x30;
pc->status = 3;
pc->digit = 1;
@@ -2810,6 +2812,89 @@
(*pc->decoder->filter_function)(c, pc->decoder);
}
break;
+   case 4:
+   if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
+   pc->cache = c - 0x30;
+   pc->status = 5;
+   pc->digit = 1;
+   } else if (c >= 0x41 && c <= 0x46) { /* 'A' - 'F'  */
+   pc->cache = c - 0x41 + 10;
+   pc->status = 5;
+   pc->digit = 1;
+   } else if (c >= 0x61 && c <= 0x66) { /* 'a' - 'f'  */
+   pc->cache = c - 0x61 + 10;
+   pc->status = 5;
+   pc->digit = 1;
+   } else {
+   pc->status = 0;
+   (*pc->decoder->filter_function)(0x26, pc->decoder); 
/* '&' */
+   (*pc->decoder->filter_function)(0x23, pc->decoder); 
/* '#' */
+   (*pc->decoder->filter_function)(0x78, pc->decoder); 
/* 'x' */
+   (*pc->decoder->filter_function)(c, pc->decoder);
+   }
+   break;
+   case 5:
+   s = 0;
+   f = 0;
+   if ((c >= 0x30 && c <= 0x39) ||
+   (c >= 0x41 && c <= 0x46) ||
+   (c >= 0x61 && c <= 0x66)) { /* '0' - '9' or 'a' - 
'f'  */
+   if (pc->digit > 9) {
+   pc->status = 0;
+   s = pc->cache;
+   f = 1;
+   } else {
+   if (c >= 0x30 && c <= 0x39) {
+   s = pc->cache*16 + (c - 0x30);
+   } else if (c >= 0x41 && c <= 0x46)  {
+   s = pc->cache*16 + (c - 0x41 + 10);
+   } else {
+   s = pc->cache*16 + (c - 0x61 + 10);
+   }
+   pc->cache = s;
+   pc->digit++;
+   }
+   } else {
+   pc->status = 0;
+   s = pc->cache;
+   f = 1;
+   n = 0;
+   size = pc->mapsize;
+   while (n < size) {
+   mapelm = &(pc->convmap[n*4]);
+   d = s - mapelm[2];
+   if (d >= mapelm[0] && d <= mapelm[1]) {
+   f = 0;
+   (*pc->decoder->filter_function)(d, 
pc->decoder);
+   if (c != 0x3b) {/* ';' */
+   
(*pc->decoder->filter_function)(c, pc->decoder);
+   }
+   break;
+   }
+   n++;
+   }
+   }
+   if (f) {
+   (*pc->decoder->filter_function)(0x26, pc->decoder); 
/* '&' */
+   (*pc->decoder->filter_function)(0x23, pc->decoder); 
/* '#' */
+   (*pc->decoder->filter_function)(0x78, pc->decoder); 
/* 'x' */
+   r = 1;
+   n = pc->digit;
+   while (n > 0) {
+   r *= 16;
+   n--;
+   }
+   s %= r;
+   r /= 16;
+   while (r > 0) {
+   d = s/r;
+   s %= r;
+

[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/mbstring/ libmbfl/mbfl/mbfilter.c mbstring.c

2011-07-18 Thread Rui Hirokawa
hirokawa Mon, 18 Jul 2011 08:21:48 +

Revision: http://svn.php.net/viewvc?view=revision&revision=313365

Log:
added numeric entities encode/decode in hex format.

Changed paths:
U   php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c
U   php/php-src/branches/PHP_5_4/ext/mbstring/mbstring.c

Modified: php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c
===
--- php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c   
2011-07-18 07:55:03 UTC (rev 313364)
+++ php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/mbfl/mbfilter.c   
2011-07-18 08:21:48 UTC (rev 313365)
@@ -2746,7 +2746,9 @@
}
break;
case 2:
-   if (c >= 0x30 && c <= 0x39) {   /* '0' - '9' */
+   if (c == 0x78) {/* 'x' */
+   pc->status = 4;
+   } else if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
pc->cache = c - 0x30;
pc->status = 3;
pc->digit = 1;
@@ -2810,6 +2812,89 @@
(*pc->decoder->filter_function)(c, pc->decoder);
}
break;
+   case 4:
+   if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
+   pc->cache = c - 0x30;
+   pc->status = 5;
+   pc->digit = 1;
+   } else if (c >= 0x41 && c <= 0x46) { /* 'A' - 'F'  */
+   pc->cache = c - 0x41 + 10;
+   pc->status = 5;
+   pc->digit = 1;
+   } else if (c >= 0x61 && c <= 0x66) { /* 'a' - 'f'  */
+   pc->cache = c - 0x61 + 10;
+   pc->status = 5;
+   pc->digit = 1;
+   } else {
+   pc->status = 0;
+   (*pc->decoder->filter_function)(0x26, pc->decoder); 
/* '&' */
+   (*pc->decoder->filter_function)(0x23, pc->decoder); 
/* '#' */
+   (*pc->decoder->filter_function)(0x78, pc->decoder); 
/* 'x' */
+   (*pc->decoder->filter_function)(c, pc->decoder);
+   }
+   break;
+   case 5:
+   s = 0;
+   f = 0;
+   if ((c >= 0x30 && c <= 0x39) ||
+   (c >= 0x41 && c <= 0x46) ||
+   (c >= 0x61 && c <= 0x66)) { /* '0' - '9' or 'a' - 
'f'  */
+   if (pc->digit > 9) {
+   pc->status = 0;
+   s = pc->cache;
+   f = 1;
+   } else {
+   if (c >= 0x30 && c <= 0x39) {
+   s = pc->cache*16 + (c - 0x30);
+   } else if (c >= 0x41 && c <= 0x46)  {
+   s = pc->cache*16 + (c - 0x41 + 10);
+   } else {
+   s = pc->cache*16 + (c - 0x61 + 10);
+   }
+   pc->cache = s;
+   pc->digit++;
+   }
+   } else {
+   pc->status = 0;
+   s = pc->cache;
+   f = 1;
+   n = 0;
+   size = pc->mapsize;
+   while (n < size) {
+   mapelm = &(pc->convmap[n*4]);
+   d = s - mapelm[2];
+   if (d >= mapelm[0] && d <= mapelm[1]) {
+   f = 0;
+   (*pc->decoder->filter_function)(d, 
pc->decoder);
+   if (c != 0x3b) {/* ';' */
+   
(*pc->decoder->filter_function)(c, pc->decoder);
+   }
+   break;
+   }
+   n++;
+   }
+   }
+   if (f) {
+   (*pc->decoder->filter_function)(0x26, pc->decoder); 
/* '&' */
+   (*pc->decoder->filter_function)(0x23, pc->decoder); 
/* '#' */
+   (*pc->decoder->filter_function)(0x78, pc->decoder); 
/* 'x' */
+   r = 1;
+   n = pc->digit;
+   while (n > 0) {
+   r *= 16;
+   n--;
+   }
+   s %= r;
+   r /= 16;
+   while (r > 0) {
+   d = s/r;