[PHP-CVS] com php-src: Fixed bug #65338 (Enabling both php_opcache and php_wincache AVs on shutdown).: NEWS ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h ext/opcache/zend_accelerator_mod

2013-07-30 Thread Dmitry Stogov
Commit:3550f3d0aad6e979e2a6fe3ee40d4fbff168c34b
Author:Dmitry Stogov dmi...@zend.com Tue, 30 Jul 2013 17:35:19 
+0400
Parents:   ae5e70afac265e6b113d7995bb10479ee2565aba
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=3550f3d0aad6e979e2a6fe3ee40d4fbff168c34b

Log:
Fixed bug #65338 (Enabling both php_opcache and php_wincache AVs on shutdown).

Bugs:
https://bugs.php.net/65338

Changed paths:
  M  NEWS
  M  ext/opcache/ZendAccelerator.c
  M  ext/opcache/ZendAccelerator.h
  M  ext/opcache/zend_accelerator_module.c


Diff:
diff --git a/NEWS b/NEWS
index 57b523e..d21126d 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ PHP  
  NEWS
   . Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
 limited case). (Arpad)
 
+- OPcahce:
+  . Fixed bug #65338 (Enabling both php_opcache and php_wincache AVs on
+shutdown). (Dmitry)
+
 - PDO_mysql:
   . Fixed bug #65299 (pdo mysql parsing errors). (Johannes)
 
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 76a3320..b5474c0 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2656,12 +2656,9 @@ static void accel_free_ts_resources()
 #endif
 }
 
-static void accel_shutdown(zend_extension *extension)
+void accel_shutdown(TSRMLS_D)
 {
zend_ini_entry *ini_entry;
-   TSRMLS_FETCH();
-
-   (void)extension; /* keep the compiler happy */
 
zend_accel_blacklist_shutdown(accel_blacklist);
 
@@ -2679,6 +2676,11 @@ static void accel_shutdown(zend_extension *extension)
}
 
 #if ZEND_EXTENSION_API_NO  PHP_5_3_X_API_NO
+# ifndef ZTS
+   zend_hash_clean(CG(function_table));
+   zend_hash_clean(CG(class_table));
+   zend_hash_clean(EG(zend_constants));
+# endif
CG(interned_strings_start) = orig_interned_strings_start;
CG(interned_strings_end) = orig_interned_strings_end;
zend_new_interned_string = orig_new_interned_string;
@@ -2768,7 +2770,7 @@ ZEND_EXT_API zend_extension zend_extension_entry = {
http://www.zend.com/;, /* URL */
Copyright (c) 1999-2013,  /* copyright */
accel_startup,  /* 
startup */
-   accel_shutdown, /* 
shutdown */
+   NULL,   
/* shutdown */
accel_activate, /* 
per-script activation */
accel_deactivate,   /* 
per-script deactivation */
NULL,   
/* message handler */
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index 5f414f2..57e2e7a 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -316,6 +316,7 @@ extern zend_accel_globals accel_globals;
 
 extern char *zps_api_failure_reason;
 
+void accel_shutdown(TSRMLS_D);
 void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC);
 void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason 
TSRMLS_DC);
 int  zend_accel_invalidate(const char *filename, int filename_len, zend_bool 
force TSRMLS_DC);
diff --git a/ext/opcache/zend_accelerator_module.c 
b/ext/opcache/zend_accelerator_module.c
index fa4e3d8..2287d13 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -378,6 +378,7 @@ static ZEND_MSHUTDOWN_FUNCTION(zend_accelerator)
(void)type; /* keep the compiler happy */
 
UNREGISTER_INI_ENTRIES();
+   accel_shutdown(TSRMLS_C);
return SUCCESS;
 }


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h

2013-07-30 Thread Dmitry Stogov
Commit:0aa342e903bf012efe03db1e9f1fe4ed54225e76
Author:Dmitry Stogov dmi...@zend.com Tue, 30 Jul 2013 17:36:47 
+0400
Parents:   5e1ac558c3354f98a9a5aecb5b518c46cd55357a 
3550f3d0aad6e979e2a6fe3ee40d4fbff168c34b
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=0aa342e903bf012efe03db1e9f1fe4ed54225e76

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  Fixed bug #65338 (Enabling both php_opcache and php_wincache AVs on shutdown).

Conflicts:
NEWS

Bugs:
https://bugs.php.net/65338

Changed paths:
  MM  ext/opcache/ZendAccelerator.c
  MM  ext/opcache/ZendAccelerator.h


Diff:



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



Re: [PHP-CVS] com php-src: Merge from GitHub: ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h

