]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6' into PHP-7.0
authorYasuo Ohgaki <yohgaki@php.net>
Fri, 15 Jan 2016 01:19:01 +0000 (10:19 +0900)
committerYasuo Ohgaki <yohgaki@php.net>
Fri, 15 Jan 2016 01:19:01 +0000 (10:19 +0900)
* PHP-5.6:
  Improved fix for bug #68063 (Empty session IDs do still start sessions).

1  2 
NEWS
ext/session/session.c

diff --cc NEWS
index 01381cc4c6df48ebbc4746e20994ff5a5bb5f4c6,b5771a4f695d3f49f81b72caa16963f30de9132a..063a66e205fc9ca1bf51f8d25d4b297d011a6390
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -40,64 -36,25 +40,65 @@@ PH
  - SPL:
    . Fixed bug #71204 (segfault if clean spl_autoload_funcs while autoloading).
      (Laruence)
 +  . Fixed bug #71202 (Autoload function registered by another not activated
 +    immediately). (Laruence)
 +
 +- Session:
++  . Improved fix for bug #68063 (Empty session IDs do still start sessions). (Yasuo)
 +  . Fixed bug #71038 (session_start() returns TRUE on failure).
 +    Session save handlers must return 'string' always for successful read.
 +    i.e. Non-existing session read must return empty string. PHP 7.0 is made
 +    not to tolerate buggy return value. (Yasuo)
  
  - Standard:
 +  . Fixed bug #71287 (Error message contains hexadecimal instead of decimal
 +    number). (Laruence)
 +  . Fixed bug #71264 (file_put_contents() returns unexpected value when 
 +    filesystem runs full). (Laruence)
 +  . Fixed bug #71245 (file_get_contents() ignores "header" context option if
 +    it's a reference). (Laruence)
 +  . Fixed bug #71220 (Null pointer deref (segfault) in compact via ob_start).
 +    (hugh at allthethings dot co dot nz)
 +  . Fixed bug #71190 (substr_replace converts integers in original $search
 +    array to strings). (Laruence)
 +  . Fixed bug #71188 (str_replace converts integers in original $search array
 +    to strings). (Laruence)
    . Fixed bug #70720 (strip_tags improper php code parsing). (Julien)
 +  . Fixed bug #71132, #71197 (range() segfaults). (Thomas Punt)
  
 -07 Jan 2016, PHP 5.6.17
 +07 Jan 2016 PHP 7.0.2
  
  - Core:
 +  . Fixed bug #71165 (-DGC_BENCH=1 doesn't work on PHP7).
 +    (y dot uchiyama dot 1015 at gmail dot com)
 +  . Fixed bug #71163 (Segmentation Fault: cleanup_unfinished_calls). (Laruence)
 +  . Fixed bug #71109 (ZEND_MOD_CONFLICTS("xdebug") doesn't work). (Laruence)
 +  . Fixed bug #71092 (Segmentation fault with return type hinting). (Laruence)
 +  . Fixed bug memleak in header_register_callback. (Laruence)
 +  . Fixed bug #71067 (Local object in class method stays in memory for each
 +    call). (Laruence)
    . Fixed bug #66909 (configure fails utf8_to_mutf7 test). (Michael Orlitzky)
 -  . Fixed bug #70958 (Invalid opcode while using ::class as trait method
 -    paramater default value). (Laruence)
 -  . Fixed bug #70957 (self::class can not be resolved with reflection for
 -    abstract class). (Laruence)
 -  . Fixed bug #70944 (try{ } finally{} can create infinite chains of
 -    exceptions). (Laruence)
 -  . Fixed bug #61751 (SAPI build problem on AIX: Undefined symbol:
 -    php_register_internal_extensions). (Lior Kaplan)
 +  . Fixed bug #70781 (Extension tests fail on dynamic ext dependency).
 +    (Francois Laupretre)
 +  . Fixed bug #71089 (No check to duplicate zend_extension). (Remi)
 +  . Fixed bug #71086 (Invalid numeric literal parse error within
 +    highlight_string() function). (Nikita)
 +  . Fixed bug #71154 (Incorrect HT iterator invalidation causes iterator reuse).
 +    (Nikita)
 +  . Fixed bug #52355 (Negating zero does not produce negative zero). (Andrea)
 +  . Fixed bug #66179 (var_export() exports float as integer). (Andrea)
 +  . Fixed bug #70804 (Unary add on negative zero produces positive zero).
 +    (Andrea)
  
 -- FPM:
 -  . Fixed bug #70755 (fpm_log.c memory leak and buffer overflow). (Stas)
 +- CURL:
 +  . Fixed bug #71144 (Sementation fault when using cURL with ZTS).
 +    (Michael Maroszek, Laruence)
 +
 +- DBA:
 +  . Fixed key leak with invalid resource. (Laruence)
 +
 +- Filter:
 +  . Fixed bug #71063 (filter_input(INPUT_ENV, ..) does not work). (Reeze Xia)
  
  - GD:
    . Fixed bug #70976 (Memory Read via gdImageRotateInterpolated Array Index
