com php-src: Merge branch 'master' into phpng: Zend/zend_comp ile.c ext/pdo/pdo_sql_parser.c ext/pdo/pdo_sql_ parser.re ext/session/session.c
ext/sockets/sendrecvmsg .c ext/spl/spl_array.c ext/spl/spl_dllist.c ext /spl/spl_observer.c ext/standard/array.c ext/standard /head.c
ext/standard/http_fopen_wrapper.c ext/stand ard/url_scanner_ex.c ext/standard/url_scanner_ex. re ext/standard/var_unserializer.c ext/standard/var_u
nserializer.re main/SAPI.c sapi/cl

From: Date: Wed, 18 Jun 2014 13:50:27 +0000
Subject: com php-src: Merge branch 'master' into phpng: Zend/zend_comp ile.c ext/pdo/pdo_sql_parser.c ext/pdo/pdo_sql_ parser.re ext/session/session.c
ext/sockets/sendrecvmsg .c ext/spl/spl_array.c ext/spl/spl_dllist.c ext /spl/spl_observer.c ext/standard/array.c ext/standard /head.c
ext/standard/http_fopen_wrapper.c ext/stand ard/url_scanner_ex.c ext/standard/url_scanner_ex. re ext/standard/var_unserializer.c ext/standard/var_u
nserializer.re main/SAPI.c sapi/cl
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-78949@lists.php.net to get a copy of this message
Commit: b108267f2c5c09bd153cfb1d4e580d5fc9c52d51 Author: Dmitry Stogov <dmitry@zend.com> Wed, 18 Jun 2014 17:50:27 +0400 Parents: a4f38192ecbbc7ece3a6070b8bac4468e890f476 eba7c7768553d67d37488f844847d51ec358efff Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b108267f2c5c09bd153cfb1d4e580d5fc9c52d51 Log: Merge branch 'master' into phpng * master: (41 commits) Update copyright year to 2014 Update copyright year to 2014 Update copyright year to 2014 Update copyright year to 2014 Update copyright year to 2014 Update copyright year to 2014 Update copyright year to 2014 NEWS Fix Request #67453 Allow to unserialize empty data. Update copyright year to 2014 Update copyright year for re2c generated files Update copyright year to 2014 Update copyright year for re2c files as well Fix patch for bug #67436 fix failed test Fix test on modern distro where old unsecure algo are disabled in openssl config. Testing recent algo should be enough to check this function. Added tests for bug 67436 Fixed wrong XFAIL test - already fixed Fix typo in Bug #67406 NEWS entry Fix typo in Bug #67406 NEWS entry ... Conflicts: Zend/zend_compile.c ext/session/session.c ext/standard/array.c ext/standard/http_fopen_wrapper.c tests/classes/bug63462.phpt Bugs: https://bugs.php.net/67453 https://bugs.php.net/67436 https://bugs.php.net/67406 https://bugs.php.net/63462 Changed paths: MM Zend/zend_compile.c MM ext/pdo/pdo_sql_parser.c MM ext/pdo/pdo_sql_parser.re MM ext/session/session.c MM ext/sockets/sendrecvmsg.c MM ext/spl/spl_array.c MM ext/spl/spl_dllist.c MM ext/spl/spl_observer.c MM ext/standard/array.c MM ext/standard/head.c MM ext/standard/http_fopen_wrapper.c MM ext/standard/url_scanner_ex.c MM ext/standard/url_scanner_ex.re MM ext/standard/var_unserializer.c MM ext/standard/var_unserializer.re MM main/SAPI.c MM sapi/cli/php_cli_server.c

