From a8e0a623ecdfa90027570faa921001a65092310f Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 18 Jul 2014 11:35:32 +0200 Subject: [PATCH 01/19] fix file with zero size usage in phpize mode --- win32/build/phpize.js.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/win32/build/phpize.js.in b/win32/build/phpize.js.in index 3178804212e..c99dece6181 100644 --- a/win32/build/phpize.js.in +++ b/win32/build/phpize.js.in @@ -40,9 +40,13 @@ function ERROR(msg) function file_get_contents(filename) { + var t = ""; var F = FSO.OpenTextFile(filename, 1); - var t = F.ReadAll(); - F.Close(); + + if (!F.AtEndOfStream) { + t = F.ReadAll(); + F.Close(); + } return t; } From 8044d0680ba03a08b5d4daa61e6b0b20d1ac30c0 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 18 Jul 2014 11:36:44 +0200 Subject: [PATCH 02/19] fix default prefix in phpize mode --- win32/build/config.w32.phpize.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/win32/build/config.w32.phpize.in b/win32/build/config.w32.phpize.in index b8bf45ea577..a544aac85c4 100644 --- a/win32/build/config.w32.phpize.in +++ b/win32/build/config.w32.phpize.in @@ -105,6 +105,11 @@ if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") { ERROR("Use of both --enable-debug and --enable-debug-pack not allowed."); } +if (PHP_PREFIX == '') { + PHP_PREFIX = "C:\\php"; + if (PHP_DEBUG == "yes") + PHP_PREFIX += "\\debug"; +} DEFINE('PHP_PREFIX', PHP_PREFIX); DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext "); From 35b077f53e0f8a1debc8bbacf1328b40c62099ab Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 18 Jul 2014 11:39:38 +0200 Subject: [PATCH 03/19] fix copy the ext dll into the prefix path in phpize mode --- win32/build/confutils.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 1c61316fb96..3de57a9963e 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -1347,9 +1347,6 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) if (MODE_PHPIZE && FSO.FileExists(PHP_DIR + "/include/main/config.pickle.h")) { cflags = "/FI main/config.pickle.h " + cflags; } - if (MODE_PHPIZE && FSO.FileExists(PHP_DIR + "/include/main/config.pickle.h")) { - cflags = "/FI main/config.pickle.h " + cflags; - } ADD_FLAG("CFLAGS_" + EXT, cflags); if (PHP_DSP != "no") { @@ -1869,6 +1866,7 @@ function generate_phpize() var MF = FSO.CreateTextFile(dest + "/phpize.js", true); var DEPS = FSO.CreateTextFile(dest + "/ext_deps.js", true); + prefix = get_define("PHP_PREFIX"); prefix = prefix.replace(new RegExp("/", "g"), "\\"); prefix = prefix.replace(new RegExp("\\\\", "g"), "\\\\"); @@ -1955,7 +1953,7 @@ function generate_makefile() var lib = "php_" + extensions_enabled[i][0] + ".lib"; var dll = "php_" + extensions_enabled[i][0] + ".dll"; MF.WriteLine(" @copy $(BUILD_DIR)\\" + lib + " $(BUILD_DIR_DEV)\\lib\\" + lib); - //MF.WriteLine(" @copy $(BUILD_DIR)\\" + dll + " $(PHP_PREFIX)\\" + dll); + MF.WriteLine(" @copy $(BUILD_DIR)\\" + dll + " $(PHP_PREFIX)\\" + dll); } } TF.Close(); From c5ccaf1d04fe20dc117b81764041c47efcb9b156 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 18 Jul 2014 18:38:57 +0200 Subject: [PATCH 04/19] implemented copy libs of core exts in phpize mode --- win32/build/Makefile | 2 +- win32/build/confutils.js | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/win32/build/Makefile b/win32/build/Makefile index e2d62545b8c..53cb52adaf4 100644 --- a/win32/build/Makefile +++ b/win32/build/Makefile @@ -183,7 +183,7 @@ msi-installer: dist # need to redirect, since INSTALL is a file in the root... install: really-install install-sdk -build-lib: +build-lib: build-ext-libs @if not exist $(BUILD_DIR_DEV)\lib mkdir $(BUILD_DIR_DEV)\lib >nul @copy $(BUILD_DIR)\$(PHPLIB) $(BUILD_DIR_DEV)\lib /y >nul diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 3de57a9963e..5a13494fc09 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -1952,8 +1952,18 @@ function generate_makefile() for (var i in extensions_enabled) { var lib = "php_" + extensions_enabled[i][0] + ".lib"; var dll = "php_" + extensions_enabled[i][0] + ".dll"; - MF.WriteLine(" @copy $(BUILD_DIR)\\" + lib + " $(BUILD_DIR_DEV)\\lib\\" + lib); - MF.WriteLine(" @copy $(BUILD_DIR)\\" + dll + " $(PHP_PREFIX)\\" + dll); + MF.WriteLine(" @copy $(BUILD_DIR)\\" + lib + " $(BUILD_DIR_DEV)\\lib"); + MF.WriteLine(" @copy $(BUILD_DIR)\\" + dll + " $(PHP_PREFIX)"); + } + } else { + MF.WriteBlankLines(1); + MF.WriteLine("build-ext-libs:"); + for (var i in extensions_enabled) { + var lib = "php_" + extensions_enabled[i][0] + ".lib"; + + if ('shared' == extensions_enabled[i][1]) { + MF.WriteLine(" @copy $(BUILD_DIR)\\" + lib + " $(BUILD_DIR_DEV)\\lib"); + } } } TF.Close(); From e946de29d2f337f140780086b0ccefd13e2095ef Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Sat, 19 Jul 2014 09:52:01 +0900 Subject: [PATCH 05/19] Fixed bug #66827 Session raises E_NOTICE when session name variable is array --- ext/session/session.c | 22 +++++++++++++--------- ext/session/tests/bug66827.phpt | 12 ++++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 ext/session/tests/bug66827.phpt diff --git a/ext/session/session.c b/ext/session/session.c index 74a7f4a1da7..7d145c362b4 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1327,9 +1327,16 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC) /* {{{ } /* }}} */ -#define PPID2SID \ - convert_to_string((*ppid)); \ - PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid)) +static void ppid2sid(zval **ppid TSRMLS_DC) { + if (Z_TYPE_PP(ppid) != IS_STRING) { + PS(id) = NULL; + PS(send_cookie) = 1; + } else { + convert_to_string((*ppid)); + PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid)); + PS(send_cookie) = 0; + } +} static void php_session_reset_id(TSRMLS_D) /* {{{ */ { @@ -1418,9 +1425,8 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ Z_TYPE_PP(data) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS ) { - PPID2SID; + ppid2sid(ppid TSRMLS_CC); PS(apply_trans_sid) = 0; - PS(send_cookie) = 0; PS(define_sid) = 0; } @@ -1429,8 +1435,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ Z_TYPE_PP(data) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS ) { - PPID2SID; - PS(send_cookie) = 0; + ppid2sid(ppid TSRMLS_CC); } if (!PS(use_only_cookies) && !PS(id) && @@ -1438,8 +1443,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ Z_TYPE_PP(data) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS ) { - PPID2SID; - PS(send_cookie) = 0; + ppid2sid(ppid TSRMLS_CC); } } diff --git a/ext/session/tests/bug66827.phpt b/ext/session/tests/bug66827.phpt new file mode 100644 index 00000000000..4e1a4f7aea6 --- /dev/null +++ b/ext/session/tests/bug66827.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #66827: Session raises E_NOTICE when session name variable is array. +--INI-- +--SKIPIF-- + +--FILE-- + Date: Sat, 19 Jul 2014 10:11:42 +0900 Subject: [PATCH 06/19] Update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index fd58bd62a32..144d86b4e24 100644 --- a/NEWS +++ b/NEWS @@ -40,6 +40,10 @@ PHP NEWS - Streams: . Fixed bug #67430 (http:// wrapper doesn't follow 308 redirects). (Adam) +- Session: + . Fixed bug #66827 (Session raises E_NOTICE when session name variable is array). + (Yasuo) + 26 Jun 2014, PHP 5.4.30 - Core: From 9b30b04b32e16d354f5fc860367a7aecc87dc55b Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Sat, 19 Jul 2014 10:12:28 +0900 Subject: [PATCH 07/19] Update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 44c09d0d7d5..98d6efc5485 100644 --- a/NEWS +++ b/NEWS @@ -58,6 +58,10 @@ PHP NEWS - Streams: . Fixed bug #67430 (http:// wrapper doesn't follow 308 redirects). (Adam) +- Session: + . Fixed bug #66827 (Session raises E_NOTICE when session name variable is array). + (Yasuo) + 27 Jun 2014, PHP 5.5.14 - Core: From f19eb82f7c2009cd5b6252173b5ea0e6fbfd4852 Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Sat, 19 Jul 2014 10:13:15 +0900 Subject: [PATCH 08/19] Update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 7bd2eda384c..b5ca27adb0b 100644 --- a/NEWS +++ b/NEWS @@ -43,6 +43,10 @@ PHP NEWS sorting). (research at insighti dot org, Laruence) . Fixed bug #67538 (SPL Iterators use-after-free). (CVE-2014-4670) (Laruence) +- Session: + . Fixed bug #66827 (Session raises E_NOTICE when session name variable is array). + (Yasuo) + - OPCache: . Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen) (Dmitry, Laruence) From f604b61e39fb0807a4e0668e62a8527d4672a26f Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 19 Jul 2014 12:53:34 +0800 Subject: [PATCH 09/19] New added opcodes don't need to be resloved --- Zend/zend_opcode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index cd810ec36f7..80ec632f50e 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -625,10 +625,10 @@ static void zend_resolve_fast_call(zend_op_array *op_array, zend_uint op_num TSR static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC) { - zend_uint i; + zend_uint i, j; zend_op *opline; - for (i = 0; i < op_array->last; i++) { + for (i = 0, j = op_array->last; i < j; i++) { opline = op_array->opcodes + i; switch (opline->opcode) { case ZEND_RETURN: From 9ce1a36af2295a75e4244eac3085f82d0c25105d Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 19 Jul 2014 15:30:50 +0800 Subject: [PATCH 10/19] Fixed segfault with empty break --- Zend/tests/try_finally_011.phpt | 15 +++++++++++++++ Zend/zend_opcode.c | 19 ++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 Zend/tests/try_finally_011.phpt diff --git a/Zend/tests/try_finally_011.phpt b/Zend/tests/try_finally_011.phpt new file mode 100644 index 00000000000..7aa3f35feeb --- /dev/null +++ b/Zend/tests/try_finally_011.phpt @@ -0,0 +1,15 @@ +--TEST-- +Try finally (segfault with empty break) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot break/continue 1 level in %stry_finally_011.php on line %d diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 80ec632f50e..b3fb11f00f6 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -643,15 +643,16 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC) zend_brk_cont_element *jmp_to; nest_levels = Z_LVAL(op_array->literals[opline->op2.constant].constant); - array_offset = opline->op1.opline_num; - do { - jmp_to = &op_array->brk_cont_array[array_offset]; - if (nest_levels > 1) { - array_offset = jmp_to->parent; - } - } while (--nest_levels > 0); - zend_resolve_finally_call(op_array, i, opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont TSRMLS_CC); - break; + if ((array_offset = opline->op1.opline_num) != -1) { + do { + jmp_to = &op_array->brk_cont_array[array_offset]; + if (nest_levels > 1) { + array_offset = jmp_to->parent; + } + } while (--nest_levels > 0); + zend_resolve_finally_call(op_array, i, opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont TSRMLS_CC); + break; + } } case ZEND_GOTO: if (Z_TYPE(op_array->literals[opline->op2.constant].constant) != IS_LONG) { From 8ff00e6e85669ad0a5a47421fe639b6fb6f91669 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 19 Jul 2014 17:19:01 +0800 Subject: [PATCH 11/19] Improve fix for #66608 --- Zend/tests/bug66608.phpt | 46 ++++++++++++++++++++--- Zend/zend_compile.h | 4 +- Zend/zend_opcode.c | 81 ++++++++++++++++++++++++++++------------ Zend/zend_vm_def.h | 4 +- Zend/zend_vm_execute.h | 4 +- 5 files changed, 104 insertions(+), 35 deletions(-) diff --git a/Zend/tests/bug66608.phpt b/Zend/tests/bug66608.phpt index 6329506d066..5a499a1dab1 100644 --- a/Zend/tests/bug66608.phpt +++ b/Zend/tests/bug66608.phpt @@ -5,28 +5,56 @@ Bug #66608 (Incorrect behavior with nested "finally" blocks) function bar() { try { echo "1\n"; + try { + } finally { + try { + } finally { + } + echo "2\n"; + } } finally { try { throw new Exception (""); } catch (Exception $ab) { - echo "2\n"; + echo "3\n"; } finally { try { } finally { - echo "3\n"; + echo "4\n"; try { } finally { } - echo "4\n"; + echo "5\n"; } } - echo "5\n"; + echo "6\n"; try { } finally { - echo "6\n"; + while (1) { + try { + echo "7\n"; + break; + } finally { + echo "8\n"; + } + echo "bad"; + } + echo "9\n"; + while (1) { + try { + throw new Exception(""); + } catch(Exception $e) { + echo "10\n"; + break; + } finally { + echo "11\n"; + } + echo "bak\n"; + } } + echo "12\n"; } - echo "7\n"; + echo "13\n"; } bar(); --EXPECT-- @@ -37,3 +65,9 @@ bar(); 5 6 7 +8 +9 +10 +11 +12 +13 diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index e6e30f37b7d..f6b1be96fa6 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -843,8 +843,8 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC); #define ZEND_FAST_RET_TO_CATCH 1 #define ZEND_FAST_RET_TO_FINALLY 2 -#define ZEND_FAST_CALL_FOR_CATCH 1 -#define ZEND_FAST_CALL_FOR_FINALLY 2 +#define ZEND_FAST_CALL_FROM_CATCH 1 +#define ZEND_FAST_CALL_FROM_FINALLY 2 END_EXTERN_C() diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index b3fb11f00f6..5c032d94bd3 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -509,6 +509,49 @@ static void zend_check_finally_breakout(zend_op_array *op_array, zend_uint op_nu } } +static void zend_adjust_fast_call(zend_op_array *op_array, zend_uint fast_call, zend_uint start, zend_uint end TSRMLS_DC) +{ + int i; + zend_uint op_num = 0; + + for (i = 0; i < op_array->last_try_catch; i++) { + if (op_array->try_catch_array[i].finally_op > start + && op_array->try_catch_array[i].finally_end < end) { + op_num = op_array->try_catch_array[i].finally_op; + start = op_array->try_catch_array[i].finally_end; + } + } + + if (op_num) { + /* Must be ZEND_FAST_CALL */ + ZEND_ASSERT(op_array->opcodes[op_num - 2].opcode == ZEND_FAST_CALL); + op_array->opcodes[op_num - 2].extended_value = ZEND_FAST_CALL_FROM_FINALLY; + op_array->opcodes[op_num - 2].op2.opline_num = fast_call; + } +} + +static void zend_resolve_fast_call(zend_op_array *op_array, zend_uint fast_call, zend_uint op_num TSRMLS_DC) +{ + int i; + zend_uint finally_op_num = 0; + + for (i = 0; i < op_array->last_try_catch; i++) { + if (op_num >= op_array->try_catch_array[i].finally_op + && op_num < op_array->try_catch_array[i].finally_end) { + finally_op_num = op_array->try_catch_array[i].finally_op; + } + } + + if (finally_op_num) { + /* Must be ZEND_FAST_CALL */ + ZEND_ASSERT(op_array->opcodes[finally_op_num - 2].opcode == ZEND_FAST_CALL); + if (op_array->opcodes[fast_call].extended_value == 0) { + op_array->opcodes[fast_call].extended_value = ZEND_FAST_CALL_FROM_FINALLY; + op_array->opcodes[fast_call].op2.opline_num = finally_op_num - 2; + } + } +} + static void zend_resolve_finally_call(zend_op_array *op_array, zend_uint op_num, zend_uint dst_num TSRMLS_DC) { zend_uint start_op; @@ -536,11 +579,23 @@ static void zend_resolve_finally_call(zend_op_array *op_array, zend_uint op_num, opline->opcode = ZEND_FAST_CALL; SET_UNUSED(opline->op1); SET_UNUSED(opline->op2); - opline->op1.opline_num = op_array->try_catch_array[i].finally_op; + zend_adjust_fast_call(op_array, start_op, + op_array->try_catch_array[i].finally_op, + op_array->try_catch_array[i].finally_end TSRMLS_CC); if (op_array->try_catch_array[i].catch_op) { - opline->extended_value = ZEND_FAST_CALL_FOR_CATCH; + opline->extended_value = ZEND_FAST_CALL_FROM_CATCH; opline->op2.opline_num = op_array->try_catch_array[i].catch_op; + opline->op1.opline_num = get_next_op_number(op_array); + /* generate a FAST_CALL to hole CALL_FROM_FINALLY */ + opline = get_next_op(op_array TSRMLS_CC); + opline->opcode = ZEND_FAST_CALL; + SET_UNUSED(opline->op1); + SET_UNUSED(opline->op2); + zend_resolve_fast_call(op_array, start_op + 1, op_array->try_catch_array[i].finally_op - 2 TSRMLS_CC); + } else { + zend_resolve_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op - 2 TSRMLS_CC); } + opline->op1.opline_num = op_array->try_catch_array[i].finally_op; /* generate a sequence of FAST_CALL to upward finally block */ while (i > 0) { @@ -603,26 +658,6 @@ static void zend_resolve_finally_ret(zend_op_array *op_array, zend_uint op_num T } } -static void zend_resolve_fast_call(zend_op_array *op_array, zend_uint op_num TSRMLS_DC) -{ - int i; - zend_uint finally_op_num = 0; - - for (i = 0; i < op_array->last_try_catch; i++) { - if (op_array->try_catch_array[i].finally_op > op_num) { - break; - } - if (op_num < op_array->try_catch_array[i].finally_end) { - finally_op_num = op_array->try_catch_array[i].finally_op; - } - } - - if (finally_op_num) { - op_array->opcodes[op_num].extended_value = ZEND_FAST_CALL_FOR_FINALLY; - op_array->opcodes[op_num].op2.opline_num = finally_op_num - 2; /* it must be ZEND_FAST_CALL */ - } -} - static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC) { zend_uint i, j; @@ -666,7 +701,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC) zend_resolve_finally_call(op_array, i, opline->op1.opline_num TSRMLS_CC); break; case ZEND_FAST_CALL: - zend_resolve_fast_call(op_array, i TSRMLS_CC); + zend_resolve_fast_call(op_array, i, i TSRMLS_CC); break; case ZEND_FAST_RET: zend_resolve_finally_ret(op_array, i TSRMLS_CC); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 161dd774424..79453f13b33 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5396,7 +5396,7 @@ ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ANY, ANY) { USE_OPLINE - if ((opline->extended_value & ZEND_FAST_CALL_FOR_CATCH) && + if ((opline->extended_value & ZEND_FAST_CALL_FROM_CATCH) && UNEXPECTED(EG(prev_exception) != NULL)) { /* in case of unhandled exception jump to catch block instead of finally */ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]); @@ -5411,7 +5411,7 @@ ZEND_VM_HANDLER(163, ZEND_FAST_RET, ANY, ANY) { if (EX(fast_ret)) { ZEND_VM_SET_OPCODE(EX(fast_ret) + 1); - if ((EX(fast_ret)->extended_value & ZEND_FAST_CALL_FOR_FINALLY)) { + if ((EX(fast_ret)->extended_value & ZEND_FAST_CALL_FROM_FINALLY)) { EX(fast_ret) = &EX(op_array)->opcodes[EX(fast_ret)->op2.opline_num]; } ZEND_VM_CONTINUE(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index c94c2d755b3..4d2b6f266c6 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1137,7 +1137,7 @@ static int ZEND_FASTCALL ZEND_FAST_CALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - if ((opline->extended_value & ZEND_FAST_CALL_FOR_CATCH) && + if ((opline->extended_value & ZEND_FAST_CALL_FROM_CATCH) && UNEXPECTED(EG(prev_exception) != NULL)) { /* in case of unhandled exception jump to catch block instead of finally */ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]); @@ -1152,7 +1152,7 @@ static int ZEND_FASTCALL ZEND_FAST_RET_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { if (EX(fast_ret)) { ZEND_VM_SET_OPCODE(EX(fast_ret) + 1); - if ((EX(fast_ret)->extended_value & ZEND_FAST_CALL_FOR_FINALLY)) { + if ((EX(fast_ret)->extended_value & ZEND_FAST_CALL_FROM_FINALLY)) { EX(fast_ret) = &EX(op_array)->opcodes[EX(fast_ret)->op2.opline_num]; } ZEND_VM_CONTINUE(); From 7b6031567251ad47132de23f47eb57951fd9b563 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 19 Jul 2014 18:40:20 +0200 Subject: [PATCH 12/19] Fixed bug #67635 php links to systemd libraries without using pkg-config Patch from pacho at gentoo dot org Rely on pkg-config for systemd >= 209 Failback on old check --- sapi/fpm/config.m4 | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index bd6d64930b1..e1c740d574f 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -567,14 +567,26 @@ if test "$PHP_FPM" != "no"; then [ --with-fpm-systemd Activate systemd integration], no, no) if test "$PHP_FPM_SYSTEMD" != "no" ; then - AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") - AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"]) + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + unset SYSTEMD_LIBS + unset SYSTEMD_INCS + if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then + SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd` + SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd` + HAVE_SD_DAEMON_H="yes" + else + AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") + AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"]) + fi if test $HAVE_SD_DAEMON_H = "no" || test -z "${SYSTEMD_LIBS}"; then AC_MSG_ERROR([Your system does not support systemd.]) else AC_DEFINE(HAVE_SYSTEMD, 1, [FPM use systemd integration]) PHP_FPM_SD_FILES="fpm/fpm_systemd.c" - PHP_ADD_LIBRARY(systemd-daemon) + PHP_EVAL_LIBLINE($SYSTEMD_LIBS) + PHP_EVAL_INCLINE($SYSTEMD_INCS) php_fpm_systemd=notify fi else From 144a08395408506fa700c71e74c360160da3bd99 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 19 Jul 2014 18:42:40 +0200 Subject: [PATCH 13/19] improve previous, add message during configure --- sapi/fpm/config.m4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index e1c740d574f..96b0edf7fab 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -573,9 +573,12 @@ if test "$PHP_FPM" != "no"; then unset SYSTEMD_LIBS unset SYSTEMD_INCS if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then + AC_MSG_CHECKING([for libsystemd]) SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd` SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd` + SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd` HAVE_SD_DAEMON_H="yes" + AC_MSG_RESULT([version $SYSTEMD_VERS]) else AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"]) From a051d7264dc5c21264e1244785d962ee1256874b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 19 Jul 2014 18:46:17 +0200 Subject: [PATCH 14/19] NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 98d6efc5485..845049a2c40 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2014, PHP 5.5.16 +- FPM: + . Fixed bug #67635 (php links to systemd libraries without using pkg-config). + (pacho@gentoo.org, Remi) ?? ??? 2014, PHP 5.5.15 From 0ec8f1997590fcea80437ab02dd8802c85579428 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 19 Jul 2014 18:47:14 +0200 Subject: [PATCH 15/19] NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index b5ca27adb0b..dd3e3236cdc 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,8 @@ PHP NEWS - FPM: . Fixed bug #67530 (error_log=syslog ignored). (Remi) + . Fixed bug #67635 (php links to systemd libraries without using pkg-config). + (pacho@gentoo.org, Remi) - Intl: . Fixed bug #66921 (Wrong argument type hint for function From 658f7d77f9eb447ecc2f9812d46b4c07bb99b16d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 20 Jul 2014 11:14:43 +0200 Subject: [PATCH 16/19] See bug #67635 Improve previous fix: - also rely on pkg-config for systemd < 209 - always check for header - comments --- sapi/fpm/config.m4 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 96b0edf7fab..6db5e3b955f 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -572,17 +572,29 @@ if test "$PHP_FPM" != "no"; then fi unset SYSTEMD_LIBS unset SYSTEMD_INCS + if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then + dnl systemd version >= 209 provides libsystemd AC_MSG_CHECKING([for libsystemd]) SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd` SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd` SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd` - HAVE_SD_DAEMON_H="yes" AC_MSG_RESULT([version $SYSTEMD_VERS]) + + elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd-daemon; then + dnl systemd version < 209 provides libsystemd-daemon + AC_MSG_CHECKING([for libsystemd-daemon]) + SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd-daemon` + SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd-daemon` + SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd-daemon` + AC_MSG_RESULT([version $SYSTEMD_VERS]) + else + dnl failback when no pkg-config AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") - AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"]) fi + + AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"]) if test $HAVE_SD_DAEMON_H = "no" || test -z "${SYSTEMD_LIBS}"; then AC_MSG_ERROR([Your system does not support systemd.]) else From 0678dc8d912435d27b1c5c00634c1db2b6581ab0 Mon Sep 17 00:00:00 2001 From: Lior Kaplan Date: Mon, 21 Jul 2014 01:45:36 +0300 Subject: [PATCH 17/19] Enable $ replacement in exif, ldap, pdo_pgsql and tidy --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitattributes b/.gitattributes index 9ed6e5f4b9b..a44aa5d2cd8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,6 +22,10 @@ sapi/nsapi/nsapi.c ident sapi/continuity/capi.c ident Zend/RFCs/002.txt ident Zend/RFCs/003.txt ident +ext/exif/exif.c ident +ext/ldap/ldap.c ident +ext/pdo_pgsql/pdo_pgsql.c ident +ext/tidy/tidy.c ident NEWS merge=NEWS /ext/bz2/tests/with_strings.phpt -crlf /ext/dom/tests/bug40836.phpt -crlf From f6d941e4b451a09c80e852a2f9d54e41591c36d2 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 21 Jul 2014 09:52:52 +0200 Subject: [PATCH 18/19] force atoll macro usage on windows --- main/rfc1867.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main/rfc1867.c b/main/rfc1867.c index c93472f5a12..806a292872a 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -36,6 +36,7 @@ #if defined(PHP_WIN32) && !defined(HAVE_ATOLL) # define atoll(s) _atoi64(s) +# define HAVE_ATOLL 1 #endif #define DEBUG_FILE_UPLOAD ZEND_DEBUG From dc3a5d783f92c63c1c2645b542d5f5487f3bd952 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 21 Jul 2014 14:45:49 +0200 Subject: [PATCH 19/19] fix nmake snap when ext name is different in target dll --- win32/build/confutils.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 5a13494fc09..8da760406c9 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -1958,11 +1958,14 @@ function generate_makefile() } else { MF.WriteBlankLines(1); MF.WriteLine("build-ext-libs:"); + MF.WriteLine(" @if not exist $(BUILD_DIR_DEV)\\lib mkdir $(BUILD_DIR_DEV)\\lib >nul"); for (var i in extensions_enabled) { - var lib = "php_" + extensions_enabled[i][0] + ".lib"; + var lib; + + lib = "php_" + extensions_enabled[i][0] + "*.lib"; if ('shared' == extensions_enabled[i][1]) { - MF.WriteLine(" @copy $(BUILD_DIR)\\" + lib + " $(BUILD_DIR_DEV)\\lib"); + MF.WriteLine(" @if exist $(BUILD_DIR)\\" + lib + " copy $(BUILD_DIR)\\" + lib + " $(BUILD_DIR_DEV)\\lib"); } } }