index f5a399b75f55277cf4555e7f2857b9ab251c462f,ffb6fb381bb6fbfb4b38d8f1c0972d1478855482..4b0643d021e16ada0ad78271bce8b1d02a0c67d9
@@@ -522,11 -512,14 +522,14 @@@ static void php_session_initialize(void
        }
  
        /* If there is no ID, use session module to create one */
-       if (!PS(id)) {
 -      if (!PS(id) || !PS(id)[0]) {
++      if (!PS(id) || !ZSTR_VAL(PS(id))[0]) {
+               if (PS(id)) {
+                       efree(PS(id));
+               }
 -              PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
 +              PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
                if (!PS(id)) {
 -                      php_session_abort(TSRMLS_C);
 -                      php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
 +                      php_session_abort();
 +                      php_error_docref(NULL, E_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
                        return;
                }
                if (PS(use_cookies)) {
@@@ -2256,66 -2100,13 +2259,61 @@@ static PHP_FUNCTION(session_decode
  }
  /* }}} */
  
 -/* {{{ proto bool session_start(void)
 -   Begin session - reinitializes freezed variables, registers browsers etc */
 +static int php_session_start_set_ini(zend_string *varname, zend_string *new_value) {
 +      int ret;
 +      smart_str buf ={0};
 +      smart_str_appends(&buf, "session");
 +      smart_str_appendc(&buf, '.');
 +      smart_str_append(&buf, varname);
 +      smart_str_0(&buf);
 +      ret = zend_alter_ini_entry_ex(buf.s, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0);
 +      smart_str_free(&buf);
 +      return ret;
 +}
 +
 +/* {{{ proto bool session_start([array options])
 ++   Begin session */
  static PHP_FUNCTION(session_start)
  {
 -      /* skipping check for non-zero args for performance reasons here ?*/
 +      zval *options = NULL;
 +      zval *value;
 +      zend_ulong num_idx;
 +      zend_string *str_idx;
 +      zend_long read_and_close = 0;
  
 -      php_session_start(TSRMLS_C);
 +      if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a", &options) == FAILURE) {
 +              RETURN_FALSE;
 +      }
 +
-       if (PS(id) && !(ZSTR_LEN(PS(id)))) {
-               php_error_docref(NULL, E_WARNING, "Cannot start session with empty session ID");
-               RETURN_FALSE;
-       }
 +      /* set options */
 +      if (options) {
 +              ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), num_idx, str_idx, value) {
 +                      if (str_idx) {
 +                              switch(Z_TYPE_P(value)) {
 +                                      case IS_STRING:
 +                                      case IS_TRUE:
 +                                      case IS_FALSE:
 +                                      case IS_LONG:
 +                                              if (zend_string_equals_literal(str_idx, "read_and_close")) {
 +                                                      read_and_close = zval_get_long(value);
 +                                              } else {
 +                                                      zend_string *val = zval_get_string(value);
 +                                                      if (php_session_start_set_ini(str_idx, val) == FAILURE) {
 +                                                              php_error_docref(NULL, E_WARNING, "Setting option '%s' failed", ZSTR_VAL(str_idx));
 +                                                      }
 +                                                      zend_string_release(val);
 +                                              }
 +                                              break;
 +                                      default:
 +                                              php_error_docref(NULL, E_WARNING, "Option(%s) value must be string, boolean or long", ZSTR_VAL(str_idx));
 +                                              break;
 +                              }
 +                      }
 +                      (void) num_idx;
 +              } ZEND_HASH_FOREACH_END();
 +      }
 +
 +      php_session_start();
  
        if (PS(session_status) != php_session_active) {
                RETURN_FALSE;