com php-src: Merge branch 'master' into test: .travis.yml Zend/zend_generators.c ext/intl/formatter/formatter_par se.c ext/intl/php_intl.c
ext/opcache/zend_accelerat or_util_funcs.c ext/pgsql/pgsql.c ext/session/mod _user.c ext/spl/spl_array.c ext/spl/spl_dllist. c ext/standard/file.c
ext/standard/streamsfuncs.c mai n/SAPI.c main/streams/memory.c

From: Date: Mon, 07 Jul 2014 15:21:23 +0000
Subject: com php-src: Merge branch 'master' into test: .travis.yml Zend/zend_generators.c ext/intl/formatter/formatter_par se.c ext/intl/php_intl.c
ext/opcache/zend_accelerat or_util_funcs.c ext/pgsql/pgsql.c ext/session/mod _user.c ext/spl/spl_array.c ext/spl/spl_dllist. c ext/standard/file.c
ext/standard/streamsfuncs.c mai n/SAPI.c main/streams/memory.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-79290@lists.php.net to get a copy of this message
Commit: bce6a36c8a13d718cc308e4e48724c799863459a Author: Dmitry Stogov <dmitry@zend.com> Mon, 7 Jul 2014 19:21:23 +0400 Parents: 477bd49ccab2a10c421a51f512d593251ef7adef f0499b86a8b83204eab14e25eb7cb15536f9e69f Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bce6a36c8a13d718cc308e4e48724c799863459a Log: Merge branch 'master' into test * master: (48 commits) change locale - looks like not everybody has sl_SI Fix bug #66921 - Wrong argument type hint for function intltz_from_date_time_zone fix format Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting) Make sure the generator script also creates a newline at the end of file Add newline at end of file to prevent compilation warning Fix handling of session user module custom handlers. Reference bug report instead of github issue in NEWS file add more exts for Travis Update NEWS Fix phpdbg.1 man page installation when build != src directory BFN for bug #67551 (php://input temp file will be located in sys_temp_dir instead of upload_tmp_dir) reorder restore API compatibility finish refactor php_stream_temp_create{,_ex} and use it for the php://input stream refactor _php_stream_fopen_{temporary_,tmp}file() fix length overflow of HTTP_RAW_POST_DATA Update NEWS Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen) ... Conflicts: ext/opcache/zend_accelerator_util_funcs.c ext/session/mod_user.c ext/spl/spl_array.c ext/spl/spl_dllist.c ext/standard/file.c ext/standard/streamsfuncs.c ext/standard/string.c main/streams/memory.c Bugs: https://bugs.php.net/66921 https://bugs.php.net/67052 https://bugs.php.net/67551 https://bugs.php.net/67215 Changed paths: MM .travis.yml MM Zend/zend_generators.c MM ext/intl/formatter/formatter_parse.c MM ext/intl/php_intl.c MM ext/opcache/zend_accelerator_util_funcs.c MM ext/pgsql/pgsql.c MM ext/session/mod_user.c MM ext/spl/spl_array.c MM ext/spl/spl_dllist.c MM ext/standard/file.c MM ext/standard/streamsfuncs.c MM main/SAPI.c MM main/streams/memory.c Diff: diff --cc ext/opcache/zend_accelerator_util_funcs.c index 93999af,33103e5..ad5f44b --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@@ -795,36 -883,32 +795,25 @@@ static void zend_class_copy_ctor(zend_c #endif } -static int zend_hash_unique_copy(HashTable *target, HashTable *source, unique_copy_ctor_func_t pCopyConstructor, uint size, int ignore_dups, void **fail_data, void **conflict_data) +static void zend_accel_function_hash_copy(HashTable *target, HashTable *source, unique_copy_ctor_func_t pCopyConstructor TSRMLS_DC) { + zend_function *function1, *function2; + uint idx; Bucket *p; - void *t; - - p = source->pListHead; - while (p) { - if (p->nKeyLength > 0) { - if (zend_hash_quick_add(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t) == SUCCESS) { - if (pCopyConstructor) { - pCopyConstructor(t); - } - } else { - if (p->nKeyLength > 0 && p->arKey[0] == 0) { + zval *t; + + for (idx = 0; idx < source->nNumUsed; idx++) { + p = source->arData + idx; + if (Z_TYPE(p->val) == IS_UNDEF) continue; + if (p->key) { + t = zend_hash_add(target, p->key, &p->val); + if (UNEXPECTED(t == NULL)) { + if (p->key->len > 0 && p->key->val[0] == 0) { /* Mangled key */ --#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO - if (((zend_function*)Z_PTR(p->val))->common.fn_flags & ZEND_ACC_CLOSURE) { - /* update closure */ - t = zend_hash_update(target, p->key, &p->val); - } else { - /* ignore and wait for runtime */ - continue; - } - #else - /* ignore and wait for runtime */ - continue; - if (zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t) == SUCCESS) { - if (pCopyConstructor) { - pCopyConstructor(t); - } - } --#endif - } else if (!ignore_dups && zend_hash_quick_find(target, p->arKey, p->nKeyLength, p->h, &t) == SUCCESS) { - *fail_data = p->pData; - *conflict_data = t; - return FAILURE; ++ t = zend_hash_update(target, p->key, &p->val); + } else { + t = zend_hash_find(target, p->key); + goto failure; } } } else { diff --cc ext/session/mod_user.c index 21f52a1,6720987..7996575 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@@ -67,12 -68,22 +67,24 @@@ static void ps_call_handler(zval *func #define PSF(a) PS(mod_user_names).name.ps_##a - #define FINISH \ - if (!Z_ISUNDEF(retval)) { \ - convert_to_long(&retval); \ - ret = Z_LVAL(retval); \ - zval_ptr_dtor(&retval); \ - } \ + #define FINISH \ - if (retval) { \ - if (Z_TYPE_P(retval) == IS_BOOL) { \ - ret = Z_BVAL_P(retval) ? SUCCESS : FAILURE; \ - } else if ((Z_TYPE_P(retval) == IS_LONG) && (Z_LVAL_P(retval) == -1)) { \ ++ if (Z_TYPE(retval) != IS_UNDEF) { \ ++ if (Z_TYPE(retval) == IS_TRUE) { \ ++ ret = SUCCESS; \ ++ } else if (Z_TYPE(retval) == IS_FALSE) { \ ++ ret = FAILURE; \ ++ } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == -1)) { \ + /* BC for clever users - Deprecate me */ \ + ret = FAILURE; \ - } else if ((Z_TYPE_P(retval) == IS_LONG) && (Z_LVAL_P(retval) == 0)) { \ ++ } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == 0)) { \ + /* BC for clever users - Deprecate me */ \ + ret = SUCCESS; \ + } else { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session callback expects true/false return value"); \ + ret = FAILURE; \ ++ zval_ptr_dtor(&retval); \ + } \ - zval_ptr_dtor(&retval); \ + } \ return ret PS_OPEN_FUNC(user) diff --cc ext/spl/spl_array.c index 24556b5,c631c18..385c029 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@@ -1773,7 -1741,8 +1773,8 @@@ SPL_METHOD(Array, unserialize int buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; - zval *pmembers, *pflags = NULL; + zval members, zflags; + HashTable *aht; long flags; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { @@@ -1784,6 -1753,12 +1785,12 @@@ return; } + aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); - if (aht->nApplyCount > 0) { ++ if (aht->u.v.nApplyCount > 0) { + zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited"); + return; + } + /* storage */ s = p = (const unsigned char*)buf; PHP_VAR_UNSERIALIZE_INIT(var_hash); diff --cc ext/spl/spl_dllist.c index 929fdd8,c48736e..09d8746 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@@ -897,8 -914,13 +895,12 @@@ SPL_METHOD(SplDoublyLinkedList, offsetU llist->dtor(element TSRMLS_CC); } + if (intern->traverse_pointer == element) { + SPL_LLIST_DELREF(element); + intern->traverse_pointer = NULL; + } - - zval_ptr_dtor((zval **)&element->data); - element->data = NULL; + zval_ptr_dtor(&element->data); + ZVAL_UNDEF(&element->data); SPL_LLIST_DELREF(element); } else { diff --cc ext/standard/file.c index 897eaa7,10ed693..1b14849 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@@ -557,10 -558,16 +557,14 @@@ PHP_FUNCTION(file_get_contents RETURN_FALSE; } - if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) { - if (len > INT_MAX) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %ld to %d bytes", len, INT_MAX); - len = INT_MAX; - } - RETVAL_STRINGL(contents, len, 0); - } else if (len == 0) { - RETVAL_EMPTY_STRING(); ++ if (maxlen > INT_MAX) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "maxlen truncated from %ld to %d bytes", maxlen, INT_MAX); ++ maxlen = INT_MAX; ++ } + if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) { + RETVAL_STR(contents); } else { - RETVAL_FALSE; + RETVAL_EMPTY_STRING(); } php_stream_close(stream); diff --cc ext/standard/streamsfuncs.c index bd0c0de,8df4be7..fe51f48 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@@ -447,10 -438,16 +447,14 @@@ PHP_FUNCTION(stream_get_contents } } - len = php_stream_copy_to_mem(stream, &contents, maxlen, 0); - - if (contents) { - if (len > INT_MAX) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %ld to %d bytes", len, INT_MAX); - len = INT_MAX; - } - RETVAL_STRINGL(contents, len, 0); ++ if (maxlen > INT_MAX) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "maxlen truncated from %ld to %d bytes", maxlen, INT_MAX); ++ maxlen = INT_MAX; ++ } + if ((contents = php_stream_copy_to_mem(stream, maxlen, 0))) { + RETURN_STR(contents); } else { - RETVAL_EMPTY_STRING(); + RETURN_EMPTY_STRING(); } } /* }}} */ diff --cc main/streams/memory.c index 89bd59e,09421ea..5da0c8d --- a/main/streams/memory.c +++ b/main/streams/memory.c @@@ -351,7 -351,8 +351,8 @@@ typedef struct php_stream *innerstream; size_t smax; int mode; - zval* meta; + zval meta; + char* tmpdir; } php_stream_temp_data; @@@ -416,8 -417,14 +417,12 @@@ static int php_stream_temp_close(php_st ret = 0; } - if (ts->meta) { - zval_ptr_dtor(&ts->meta); - } + zval_ptr_dtor(&ts->meta); + if (ts->tmpdir) { + efree(ts->tmpdir); + } + efree(ts); return ret; @@@ -554,7 -561,9 +559,10 @@@ PHPAPI php_stream *_php_stream_temp_cre self = ecalloc(1, sizeof(*self)); self->smax = max_memory_usage; self->mode = mode; + ZVAL_UNDEF(&self->meta); + if (tmpdir) { + self->tmpdir = estrdup(tmpdir); + } stream = php_stream_alloc_rel(&php_stream_temp_ops, self, 0, mode & TEMP_STREAM_READONLY ? "rb" : "w+b"); stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; self->innerstream = php_stream_memory_create_rel(mode);

« previous php.cvs (#79290) next »