diff options
| author | Xinchen Hui <laruence@php.net> | 2014-07-19 13:12:36 +0800 |
|---|---|---|
| committer | Xinchen Hui <laruence@php.net> | 2014-07-19 13:12:36 +0800 |
| commit | 9bef96d96e2858f449e03bffb5d801102f550f56 (patch) | |
| tree | 4b0c75789d9fc375f17bfdb1e3023a11148a8c97 /ext/session | |
| parent | 0d01891799280a015b5e8527296294aa9af81b68 (diff) | |
| parent | 629c1ecd4f6576f801e346de8c593bde116c9372 (diff) | |
| download | php-git-9bef96d96e2858f449e03bffb5d801102f550f56.tar.gz | |
Merge branch 'PHP-5.5' into PHP-5.6
Diffstat (limited to 'ext/session')
| -rw-r--r-- | ext/session/session.c | 22 | ||||
| -rw-r--r-- | ext/session/tests/bug66827.phpt | 12 |
2 files changed, 25 insertions, 9 deletions
diff --git a/ext/session/session.c b/ext/session/session.c index 1d60c40188..6412043673 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1444,9 +1444,16 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC) /* {{{ } /* }}} */ -#define PPID2SID \ - convert_to_string((*ppid)); \ - PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid)) +static void ppid2sid(zval **ppid TSRMLS_DC) { + if (Z_TYPE_PP(ppid) != IS_STRING) { + PS(id) = NULL; + PS(send_cookie) = 1; + } else { + convert_to_string((*ppid)); + PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid)); + PS(send_cookie) = 0; + } +} PHPAPI void php_session_reset_id(TSRMLS_D) /* {{{ */ { @@ -1540,9 +1547,8 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ Z_TYPE_PP(data) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS ) { - PPID2SID; + ppid2sid(ppid TSRMLS_CC); PS(apply_trans_sid) = 0; - PS(send_cookie) = 0; PS(define_sid) = 0; } @@ -1551,8 +1557,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ Z_TYPE_PP(data) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS ) { - PPID2SID; - PS(send_cookie) = 0; + ppid2sid(ppid TSRMLS_CC); } if (!PS(use_only_cookies) && !PS(id) && @@ -1560,8 +1565,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ Z_TYPE_PP(data) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS ) { - PPID2SID; - PS(send_cookie) = 0; + ppid2sid(ppid TSRMLS_CC); } } diff --git a/ext/session/tests/bug66827.phpt b/ext/session/tests/bug66827.phpt new file mode 100644 index 0000000000..4e1a4f7aea --- /dev/null +++ b/ext/session/tests/bug66827.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #66827: Session raises E_NOTICE when session name variable is array. +--INI-- +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php +$_COOKIE[session_name()] = array(); +session_start(); +echo 'OK'; +--EXPECTF-- +OK |
