com php-src: Fixed bug #70876 (Segmentation fault when regenerating session id with strict mode): ext/session/session.c
ext/session/tests/bug70876.phpt

From: Date: Sun, 08 Nov 2015 03:36:22 +0000
Subject: com php-src: Fixed bug #70876 (Segmentation fault when regenerating session id with strict mode): ext/session/session.c
ext/session/tests/bug70876.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89680@lists.php.net to get a copy of this message
Commit: 22d3033ec689e5fc56dc165fff9bff9d6c13880c Author: Xinchen Hui <laruence@gmail.com> Sat, 7 Nov 2015 07:30:31 -0800 Committer: Anatol Belski <ab@php.net> Sun, 8 Nov 2015 04:36:22 +0100 Parents: 7d398b1fa851736bf70a2ac519bd826ce4faac40 Branches: PHP-7.0.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=22d3033ec689e5fc56dc165fff9bff9d6c13880c Log: Fixed bug #70876 (Segmentation fault when regenerating session id with strict mode) Bugs: https://bugs.php.net/70876 Changed paths: M ext/session/session.c A ext/session/tests/bug70876.phpt Diff: diff --git a/ext/session/session..c b/ext/session/session.c index 570173a..dd86518 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -2077,6 +2077,11 @@ static PHP_FUNCTION(session_regenerate_id) php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); RETURN_FALSE; } + if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) { + PS(session_status) = php_session_none; + php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + RETURN_FALSE; + } if (PS(use_strict_mode) && PS(mod)->s_validate_sid && PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE) { zend_string_release(PS(id)); @@ -2087,11 +2092,6 @@ static PHP_FUNCTION(session_regenerate_id) RETURN_FALSE; } } - if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) { - PS(session_status) = php_session_none; - php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); - RETURN_FALSE; - } /* Read is required to make new session data at this point. */ if (PS(mod)->s_read(&PS(mod_data), PS(id), &data, PS(gc_maxlifetime)) == FAILURE) { PS(session_status) = php_session_none; diff --git a/ext/session/tests/bug70876.phpt b/ext/session/tests/bug70876.phpt new file mode 100644 index 0000000..33e0323 --- /dev/null +++ b/ext/session/tests/bug70876.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #70876 Segmentation fault when regenerating session id with strict mode +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +html_errors=0 +session.save_handler=files +--FILE-- +<?php +ini_set('session.use_strict_mode', true); +session_start(); +session_regenerate_id(); + +echo "ok"; +?> +--EXPECT-- +ok \ No newline at end of file

« previous php.cvs (#89680) next »