diff options
author | Derick Rethans <github@derickrethans.nl> | 2014-01-02 10:57:46 +0000 |
---|---|---|
committer | Derick Rethans <github@derickrethans.nl> | 2014-01-02 10:57:46 +0000 |
commit | dee77f237c7989359986f5020d450c1b9a93464c (patch) | |
tree | 0b8de5050f07364b3fcb03fa420686505947dc79 | |
parent | e881334e496be92ac6d1751f25d006203f3229d6 (diff) | |
parent | 3c3ff434329d2f505b00a79bacfdef95ca96f0d2 (diff) | |
download | php-git-dee77f237c7989359986f5020d450c1b9a93464c.tar.gz |
Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | Zend/Makefile.am | 2 | ||||
-rw-r--r-- | Zend/Zend.dsp | 4 | ||||
-rw-r--r-- | Zend/ZendTS.dsp | 4 | ||||
-rw-r--r-- | Zend/zend.c | 4 | ||||
-rw-r--r-- | Zend/zend_vm_gen.php | 26 | ||||
-rw-r--r-- | Zend/zend_vm_opcodes.c | 188 | ||||
-rw-r--r-- | Zend/zend_vm_opcodes.h | 7 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | ext/ftp/ftp.c | 4 | ||||
-rw-r--r-- | ext/ftp/php_ftp.c | 4 | ||||
-rw-r--r-- | ext/pdo_odbc/odbc_stmt.c | 3 | ||||
-rw-r--r-- | ext/snmp/snmp.c | 6 | ||||
-rw-r--r-- | main/SAPI.c | 43 | ||||
-rw-r--r-- | main/php_version.h | 6 | ||||
-rw-r--r-- | win32/build/config.w32 | 2 |
16 files changed, 286 insertions, 30 deletions
@@ -1,5 +1,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? ??? 2013, PHP 5.4.25 + ?? ??? 2013, PHP 5.4.24 - Core: @@ -26,6 +28,13 @@ PHP NEWS - GD: . Fixed bug #64405 (Use freetype-config for determining freetype2 dir(s)). (Adam) + +- PDO_odbc: + . Fixed bug #66311 (Stack smashing protection kills PDO/ODBC queries). + (michael at orlitzky dot com) + +- SNMP: + . Fixed SNMP_ERR_TOOBIG handling for bulk walk operations. (Boris Lytochkin) - XSL . Fixed bug #49634 (Segfault throwing an exception in a XSL registered diff --git a/Zend/Makefile.am b/Zend/Makefile.am index 5ec4590fef..7955badf6e 100644 --- a/Zend/Makefile.am +++ b/Zend/Makefile.am @@ -10,7 +10,7 @@ libZend_la_SOURCES=\ zend_ini_parser.y zend_ini_scanner.l \ zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \ zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \ - zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \ + zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \ zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \ zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \ zend_ini.c zend_qsort.c zend_objects.c zend_object_handlers.c \ diff --git a/Zend/Zend.dsp b/Zend/Zend.dsp index ebe01978c4..5e95b61d8d 100644 --- a/Zend/Zend.dsp +++ b/Zend/Zend.dsp @@ -257,6 +257,10 @@ SOURCE=.\zend_ts_hash.c SOURCE=.\zend_variables.c
# End Source File
+# Begin Source File
+
+SOURCE=.\zend_vm_opcodes.c
+# End Source File
# End Group
# Begin Group "Header Files"
diff --git a/Zend/ZendTS.dsp b/Zend/ZendTS.dsp index 3494cd4e17..bab134623a 100644 --- a/Zend/ZendTS.dsp +++ b/Zend/ZendTS.dsp @@ -287,6 +287,10 @@ SOURCE=.\zend_ts_hash.c SOURCE=.\zend_variables.c
# End Source File
+# Begin Source File
+
+SOURCE=.\zend_vm_opcodes.c
+# End Source File
# End Group
# Begin Group "Header Files"
diff --git a/Zend/zend.c b/Zend/zend.c index 0602c45042..eaf4ab9a9a 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -43,10 +43,6 @@ # define GLOBAL_CONSTANTS_TABLE EG(zend_constants) #endif -#if defined(ZEND_WIN32) && ZEND_DEBUG -BOOL WINAPI IsDebuggerPresent(VOID); -#endif - /* true multithread-shared globals */ ZEND_API zend_class_entry *zend_standard_class_def = NULL; ZEND_API int (*zend_printf)(const char *format, ...); diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 37deae8657..aaa87aa12f 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1201,14 +1201,40 @@ function gen_vm($def, $skel) { // Insert header out($f, $GLOBALS['header_text']); + fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n"); + fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n"); + foreach ($opcodes as $code => $dsc) { $code = str_pad((string)$code,$code_len," ",STR_PAD_LEFT); $op = str_pad($dsc["op"],$max_opcode_len); fputs($f,"#define $op $code\n"); } + + fputs($f, "\n#endif"); fclose($f); echo "zend_vm_opcodes.h generated successfully.\n"; + // zend_vm_opcodes.c + $f = fopen("zend_vm_opcodes.c", "w+") or die("ERROR: Cannot create zend_vm_opcodes.c\n"); + + // Insert header + out($f, $GLOBALS['header_text']); + fputs($f,"#include <stdio.h>\n"); + fputs($f,"#include <zend.h>\n\n"); + + fputs($f,"const char *zend_vm_opcodes_map[".($max_opcode + 1)."] = {\n"); + for ($i = 0; $i <= $max_opcode; $i++) { + fputs($f,"\t".(isset($opcodes[$i]["op"])?'"'.$opcodes[$i]["op"].'"':"NULL").",\n"); + } + fputs($f, "};\n\n"); + + fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n"); + fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n"); + fputs($f, "}\n"); + + fclose($f); + echo "zend_vm_opcodes.c generated successfully.\n"; + // Generate zend_vm_execute.h $f = fopen("zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n"); $executor_file = realpath("zend_vm_execute.h"); diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c new file mode 100644 index 0000000000..1195dc38bf --- /dev/null +++ b/Zend/zend_vm_opcodes.c @@ -0,0 +1,188 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andi Gutmans <andi@zend.com> | + | Zeev Suraski <zeev@zend.com> | + | Dmitry Stogov <dmitry@zend.com> | + +----------------------------------------------------------------------+ +*/ + +#include <stdio.h> +#include <zend.h> + +const char *zend_vm_opcodes_map[159] = { + "ZEND_NOP", + "ZEND_ADD", + "ZEND_SUB", + "ZEND_MUL", + "ZEND_DIV", + "ZEND_MOD", + "ZEND_SL", + "ZEND_SR", + "ZEND_CONCAT", + "ZEND_BW_OR", + "ZEND_BW_AND", + "ZEND_BW_XOR", + "ZEND_BW_NOT", + "ZEND_BOOL_NOT", + "ZEND_BOOL_XOR", + "ZEND_IS_IDENTICAL", + "ZEND_IS_NOT_IDENTICAL", + "ZEND_IS_EQUAL", + "ZEND_IS_NOT_EQUAL", + "ZEND_IS_SMALLER", + "ZEND_IS_SMALLER_OR_EQUAL", + "ZEND_CAST", + "ZEND_QM_ASSIGN", + "ZEND_ASSIGN_ADD", + "ZEND_ASSIGN_SUB", + "ZEND_ASSIGN_MUL", + "ZEND_ASSIGN_DIV", + "ZEND_ASSIGN_MOD", + "ZEND_ASSIGN_SL", + "ZEND_ASSIGN_SR", + "ZEND_ASSIGN_CONCAT", + "ZEND_ASSIGN_BW_OR", + "ZEND_ASSIGN_BW_AND", + "ZEND_ASSIGN_BW_XOR", + "ZEND_PRE_INC", + "ZEND_PRE_DEC", + "ZEND_POST_INC", + "ZEND_POST_DEC", + "ZEND_ASSIGN", + "ZEND_ASSIGN_REF", + "ZEND_ECHO", + "ZEND_PRINT", + "ZEND_JMP", + "ZEND_JMPZ", + "ZEND_JMPNZ", + "ZEND_JMPZNZ", + "ZEND_JMPZ_EX", + "ZEND_JMPNZ_EX", + "ZEND_CASE", + "ZEND_SWITCH_FREE", + "ZEND_BRK", + "ZEND_CONT", + "ZEND_BOOL", + "ZEND_INIT_STRING", + "ZEND_ADD_CHAR", + "ZEND_ADD_STRING", + "ZEND_ADD_VAR", + "ZEND_BEGIN_SILENCE", + "ZEND_END_SILENCE", + "ZEND_INIT_FCALL_BY_NAME", + "ZEND_DO_FCALL", + "ZEND_DO_FCALL_BY_NAME", + "ZEND_RETURN", + "ZEND_RECV", + "ZEND_RECV_INIT", + "ZEND_SEND_VAL", + "ZEND_SEND_VAR", + "ZEND_SEND_REF", + "ZEND_NEW", + "ZEND_INIT_NS_FCALL_BY_NAME", + "ZEND_FREE", + "ZEND_INIT_ARRAY", + "ZEND_ADD_ARRAY_ELEMENT", + "ZEND_INCLUDE_OR_EVAL", + "ZEND_UNSET_VAR", + "ZEND_UNSET_DIM", + "ZEND_UNSET_OBJ", + "ZEND_FE_RESET", + "ZEND_FE_FETCH", + "ZEND_EXIT", + "ZEND_FETCH_R", + "ZEND_FETCH_DIM_R", + "ZEND_FETCH_OBJ_R", + "ZEND_FETCH_W", + "ZEND_FETCH_DIM_W", + "ZEND_FETCH_OBJ_W", + "ZEND_FETCH_RW", + "ZEND_FETCH_DIM_RW", + "ZEND_FETCH_OBJ_RW", + "ZEND_FETCH_IS", + "ZEND_FETCH_DIM_IS", + "ZEND_FETCH_OBJ_IS", + "ZEND_FETCH_FUNC_ARG", + "ZEND_FETCH_DIM_FUNC_ARG", + "ZEND_FETCH_OBJ_FUNC_ARG", + "ZEND_FETCH_UNSET", + "ZEND_FETCH_DIM_UNSET", + "ZEND_FETCH_OBJ_UNSET", + "ZEND_FETCH_DIM_TMP_VAR", + "ZEND_FETCH_CONSTANT", + "ZEND_GOTO", + "ZEND_EXT_STMT", + "ZEND_EXT_FCALL_BEGIN", + "ZEND_EXT_FCALL_END", + "ZEND_EXT_NOP", + "ZEND_TICKS", + "ZEND_SEND_VAR_NO_REF", + "ZEND_CATCH", + "ZEND_THROW", + "ZEND_FETCH_CLASS", + "ZEND_CLONE", + "ZEND_RETURN_BY_REF", + "ZEND_INIT_METHOD_CALL", + "ZEND_INIT_STATIC_METHOD_CALL", + "ZEND_ISSET_ISEMPTY_VAR", + "ZEND_ISSET_ISEMPTY_DIM_OBJ", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "ZEND_PRE_INC_OBJ", + "ZEND_PRE_DEC_OBJ", + "ZEND_POST_INC_OBJ", + "ZEND_POST_DEC_OBJ", + "ZEND_ASSIGN_OBJ", + NULL, + "ZEND_INSTANCEOF", + "ZEND_DECLARE_CLASS", + "ZEND_DECLARE_INHERITED_CLASS", + "ZEND_DECLARE_FUNCTION", + "ZEND_RAISE_ABSTRACT_ERROR", + "ZEND_DECLARE_CONST", + "ZEND_ADD_INTERFACE", + "ZEND_DECLARE_INHERITED_CLASS_DELAYED", + "ZEND_VERIFY_ABSTRACT_CLASS", + "ZEND_ASSIGN_DIM", + "ZEND_ISSET_ISEMPTY_PROP_OBJ", + "ZEND_HANDLE_EXCEPTION", + "ZEND_USER_OPCODE", + NULL, + "ZEND_JMP_SET", + "ZEND_DECLARE_LAMBDA_FUNCTION", + "ZEND_ADD_TRAIT", + "ZEND_BIND_TRAITS", + "ZEND_SEPARATE", + "ZEND_QM_ASSIGN_VAR", + "ZEND_JMP_SET_VAR", +}; + +ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) { + return zend_vm_opcodes_map[opcode]; +} diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 94e69abf1e..f9a165bd42 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -18,6 +18,11 @@ +----------------------------------------------------------------------+ */ +#ifndef ZEND_VM_OPCODES_H +#define ZEND_VM_OPCODES_H + +ZEND_API const char *zend_get_opcode_name(zend_uchar opcode); + #define ZEND_NOP 0 #define ZEND_ADD 1 #define ZEND_SUB 2 @@ -159,3 +164,5 @@ #define ZEND_SEPARATE 156 #define ZEND_QM_ASSIGN_VAR 157 #define ZEND_JMP_SET_VAR 158 + +#endif
\ No newline at end of file diff --git a/configure.in b/configure.in index 8a6e9d7df5..c57c343520 100644 --- a/configure.in +++ b/configure.in @@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...); PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=4 -PHP_RELEASE_VERSION=24 +PHP_RELEASE_VERSION=25 PHP_EXTRA_VERSION="-dev" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` @@ -1467,7 +1467,7 @@ PHP_ADD_SOURCES(Zend, \ zend_ini_parser.c zend_ini_scanner.c \ zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c zend_dtrace.c \ zend_execute_API.c zend_highlight.c zend_llist.c \ - zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \ + zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \ zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \ zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \ zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \ diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index b82017e21f..fce9ecf841 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -178,6 +178,10 @@ ftp_close(ftpbuf_t *ftp) if (ftp->data) { data_close(ftp, ftp->data); } + if (ftp->stream && ftp->closestream) { + TSRMLS_FETCH(); + php_stream_close(ftp->stream); + } if (ftp->fd != -1) { #if HAVE_OPENSSL_EXT if (ftp->ssl_active) { diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 21e13ea460..99f3808c38 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -963,6 +963,7 @@ PHP_FUNCTION(ftp_nb_get) if ((ret = ftp_nb_get(ftp, outstream, remote, xtype, resumepos TSRMLS_CC)) == PHP_FTP_FAILED) { php_stream_close(outstream); + ftp->stream = NULL; VCWD_UNLINK(local); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); RETURN_LONG(PHP_FTP_FAILED); @@ -970,6 +971,7 @@ PHP_FUNCTION(ftp_nb_get) if (ret == PHP_FTP_FINISHED){ php_stream_close(outstream); + ftp->stream = NULL; } RETURN_LONG(ret); @@ -1003,6 +1005,7 @@ PHP_FUNCTION(ftp_nb_continue) if (ret != PHP_FTP_MOREDATA && ftp->closestream) { php_stream_close(ftp->stream); + ftp->stream = NULL; } if (ret == PHP_FTP_FAILED) { @@ -1214,6 +1217,7 @@ PHP_FUNCTION(ftp_nb_put) if (ret != PHP_FTP_MOREDATA) { php_stream_close(instream); + ftp->stream = NULL; } if (ret == PHP_FTP_FAILED) { diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index 89b67210c5..e0d7e62f23 100644 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -551,7 +551,8 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) struct pdo_column_data *col = &stmt->columns[colno]; RETCODE rc; SWORD colnamelen; - SDWORD colsize, displaysize; + SDWORD colsize; + SQLLEN displaysize; rc = SQLDescribeCol(S->stmt, colno+1, S->cols[colno].colname, sizeof(S->cols[colno].colname)-1, &colnamelen, diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 1bf0b3a4da..6a4eca5f03 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -896,6 +896,12 @@ retry: keepwalking = 1; } } else { + if (st & SNMP_CMD_WALK && response->errstat == SNMP_ERR_TOOBIG && objid_query->max_repetitions > 1) { /* Answer will not fit into single packet */ + objid_query->max_repetitions /= 2; + snmp_free_pdu(response); + keepwalking = 1; + continue; + } if (!(st & SNMP_CMD_WALK) || response->errstat != SNMP_ERR_NOSUCHNAME || Z_TYPE_P(return_value) == IS_BOOL) { for ( count=1, vars = response->variables; vars && count != response->errindex; diff --git a/main/SAPI.c b/main/SAPI.c index dcb2da629a..9ffc2580a7 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -137,6 +137,7 @@ PHP_FUNCTION(header_register_callback) efree(callback_name); RETURN_FALSE; } + efree(callback_name); if (SG(callback_func)) { @@ -144,10 +145,10 @@ PHP_FUNCTION(header_register_callback) SG(fci_cache) = empty_fcall_info_cache; } - Z_ADDREF_P(callback_func); - SG(callback_func) = callback_func; - + + Z_ADDREF_P(SG(callback_func)); + RETURN_TRUE; } /* }}} */ @@ -156,24 +157,30 @@ static void sapi_run_header_callback(TSRMLS_D) { int error; zend_fcall_info fci; + char *callback_name = NULL; + char *callback_error = NULL; zval *retval_ptr = NULL; - - fci.size = sizeof(fci); - fci.function_table = EG(function_table); - fci.object_ptr = NULL; - fci.function_name = SG(callback_func); - fci.retval_ptr_ptr = &retval_ptr; - fci.param_count = 0; - fci.params = NULL; - fci.no_separation = 0; - fci.symbol_table = NULL; - - error = zend_call_function(&fci, &SG(fci_cache) TSRMLS_CC); - if (error == FAILURE) { + + if (zend_fcall_info_init(SG(callback_func), 0, &fci, &SG(fci_cache), &callback_name, &callback_error TSRMLS_CC) == SUCCESS) { + fci.retval_ptr_ptr = &retval_ptr; + + error = zend_call_function(&fci, &SG(fci_cache) TSRMLS_CC); + if (error == FAILURE) { + goto callback_failed; + } else if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + } else { +callback_failed: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the sapi_header_callback"); - } else if (retval_ptr) { - zval_ptr_dtor(&retval_ptr); } + + if (callback_name) { + efree(callback_name); + } + if (callback_error) { + efree(callback_error); + } } SAPI_API void sapi_handle_post(void *arg TSRMLS_DC) diff --git a/main/php_version.h b/main/php_version.h index 89fb515acc..213cd5386d 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 4 -#define PHP_RELEASE_VERSION 24 +#define PHP_RELEASE_VERSION 25 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.4.24-dev" -#define PHP_VERSION_ID 50424 +#define PHP_VERSION "5.4.25-dev" +#define PHP_VERSION_ID 50425 diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 1a4b834be4..f025ae2f39 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -352,7 +352,7 @@ ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \ zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \ zend_constants.c zend_dynamic_array.c zend_exceptions.c \ zend_execute_API.c zend_highlight.c \ - zend_llist.c zend_opcode.c zend_operators.c zend_ptr_stack.c \ + zend_llist.c zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c \ zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \ zend_hash.c zend_list.c zend_indent.c zend_builtin_functions.c \ zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \ |