]> granicus.if.org Git - php/commitdiff
Merge branch 'master' into test
authorDmitry Stogov <dmitry@zend.com>
Mon, 7 Jul 2014 15:21:23 +0000 (19:21 +0400)
committerDmitry Stogov <dmitry@zend.com>
Mon, 7 Jul 2014 15:21:23 +0000 (19:21 +0400)
* 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

13 files changed:
1  2 
.travis.yml
Zend/zend_generators.c
ext/intl/formatter/formatter_parse.c
ext/intl/php_intl.c
ext/opcache/zend_accelerator_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
main/SAPI.c
main/streams/memory.c

diff --cc .travis.yml
Simple merge
Simple merge
Simple merge
Simple merge
index 93999af11f7c2b3543b3b3dd868bccf29452a1eb,33103e54d1f89f915da6155312ad273eea016e38..ad5f44baa00c38538e7383917822f821d0de4573
@@@ -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 {
Simple merge
index 21f52a1db0704626d68162e2ec69fe1a54751c1e,6720987580925068a42548f3652b31ee4d5eb4d6..7996575cd4e5a0968c6ab3a432209d34a3229e0f
@@@ -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)
index 24556b532c1efabcf605e4bd40fde2908862c30f,c631c187c9ec87f0baaa764be0cb72bdd81a7287..385c029794f32dc782a312f9fbe41300ee56e491
@@@ -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) {
                return;
        }
  
 -      if (aht->nApplyCount > 0) {
+       aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
++      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);
index 929fdd8798f41dd0b830c17315af415cc5e4e2bf,c48736ec6c01ec63fb7c312a5dbfc697b4b01871..09d874645d908ea39ed681a233178ad2e3046216
@@@ -897,8 -914,13 +895,12 @@@ SPL_METHOD(SplDoublyLinkedList, offsetU
                        llist->dtor(element TSRMLS_CC);
                }
  
 -
 -              zval_ptr_dtor((zval **)&element->data);
 -              element->data = NULL;
+               if (intern->traverse_pointer == element) {
+                       SPL_LLIST_DELREF(element);
+                       intern->traverse_pointer = NULL;
+               }
 +              zval_ptr_dtor(&element->data);
 +              ZVAL_UNDEF(&element->data);
  
                SPL_LLIST_DELREF(element);
        } else {
index 897eaa7be835d1fb43617b445fea24a255adb591,10ed693f0129a38ea4e9aaa2494c9693fe70279b..1b148499542555bf6da3e08027b5f8acf8447fff
@@@ -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);
index bd0c0de31b86ab2bfba959255176f8ff8205b411,8df4be7facf143875ca36fda089daaf0b6b3acc6..fe51f48d524449f174e0d16aaf2909a2a9d524bf
@@@ -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/SAPI.c
Simple merge
index 89bd59e21533d15e4f4576aef3083ee29caf029f,09421ea49de5ab4b03162c137c46df02020207fa..5da0c8decd192bce92f9aa268dda6887082fe68f
@@@ -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);