diff --cc Zend/zend_compile.c index d414a46,7c979d5..c611669 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@@ -3461,41 -3455,54 +3461,45 @@@ static char * zend_get_function_declara } } if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) { - zval zv; - zval *zv, zv_copy; - int use_copy; - ALLOC_ZVAL(zv); - *zv = *precv->op2.zv; - zval_copy_ctor(zv); - INIT_PZVAL(zv); - if ((Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { ++ zval *zv = precv->op2.zv; + - ZVAL_DUP(&zv, precv->op2.zv); - zval_update_constant_ex(&zv, 1, fptr->common.scope TSRMLS_CC); - if (Z_TYPE(zv) == IS_FALSE) { ++ if (Z_TYPE_P(zv) == IS_CONSTANT) { + REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN_P(zv)); + memcpy(offset, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); + offset += Z_STRLEN_P(zv); - } else if (Z_TYPE_P(zv) == IS_BOOL) { - if (Z_LVAL_P(zv)) { - memcpy(offset, "true", 4); - offset += 4; - } else { - memcpy(offset, "false", 5); - offset += 5; - } ++ } else if (Z_TYPE_P(zv) == IS_FALSE) { + memcpy(offset, "false", 5); + offset += 5; - } else if (Z_TYPE(zv) == IS_TRUE) { ++ } else if (Z_TYPE_P(zv) == IS_TRUE) { + memcpy(offset, "true", 4); + offset += 4; - } else if (Z_TYPE(zv) == IS_NULL) { + } else if (Z_TYPE_P(zv) == IS_NULL) { memcpy(offset, "NULL", 4); offset += 4; - } else if (Z_TYPE(zv) == IS_STRING) { + } else if (Z_TYPE_P(zv) == IS_STRING) { *(offset++) = '\''; - REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRLEN(zv), 10)); - memcpy(offset, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 10)); - offset += MIN(Z_STRLEN(zv), 10); - if (Z_STRLEN(zv) > 10) { + REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRLEN_P(zv), 10)); + memcpy(offset, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 10)); + offset += MIN(Z_STRLEN_P(zv), 10); + if (Z_STRLEN_P(zv) > 10) { *(offset++) = '.'; *(offset++) = '.'; *(offset++) = '.'; } *(offset++) = '\''; - } else if (Z_TYPE(zv) == IS_ARRAY) { + } else if (Z_TYPE_P(zv) == IS_ARRAY) { memcpy(offset, "Array", 5); offset += 5; - } else if ((Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_AST) { ++ } else if (Z_TYPE_P(zv) == IS_CONSTANT_AST) { + memcpy(offset, "<expression>", 12); + offset += 12; } else { - zend_string *str = zval_get_string(&zv); - zend_make_printable_zval(zv, &zv_copy, &use_copy); - REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN(zv_copy)); - memcpy(offset, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy)); - offset += Z_STRLEN(zv_copy); - if (use_copy) { - zval_dtor(&zv_copy); - } ++ zend_string *str = zval_get_string(zv); + REALLOC_BUF_IF_EXCEED(buf, offset, length, str->len); + memcpy(offset, str->val, str->len); + offset += str->len; + STR_RELEASE(str); } -- zval_ptr_dtor(&zv); } } else { memcpy(offset, "NULL", 4); diff --cc ext/session/session.c index c39e954,d6568bd..529e6ee --- a/ext/session/session.c +++ b/ext/session/session.c @@@ -1324,16 -1352,16 +1317,16 @@@ static void php_session_send_cookie(TSR } /* URL encode session_name and id because they might be user supplied */ - e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name)), NULL); - e_id = php_url_encode(PS(id), strlen(PS(id)), NULL); + e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name))); + e_id = php_url_encode(PS(id)->val, PS(id)->len); - smart_str_appends(&ncookie, COOKIE_SET_COOKIE); - smart_str_appends(&ncookie, "Set-Cookie: "); - smart_str_appends(&ncookie, e_session_name); ++ smart_str_appendl(&ncookie, "Set-Cookie: ", sizeof("Set-Cookie: ")-1); + smart_str_appendl(&ncookie, e_session_name->val, e_session_name->len); smart_str_appendc(&ncookie, '='); - smart_str_appends(&ncookie, e_id); + smart_str_appendl(&ncookie, e_id->val, e_id->len); - efree(e_session_name); - efree(e_id); + STR_RELEASE(e_session_name); + STR_RELEASE(e_id); if (PS(cookie_lifetime) > 0) { struct timeval tv; diff --cc ext/standard/array.c index b8b57d7,54e8951..e1113a8 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@@ -324,14 -333,16 +324,14 @@@ PHP_FUNCTION(count #ifdef HAVE_SPL /* if not and the object implements Countable we call its count() method */ if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) { - zval *mode_zv; - MAKE_STD_ZVAL(mode_zv); - ZVAL_LONG(mode_zv, mode); - zend_call_method_with_1_params(&array, NULL, NULL, "count", &retval, mode_zv); - if (retval) { - convert_to_long_ex(&retval); - RETVAL_LONG(Z_LVAL_P(retval)); + zval mode_zv; + ZVAL_LONG(&mode_zv, mode); + zend_call_method_with_1_params(array, NULL, NULL, "count", &retval, &mode_zv); + if (Z_TYPE(retval) != IS_UNDEF) { + RETVAL_LONG(zval_get_long(&retval)); zval_ptr_dtor(&retval); } - zval_dtor(&mode_zv); + zval_ptr_dtor(&mode_zv); return; } #endif diff --cc ext/standard/head.c index 7c4b963,0316903..ad82b9f --- a/ext/standard/head.c +++ b/ext/standard/head.c @@@ -124,22 -124,22 +124,22 @@@ PHPAPI int php_setcookie(char *name, in if (expires > 0) { const char *p; char tsdelta[13]; - strlcat(cookie, "; expires=", len + 100); + strlcat(cookie, COOKIE_EXPIRES, len + 100); dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, expires, 0 TSRMLS_CC); /* check to make sure that the year does not exceed 4 digits in length */ - p = zend_memrchr(dt, '-', strlen(dt)); + p = zend_memrchr(dt->val, '-', dt->len); if (!p || *(p + 5) != ' ') { - efree(dt); + STR_FREE(dt); efree(cookie); - efree(encoded_value); + STR_FREE(encoded_value); zend_error(E_WARNING, "Expiry date cannot have a year greater than 9999"); return FAILURE; } - strlcat(cookie, dt, len + 100); - efree(dt); + strlcat(cookie, dt->val, len + 100); + STR_FREE(dt); snprintf(tsdelta, sizeof(tsdelta), "%li", (long) difftime(expires, time(NULL))); - strlcat(cookie, "; Max-Age=", len + 100); + strlcat(cookie, COOKIE_MAX_AGE, len + 100); strlcat(cookie, tsdelta, len + 100); } } diff --cc ext/standard/http_fopen_wrapper.c index 7cfc07e,ce4c2ba..2b10370 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@@ -724,12 -748,15 +724,13 @@@ finish http_header_line[http_header_line_length] = '\0'; if (!strncasecmp(http_header_line, "Location: ", 10)) { - if (context && php_stream_context_get_option(context, "http", "follow_location", &tmpzval) == SUCCESS) { - SEPARATE_ZVAL(tmpzval); - convert_to_long_ex(tmpzval); - follow_location = Z_LVAL_PP(tmpzval); + if (context && (tmpzval = php_stream_context_get_option(context, "http", "follow_location")) != NULL) { + follow_location = zval_get_long(tmpzval); - } else if (!((response_code >= 300 && response_code < 304) || 307 == response_code)) { + } else if (!(response_code >= 300 && response_code < 304 || 307 == response_code || 308 == response_code)) { /* we shouldn't redirect automatically if follow_location isn't set and response_code not in (300, 301, 302, 303 and 307) - see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1 */ + see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1 + RFC 7238 defines 308: http://tools.ietf.org/html/rfc7238 */ follow_location = 0; } strlcpy(location, http_header_line + 10, sizeof(location)); diff --cc main/SAPI.c index 49bd6ff,03be1e6..e587f7a --- a/main/SAPI.c +++ b/main/SAPI.c @@@ -817,13 -821,11 +817,13 @@@ SAPI_API int sapi_header_op(sapi_header * do disable compression altogether. This contributes to making scripts * portable between setups that have and don't have zlib compression * enabled globally. See req #44164 */ - zend_alter_ini_entry("zlib.output_compression", sizeof("zlib.output_compression"), + zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); + zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + STR_RELEASE(key); } else if (!STRCASECMP(header_line, "Location")) { if ((SG(sapi_headers).http_response_code < 300 || - SG(sapi_headers).http_response_code > 307) && + SG(sapi_headers).http_response_code > 399) && SG(sapi_headers).http_response_code != 201) { /* Return a Found Redirect if one is not already specified */ if (http_response_code) { /* user specified redirect code */
« previous php.cvs (#78949) next »