2013-07-30 Thread Dmitry Stogov
Hi Johannes,

I agree, this -dev suffix is annoying in PHP releases.
However, I don't see a simple way to avoid it.

I don't like to complicate PHP release process or increase OPcache version
on each release.

In my opinion, it would be good if in releases -dev would be
automatically substituted by PHP version (e.g. 7.0.3 (5.5.2) instead of
7.0.3-dev.
I hope it must be possible to do it using C preprocessor. May anyone take a
look into it and propose a patch?

Thanks. Dmitry.


On Sun, Jul 28, 2013 at 4:17 PM, Johannes Schlüter
johan...@schlueters.dewrote:

 On Sun, 2013-07-28 at 09:47 +, Dmitry Stogov wrote:
  index 733e544..5f414f2 100644
  --- a/ext/opcache/ZendAccelerator.h
  +++ b/ext/opcache/ZendAccelerator.h
  @@ -27,7 +27,7 @@
   #endif
 
   #define ACCELERATOR_PRODUCT_NAME   Zend OPcache
  -#define ACCELERATOR_VERSION 7.0.2-dev
  +#define ACCELERATOR_VERSION 7.0.3-dev

 Having -dev versions stable branches in git is problematic as we most
 likely forget to change that before a release and users get -dev
 versions. Can we either remove the -dev or properly define this in
 README.RELEASE_PROCESS?

 johannes





[PHP-CVS] com php-src: A minor fix for configure outpu (Tony): ext/opcache/config.m4

2013-07-30 Thread Dmitry Stogov
Commit:e2aba1cf9ee79ba3299ac00d7997e115b5d9eb06
Author:Dmitry Stogov dmi...@zend.com Tue, 30 Jul 2013 22:03:21 
+0400
Parents:   3550f3d0aad6e979e2a6fe3ee40d4fbff168c34b
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e2aba1cf9ee79ba3299ac00d7997e115b5d9eb06

Log:
A minor fix for configure outpu (Tony)

Changed paths:
  M  ext/opcache/config.m4


Diff:
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
index f9c38b1..61c685f 100644
--- a/ext/opcache/config.m4
+++ b/ext/opcache/config.m4
@@ -357,7 +357,9 @@ extern int lock_file;
 # endif
 #endif
 int main() { return 0; }
-], [], [AC_MSG_ERROR([Don't know how to define struct flock on this system[,] 
set --enable-opcache=no])], [])
+],
+[AC_MSG_RESULT([done])],
+[AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set 
--enable-opcache=no])], [])
   
   PHP_NEW_EXTENSION(opcache,
ZendAccelerator.c \


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



[PHP-CVS] com php-src: Improved implementation of NOP removal pass from O(n^2) to O(n) (hnw): ext/opcache/Optimizer/block_pass.c

2013-07-30 Thread Dmitry Stogov
Commit:cb17c9951182690b75f57cdf1707609a8478af6f
Author:Dmitry Stogov dmi...@zend.com Tue, 30 Jul 2013 22:31:37 
+0400
Parents:   e2aba1cf9ee79ba3299ac00d7997e115b5d9eb06
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=cb17c9951182690b75f57cdf1707609a8478af6f

Log:
Improved implementation of NOP removal pass from O(n^2) to O(n) (hnw)

Changed paths:
  M  ext/opcache/Optimizer/block_pass.c


Diff:
diff --git a/ext/opcache/Optimizer/block_pass.c 
b/ext/opcache/Optimizer/block_pass.c
index b8c3814..7f874e7 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -558,6 +558,52 @@ static void zend_rebuild_access_path(zend_cfg *cfg, 
zend_op_array *op_array, int
convert_to_string((v)); \
}
 
+static void strip_nop(zend_code_block *block)
+{
+   zend_op *opline = block-start_opline;
+   zend_op *end, *new_end;
+   int new_len = 0;
+
+   /* remove leading NOPs */
+   while (block-len  0  block-start_opline-opcode == ZEND_NOP) {
+   if (block-len == 1) {
+   /* this block is all NOPs, join with following block */
+   if (block-follow_to) {
+   delete_code_block(block);
+   }
+   return;
+   }
+   block-start_opline++;
+   block-start_opline_no++;
+   block-len--;
+   }
+
+   /* strip the inside NOPs */
+   opline = new_end = block-start_opline;
+   end = opline + block-len;
+
+   while (opline  end) {
+   zend_op *src;
+   int len = 0;
+
+   while (opline  end  opline-opcode == ZEND_NOP) {
+   opline++;
+   }
+   src = opline;
+
+   while (opline  end  opline-opcode != ZEND_NOP) {
+   opline++;
+   }
+   len = opline - src;
+
+   /* move up non-NOP opcodes */
+   memmove(new_end, src, len*sizeof(zend_op));
+
+   new_end += len;
+   }
+   block-len = new_end - block-start_opline;
+}
+
 static void zend_optimize_block(zend_code_block *block, zend_op_array 
*op_array, char *used_ext TSRMLS_DC)
 {
zend_op *opline = block-start_opline;
@@ -1168,45 +1214,7 @@ static void zend_optimize_block(zend_code_block *block, 
zend_op_array *op_array,
opline++;
}
 
-   /* remove leading NOPs */
-   while (block-len  0  block-start_opline-opcode == ZEND_NOP) {
-   if (block-len == 1) {
-   /* this block is all NOPs, join with following block */
-   if (block-follow_to) {
-   delete_code_block(block);
-   }
-   if (op_array-T) {
-   efree(Tsource);
-   }
-   return;
-   }
-   block-start_opline++;
-   block-start_opline_no++;
-   block-len--;
-   }
-
-   /* strip the inside NOPs */
-   opline = block-start_opline;
-   end = opline + block-len;
-   while (opline  end) {
-   if (opline-opcode == ZEND_NOP) {
-   zend_op *nop = opline + 1;
-   int noplen;
-   while (nop  end  nop-opcode == ZEND_NOP) {
-   nop++;
-   }
-   noplen = nop-opline;
-   if (nop  end) {
-   /* move up non-NOP opcodes */
-   memmove(opline, nop, (end-nop)*sizeof(zend_op));
-   } else {
-   /* all NOPs up to the end, do nothing */
-   }
-   block-len -= noplen;
-   end = block-start_opline + block-len;
-   }
-   opline++;
-   }
+   strip_nop(block);
 
if (op_array-T) {
efree(Tsource);


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



Re: [PHP-CVS] com php-src: Merge from GitHub: ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h

2013-07-30 Thread Stas Malyshev
Hi!

 I agree, this -dev suffix is annoying in PHP releases.
 However, I don't see a simple way to avoid it.

Can we reuse PHP_EXTRA_VERSION from php_version.h? This was dev code
will keep -dev, but releases would have no suffix. RCs would be marked
as RC but that shouldn't be a big problem I think.

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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



[PHP-CVS] com php-src: Remove tabs on blanklines in Makefile sources. This prevents a 'suspicious line' warning when editing saving Makefile using Emacs.: Makefile.global scripts/Makefile.frag

2013-07-30 Thread Christopher Jones
Commit:6af7526c77234c60c31839f21c60908a431c981e
Author:Christopher Jones s...@php.net Tue, 30 Jul 2013 13:36:10 
-0700
Parents:   0aa342e903bf012efe03db1e9f1fe4ed54225e76
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=6af7526c77234c60c31839f21c60908a431c981e

Log:
Remove tabs on blanklines in Makefile sources. This prevents a
'suspicious line' warning when editing  saving Makefile using Emacs.

Changed paths:
  M  Makefile.global
  M  scripts/Makefile.frag


Diff:
diff --git a/Makefile.global b/Makefile.global
index 5118de8..ff3bf22 100644
--- a/Makefile.global
+++ b/Makefile.global
@@ -10,7 +10,7 @@ all: $(all_targets)
@echo Build complete.
@echo Don't forget to run 'make test'.
@echo
-   
+
 build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
 
 build-binaries: $(PHP_BINARIES)
diff --git a/scripts/Makefile.frag b/scripts/Makefile.frag
index 00272b0..7cd78fa 100644
--- a/scripts/Makefile.frag
+++ b/scripts/Makefile.frag
@@ -44,7 +44,7 @@ install-programs: $(builddir)/phpize $(builddir)/php-config
echo   page: $(program_prefix)$${page}$(program_suffix).1; \
$(INSTALL_DATA) $(builddir)/man1/$${page}.1 
$(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)$${page}$(program_suffix).1; \
done
-   
+
 $(builddir)/phpize: $(srcdir)/phpize.in $(top_builddir)/config.status
(CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)


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



[PHP-CVS] com php-src: Added support for glob symbols in blacklist entries (?, *, **): NEWS ext/opcache/tests/blacklist.inc ext/opcache/tests/blacklist.phpt ext/opcache/tests/opcache-2.blacklist ext/o

2013-07-30 Thread Dmitry Stogov
Commit:02409669e4201ec2cb90f1e6df316dddbe04561e
Author:Dmitry Stogov dmi...@zend.com Wed, 31 Jul 2013 03:01:19 
+0400
Parents:   cb17c9951182690b75f57cdf1707609a8478af6f
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=02409669e4201ec2cb90f1e6df316dddbe04561e

Log:
Added support for glob symbols in blacklist entries (?, *, **)

Changed paths:
  M  NEWS
  A  ext/opcache/tests/blacklist.inc
  M  ext/opcache/tests/blacklist.phpt
  M  ext/opcache/tests/opcache-2.blacklist
  M  ext/opcache/zend_accelerator_blacklist.c


Diff:
diff --git a/NEWS b/NEWS
index d21126d..60b2760 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ PHP   
 NEWS
 limited case). (Arpad)
 
 - OPcahce:
+  . Added support for glob symbols in blacklist entries (?, *, **).
+(Terry Elison, Dmitry)
   . Fixed bug #65338 (Enabling both php_opcache and php_wincache AVs on
 shutdown). (Dmitry)
 
diff --git a/ext/opcache/tests/blacklist.inc b/ext/opcache/tests/blacklist.inc
new file mode 100644
index 000..a9db751
--- /dev/null
+++ b/ext/opcache/tests/blacklist.inc
@@ -0,0 +1,3 @@
+?php
+   echo ok\n;
+?
diff --git a/ext/opcache/tests/blacklist.phpt b/ext/opcache/tests/blacklist.phpt
index f4a3472..57e4c30 100644
--- a/ext/opcache/tests/blacklist.phpt
+++ b/ext/opcache/tests/blacklist.phpt
@@ -9,7 +9,13 @@ opcache.blacklist_filename={PWD}/opcache-*.blacklist
 --FILE--
 ?php
 $conf = opcache_get_configuration();
-print_r($conf['blacklist']);
+$conf = $conf['blacklist'];
+$conf[3] = preg_replace(!^\\Q.dirname(__FILE__).\\E!, __DIR__, 
$conf[3]); 
+$conf[4] = preg_replace(!^\\Q.dirname(__FILE__).\\E!, __DIR__, 
$conf[4]); 
+print_r($conf);
+include(blacklist.inc);
+$status = opcache_get_status();
+print_r(count($status['scripts']));
 ?
 --EXPECT--
 Array
@@ -17,4 +23,10 @@ Array
 [0] = /path/to/foo
 [1] = /path/to/foo2
 [2] = /path/to/bar
-)
\ No newline at end of file
+[3] = __DIR__/blacklist.inc
+[4] = __DIR__/current.php
+[5] = /tmp/path/?nocache.inc
+[6] = /tmp/path/*/somedir
+)
+ok
+1
diff --git a/ext/opcache/tests/opcache-2.blacklist 
b/ext/opcache/tests/opcache-2.blacklist
index 4f6580a..575d9fa 100644
--- a/ext/opcache/tests/opcache-2.blacklist
+++ b/ext/opcache/tests/opcache-2.blacklist
@@ -1 +1,6 @@
 /path/to/bar
+; wildcard and relative entires
+blacklist.inc
+./current.php
+/tmp/path/?nocache.inc
+/tmp/path/*/somedir
diff --git a/ext/opcache/zend_accelerator_blacklist.c 
b/ext/opcache/zend_accelerator_blacklist.c
index b09d0e5..b11d41e 100644
--- a/ext/opcache/zend_accelerator_blacklist.c
+++ b/ext/opcache/zend_accelerator_blacklist.c
@@ -86,9 +86,9 @@ static void blacklist_report_regexp_error(regex_t 
*comp_regex, int reg_err)
 
 static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
 {
-   char *regexp;
-   int i, j, clen, reg_err, end = 0, rlen = 6;
+   int i, reg_err;
zend_regexp_list **regexp_list_it, *it;
+   char regexp[12*1024], *p, *end, *c, *backtrack = NULL;
 
if (blacklist-pos == 0) {
/* we have no blacklist to talk about */
@@ -96,36 +96,91 @@ static void 
zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
}
 
regexp_list_it = (blacklist-regexp_list);
-   for (i = 0; i  blacklist-pos; i++) {
-   rlen += blacklist-entries[i].path_length * 2 + 2;
 
-   /* don't create a regexp buffer bigger than 12K)*/
-   if ((i + 1 == blacklist-pos) || ((rlen + blacklist-entries[i 
+ 1].path_length * 2 + 2)  (12 * 1024))) {
-   regexp = (char *)malloc(rlen);
-   if (!regexp) {
-   zend_accel_error(ACCEL_LOG_ERROR, malloc() 
failed\n);
-   return;
+   regexp[0] = '^';
+   regexp[1] = '(';
+   p = regexp + 2;
+   end = regexp + sizeof(regexp) - sizeof([^]*)\0);
+
+   for (i = 0; i  blacklist-pos; ) {
+   c = blacklist-entries[i].path;
+   if (p + blacklist-entries[i].path_length  end) {
+   while (*c  p  end) {
+   switch (*c) {
+   case '?':
+   c++;
+#ifdef ZEND_WIN32
+   p[0] = '['; 
/* * = [^\\] on Win32 */
+   p[1] = '^';
+   p[2] = '\\';
+   p[3] = '\\';
+   p[4] = ']';
+   p += 5;
+#else
+   p[0] = '['; 
/* * = [^/] on *nix */
+   p[1] = '^';
+   

[PHP-CVS] com php-src: MFH: fixed #65045: mb_convert_encoding breaks well-formed character.: ext/mbstring/libmbfl/filters/mbfilter_utf8.c ext/mbstring/libmbfl/filters/mbfilter_utf8.h ext/mbstring/libm

2013-07-30 Thread Rui Hirokawa
Commit:c10d7e1afc63f0a0eaadb115560cc3ca626eb245
Author:Rui Hirokawa hirok...@php.net Wed, 31 Jul 2013 08:17:15 
+0900
Parents:   8ca04e51aa9c420b7fea6e8dddb78ae5b84a71c0
Branches:  PHP-5.5

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=c10d7e1afc63f0a0eaadb115560cc3ca626eb245

Log:
MFH: fixed #65045: mb_convert_encoding breaks well-formed character.

Bugs:
https://bugs.php.net/65045

Changed paths:
  M  ext/mbstring/libmbfl/filters/mbfilter_utf8.c
  M  ext/mbstring/libmbfl/filters/mbfilter_utf8.h
  M  ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c
  M  ext/mbstring/tests/illformed_utf_sequences.phpt

diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c 
b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
index fcee610..5539700 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
@@ -79,7 +79,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_wchar,
-   mbfl_filt_conv_common_flush
+   mbfl_filt_conv_utf8_wchar_flush
 };
 
 const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
@@ -93,6 +93,17 @@ const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
 
 #define CK(statement)  do { if ((statement)  0) return (-1); } while (0)
 
+int mbfl_filt_put_invalid_char(int c, mbfl_convert_filter *filter)
+{
+   int w;
+   w = c  MBFL_WCSGROUP_MASK;
+   w |= MBFL_WCSGROUP_THROUGH;
+   filter-status = 0;
+   filter-cache = 0;
+   CK((*filter-output_function)(w, filter-data));
+}
+
+
 /*
  * UTF-8 = wchar
  */
@@ -100,111 +111,104 @@ int mbfl_filt_conv_utf8_wchar(int c, 
mbfl_convert_filter *filter)
 {
int s, c1, w = 0, flag = 0;
 
-   if (c  0x80) {
-   if (filter-status != 0)  {
-   w = (filter-cache  MBFL_WCSGROUP_MASK) | 
MBFL_WCSGROUP_THROUGH;
-   CK((*filter-output_function)(w, filter-data));
-   filter-status = 0;
-   filter-cache = 0;
-   }
-   if (c = 0) {
+retry:
+   switch (filter-status  0xff) {
+   case 0x00:
+   if (c  0x80) {
CK((*filter-output_function)(c, filter-data));
+   } else if (c = 0xc2  c = 0xdf) { /* 2byte code first char: 
0xc2-0xdf */
+   filter-status = 0x10;
+   filter-cache = c  0x1f;
+   } else if (c = 0xe0  c = 0xef) { /* 3byte code first char: 
0xe0-0xef */
+   filter-status = 0x20;
+   filter-cache = c  0xf;
+   } else if (c = 0xf0  c = 0xf4) { /* 3byte code first char: 
0xf0-0xf4 */
+   filter-status = 0x30;
+   filter-cache = c  0x7;
+   } else {
+   mbfl_filt_put_invalid_char(c, filter);
}
-   } else if (c  0xc0) {
-   int status = filter-status  0xff;
-   switch (status) {
-   case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
-   case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
-   case 0x32: /* 4byte code 4th char: 0x80-0xbf */
-   filter-status = 0;
-   s = filter-cache | (c  0x3f);
+   break;
+   case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
+   case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
+   case 0x32: /* 4byte code 4th char: 0x80-0xbf */
+   filter-status = 0;
+   if (c = 0x80  c = 0xbf) {
+   s = (filter-cache6) | (c  0x3f);
filter-cache = 0;
-   if ((status == 0x10  s = 0x80) ||
-   (status == 0x21  s = 0x800  (s  0xd800 || s  
0xdfff)) ||
-   (status == 0x32  s = 0x1  s  0x11)) {
-   CK((*filter-output_function)(s, filter-data));
-   } else {
-   w = s  MBFL_WCSGROUP_MASK;
-   flag = 1;
-   }
-   break;
-   case 0x20: /* 3byte code 2nd char: 
0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
-   s = filter-cache | ((c  0x3f)  6);
-   c1 = (s  12)  0xf;
-   if ((c1 == 0x0  c = 0xa0) || 
-   (c1 == 0xd  c  0xa0) || 
-   (c1  0x0  c1 != 0xd)) {
-   filter-cache = s;
-   filter-status++;
-   } else {
-   w = s  MBFL_WCSGROUP_MASK;
-   flag = 1;
-   }
-   break;
-   case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
-   filter-cache |= ((c  0x3f)  

[PHP-CVS] com php-src: added test script for bug65045.: ext/mbstring/tests/bug65045.phpt

2013-07-30 Thread Rui Hirokawa
Commit:7da331501545c36088b535be0c53580a268ee5f4
Author:Rui Hirokawa hirok...@php.net Wed, 31 Jul 2013 08:18:39 
+0900
Parents:   c10d7e1afc63f0a0eaadb115560cc3ca626eb245
Branches:  PHP-5.5

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=7da331501545c36088b535be0c53580a268ee5f4

Log:
added test script for bug65045.

Bugs:
https://bugs.php.net/65045

Changed paths:
  A  ext/mbstring/tests/bug65045.phpt


Diff:
diff --git a/ext/mbstring/tests/bug65045.phpt b/ext/mbstring/tests/bug65045.phpt
new file mode 100644
index 000..03a090d
--- /dev/null
+++ b/ext/mbstring/tests/bug65045.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #65045: mb_convert_encoding breaks well-formed character
+--SKIPIF--
+?php extension_loaded('mbstring') or die('skip mbstring not available'); ?
+--FILE--
+?php
+
+//declare(encoding = 'UTF-8');
+mb_internal_encoding('UTF-8');
+
+$str = \xF0\xA4\xAD.  \xF0\xA4\xAD\xA2.\xF0\xA4\xAD\xA2;
+$expected = \xEF\xBF\xBD.\xF0\xA4\xAD\xA2.\xF0\xA4\xAD\xA2;
+
+$str2 = \xF0\xA4\xAD\xA2.\xF0\xA4\xAD\xA2.\xF0\xA4\xAD;
+$expected2 = \xF0\xA4\xAD\xA2.\xF0\xA4\xAD\xA2.\xEF\xBF\xBD;
+
+mb_substitute_character(0xFFFD);
+var_dump(
+$expected === htmlspecialchars_decode(htmlspecialchars($str, 
ENT_SUBSTITUTE, 'UTF-8')),
+$expected2 === htmlspecialchars_decode(htmlspecialchars($str2, 
ENT_SUBSTITUTE, 'UTF-8')), 
+$expected === mb_convert_encoding($str, 'UTF-8', 'UTF-8'),
+$expected2 === mb_convert_encoding($str2, 'UTF-8', 'UTF-8')
+);
+
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
\ No newline at end of file


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



[PHP-CVS] com php-src: Fixed php-5.2 support: ext/opcache/zend_accelerator_blacklist.c

2013-07-30 Thread Dmitry Stogov
Commit:f3aca8bc4dd2556bb1db476d94e01a2ced000f39
Author:Dmitry Stogov dmi...@zend.com Wed, 31 Jul 2013 03:22:34 
+0400
Parents:   2bd23530d83c09add1d4fd36cdea77f7d3746504
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f3aca8bc4dd2556bb1db476d94e01a2ced000f39

Log:
Fixed php-5.2 support

Changed paths:
  M  ext/opcache/zend_accelerator_blacklist.c


Diff:
diff --git a/ext/opcache/zend_accelerator_blacklist.c 
b/ext/opcache/zend_accelerator_blacklist.c
index b11d41e..da83cfd 100644
--- a/ext/opcache/zend_accelerator_blacklist.c
+++ b/ext/opcache/zend_accelerator_blacklist.c
@@ -30,6 +30,10 @@
 # include main/php_regex.h
 #endif
 
+#if ZEND_EXTENSION_API_NO  PHP_5_3_X_API_NO
+# include ext/standard/php_string.h
+#endif
+
 #ifdef ZEND_WIN32
 # define REGEX_MODE (REG_EXTENDED|REG_NOSUB|REG_ICASE)
 #else
@@ -252,7 +256,11 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, 
char *filename)
zend_accel_error(ACCEL_LOG_DEBUG,Loading blacklist file:  '%s', 
filename);
 
if (VCWD_REALPATH(filename, buf)) {
+#if ZEND_EXTENSION_API_NO  PHP_5_3_X_API_NO
+   blacklist_path_length = php_dirname(buf, strlen(buf));
+#else
blacklist_path_length = zend_dirname(buf, strlen(buf));
+#endif
blacklist_path = zend_strndup(buf, blacklist_path_length);
}


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



[PHP-CVS] com php-src: MFH: fixed #65045: mb_convert_encoding breaks well-formed character.: ext/mbstring/libmbfl/filters/mbfilter_utf8.c ext/mbstring/libmbfl/filters/mbfilter_utf8.h ext/mbstring/libm

2013-07-30 Thread Rui Hirokawa
Commit:0a974f14d13832838dcc7bae88b3271b7d035f46
Author:Rui Hirokawa hirok...@php.net Wed, 31 Jul 2013 08:46:54 
+0900
Parents:   1d7b6970f20a059c501e68927c9fb874bdb226bc
Branches:  PHP-5.4

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=0a974f14d13832838dcc7bae88b3271b7d035f46

Log:
MFH: fixed #65045: mb_convert_encoding breaks well-formed character.

Bugs:
https://bugs.php.net/65045

Changed paths:
  M  ext/mbstring/libmbfl/filters/mbfilter_utf8.c
  M  ext/mbstring/libmbfl/filters/mbfilter_utf8.h
  M  ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c
  A  ext/mbstring/tests/bug65045.phpt
  M  ext/mbstring/tests/illformed_utf_sequences.phpt

diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c 
b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
index fcee610..5539700 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
@@ -79,7 +79,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_wchar,
-   mbfl_filt_conv_common_flush
+   mbfl_filt_conv_utf8_wchar_flush
 };
 
 const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
@@ -93,6 +93,17 @@ const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
 
 #define CK(statement)  do { if ((statement)  0) return (-1); } while (0)
 
+int mbfl_filt_put_invalid_char(int c, mbfl_convert_filter *filter)
+{
+   int w;
+   w = c  MBFL_WCSGROUP_MASK;
+   w |= MBFL_WCSGROUP_THROUGH;
+   filter-status = 0;
+   filter-cache = 0;
+   CK((*filter-output_function)(w, filter-data));
+}
+
+
 /*
  * UTF-8 = wchar
  */
@@ -100,111 +111,104 @@ int mbfl_filt_conv_utf8_wchar(int c, 
mbfl_convert_filter *filter)
 {
int s, c1, w = 0, flag = 0;
 
-   if (c  0x80) {
-   if (filter-status != 0)  {
-   w = (filter-cache  MBFL_WCSGROUP_MASK) | 
MBFL_WCSGROUP_THROUGH;
-   CK((*filter-output_function)(w, filter-data));
-   filter-status = 0;
-   filter-cache = 0;
-   }
-   if (c = 0) {
+retry:
+   switch (filter-status  0xff) {
+   case 0x00:
+   if (c  0x80) {
CK((*filter-output_function)(c, filter-data));
+   } else if (c = 0xc2  c = 0xdf) { /* 2byte code first char: 
0xc2-0xdf */
+   filter-status = 0x10;
+   filter-cache = c  0x1f;
+   } else if (c = 0xe0  c = 0xef) { /* 3byte code first char: 
0xe0-0xef */
+   filter-status = 0x20;
+   filter-cache = c  0xf;
+   } else if (c = 0xf0  c = 0xf4) { /* 3byte code first char: 
0xf0-0xf4 */
+   filter-status = 0x30;
+   filter-cache = c  0x7;
+   } else {
+   mbfl_filt_put_invalid_char(c, filter);
}
-   } else if (c  0xc0) {
-   int status = filter-status  0xff;
-   switch (status) {
-   case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
-   case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
-   case 0x32: /* 4byte code 4th char: 0x80-0xbf */
-   filter-status = 0;
-   s = filter-cache | (c  0x3f);
+   break;
+   case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
+   case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
+   case 0x32: /* 4byte code 4th char: 0x80-0xbf */
+   filter-status = 0;
+   if (c = 0x80  c = 0xbf) {
+   s = (filter-cache6) | (c  0x3f);
filter-cache = 0;
-   if ((status == 0x10  s = 0x80) ||
-   (status == 0x21  s = 0x800  (s  0xd800 || s  
0xdfff)) ||
-   (status == 0x32  s = 0x1  s  0x11)) {
-   CK((*filter-output_function)(s, filter-data));
-   } else {
-   w = s  MBFL_WCSGROUP_MASK;
-   flag = 1;
-   }
-   break;
-   case 0x20: /* 3byte code 2nd char: 
0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
-   s = filter-cache | ((c  0x3f)  6);
-   c1 = (s  12)  0xf;
-   if ((c1 == 0x0  c = 0xa0) || 
-   (c1 == 0xd  c  0xa0) || 
-   (c1  0x0  c1 != 0xd)) {
-   filter-cache = s;
-   filter-status++;
-   } else {
-   w = s  MBFL_WCSGROUP_MASK;
-   flag = 1;
-   }
-   break;
-   case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
- 

[PHP-CVS] com php-src: 5.4.18 RC2: NEWS configure.in main/php_version.h

2013-07-30 Thread Stanislav Malyshev
Commit:10b84a9015a29071df5f5f9d8e4368a38ffbb805
Author:Stanislav Malyshev s...@php.net Tue, 30 Jul 2013 22:25:44 
-0700
Parents:   874c727c55f3808e59f3707e579bd8a3e896d17b
Branches:  PHP-5.4.18

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=10b84a9015a29071df5f5f9d8e4368a38ffbb805

Log:
5.4.18 RC2

Changed paths:
  M  NEWS
  M  configure.in
  M  main/php_version.h


Diff:
diff --git a/NEWS b/NEWS
index 5c82662..66566e1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 PHPNEWS
 |||
-?? ??? 2013, PHP 5.4.18 RC2
+01 Aug 2013, PHP 5.4.18 RC2
 
 - Core:
   . Fixed value of FILTER_SANITIZE_FULL_SPECIAL_CHARS constant (previously was
diff --git a/configure.in b/configure.in
index c6781d0..22f77ca 100644
--- a/configure.in
+++ b/configure.in
@@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
 PHP_MAJOR_VERSION=5
 PHP_MINOR_VERSION=4
 PHP_RELEASE_VERSION=18
-PHP_EXTRA_VERSION=RC1
+PHP_EXTRA_VERSION=RC2
 
PHP_VERSION=$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION
 PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 1 + [$]PHP_MINOR_VERSION \* 
100 + [$]PHP_RELEASE_VERSION`
 
diff --git a/main/php_version.h b/main/php_version.h
index c7800ed..037989d 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -3,6 +3,6 @@
 #define PHP_MAJOR_VERSION 5
 #define PHP_MINOR_VERSION 4
 #define PHP_RELEASE_VERSION 18
-#define PHP_EXTRA_VERSION RC1
-#define PHP_VERSION 5.4.18RC1
+#define PHP_EXTRA_VERSION RC2
+#define PHP_VERSION 5.4.18RC2
 #define PHP_VERSION_ID 50418


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



[PHP-CVS] tag php-src: create tag php-5.4.18RC2

2013-07-30 Thread Stanislav Malyshev
Tag php-5.4.18RC2 in php-src.git was created
Tag: 6ac7ae6e231c4338b130136fb4da87036eb90d17
Tagger:  Stanislav Malyshevs...@php.net Tue Jul 30 22:27:06 2013 
-0700
Log:
5.4.18 RC2
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (Darwin)

iF4EABEIAAYFAlH4oC4ACgkQL3lWvF2gS13+AAEAk+qwJ/VJYCma1htw8qse2SYD
NVZMRx9PeLcI0mURfVEA/1tThtKwB3ouJ/KihIMUfm6I1F2ZEXPDBe3XSMmYRbQ5
=TmsO
-END PGP SIGNATURE-

Link: 
http://git.php.net/?p=php-src.git;a=tag;h=6ac7ae6e231c4338b130136fb4da87036eb90d17

Target:  10b84a9015a29071df5f5f9d8e4368a38ffbb805
Author:  Stanislav Malyshev s...@php.net Tue, 30 Jul 2013 
22:25:44 -0700
Parents: 874c727c55f3808e59f3707e579bd8a3e896d17b
Target link: 
http://git.php.net/?p=php-src.git;a=commitdiff;h=10b84a9015a29071df5f5f9d8e4368a38ffbb805
Target log:
5.4.18 RC2

Changed paths:
  M  NEWS
  M  configure.in
  M  main/php_version.h



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