Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug #71038 - session_start() returns true even when it failed #2167

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5ce7642
Fix bug #71038
Oct 16, 2016
fa6fa18
Add required return
Oct 17, 2016
637f72c
Since session_start() issue is fixed. Number of inconsistent behavior…
Oct 17, 2016
6ec20f2
Fix tests
Oct 17, 2016
bcf6764
Disallow nonsense INI changes
Oct 17, 2016
2a77f71
Update PHP_SESSION_API
Oct 17, 2016
29882f3
Remove env dependecy from test
Oct 17, 2016
bcae969
Add missing SUCCESS
Oct 17, 2016
27e4361
Use dedicated PHP_MH names. Align INI entry defs
Oct 18, 2016
f2d06e0
Base branch was wrong. Touch file to force travis to rebuild.
Oct 18, 2016
e7cd7c1
Check active state rather than http header. Check negative cookie lif…
yohgaki Oct 23, 2016
1cd9654
Merge branch 'PHP-7.1-session-bug71038' of github.com:yohgaki/php-src…
yohgaki Oct 23, 2016
3114f4d
Merge remote-tracking branch 'upstream/master' into PHP-7.1-session-b…
yohgaki Oct 23, 2016
1646d2f
Add doc. Check both output and active status. Changes after header se…
yohgaki Oct 23, 2016
f5bc23b
Update to more descrictive sentence
yohgaki Oct 23, 2016
7315a54
Fix test
yohgaki Oct 23, 2016
5a30738
I should have checked header sent status in functions, too.
yohgaki Oct 23, 2016
76f77f7
Add test for INI changes
yohgaki Oct 23, 2016
51e83df
Fix test
yohgaki Oct 23, 2016
94b5532
Merge branch 'master' into PHP-7.1-session-bug71038
Oct 24, 2016
3a1e707
Merge remote-tracking branch 'upstream/master' into PHP-7.1-session-b…
Oct 27, 2016
b96f304
Merge remote-tracking branch 'upstream/master' into PHP-7.1-session-b…
Oct 29, 2016
890a40f
Merge remote-tracking branch 'upstream/master' into PHP-7.1-session-b…
Nov 16, 2016
f9a39aa
Fix test
Nov 17, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions UPGRADING
Expand Up @@ -36,6 +36,36 @@ PHP 7.2 UPGRADE NOTES
keys. This fixes the behaviour of previous versions, where numeric string
property names would become inaccessible string keys.

- Session:
. Session is made to manage session status corretly and prevents invalid operations.
Only inappropriate codes are affected by this change. If you have problems with this,
it means you have problem in your code.
. Functions are made to set or return correct session status.
session_start(), session_status(), session_regenerate_id()
. Functions are made to return bool from null. These functions have void parameter
and void parameter is checked.
session_unset(), session_write_close()/session_commit(), session_abort(),
session_reset()
. Functions prohibit invalid operations with regard to session status and
HTTP header status, returns correct bool return value.
session_start(), session_set_cookie_params(), session_name(), session_module_name(),
session_set_save_handler(), session_regenerate_id(), session_cache_limiter(),
session_cache_expire(), session_unset(), session_destroy(),
session_write_close()/session_commit(), session_reset()
. INI value change by ini_set() returns update status correctly. Invalid INI modifications
are checked and made to fail.
session.name, session.save_path, session.cookie_lifetime, session.cookie_path,
session.cookie_domain, session.cookie_httponly, session.cookie_secure,
session.use_cookies, session.use_only_cookies, session.use_strict_mode,
session.referer_check, session.cache_limiter, session.cache_expire,
session.lazy_write, session.save_handler, session.serialize_handler,
session.gc_probability, session.gc_divior, session.gc_maxlifetime,
. Some E_ERRORs are changed to E_WARNING since session status is managed correctly.
session_start()
. Session no longer initialize $_SESSION for invalid and useless session.
session_start()


========================================
2. New Features
========================================
Expand Down
5 changes: 5 additions & 0 deletions UPGRADING.INTERNALS
Expand Up @@ -31,3 +31,8 @@ PHP 7.1 INTERNALS UPGRADE NOTES
3. Module changes
========================

- Session:
. php_session_start()/session_reset_id() return value is changed from void to int.
It returns SUCCESS/FAILURE.
. Session module manages session status correctly.

5 changes: 1 addition & 4 deletions Zend/tests/unset_cv05.phpt
Expand Up @@ -11,6 +11,7 @@ include(dirname(__FILE__).'/../../ext/session/tests/skipif.inc');
?>
--FILE--
<?php
ob_start();
$_SESSION = "ok\n";
echo $_SESSION;
session_start();
Expand All @@ -20,10 +21,6 @@ echo "\nok\n";
--EXPECTF--
ok

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at %sunset_cv05.php on line %d

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at %sunset_cv05.php:%d) in %sunset_cv05.php on line %d

Notice: Array to string conversion in %sunset_cv05.php on line %d
Array
ok
6 changes: 3 additions & 3 deletions ext/session/php_session.h
Expand Up @@ -27,7 +27,7 @@
# include "ext/hash/php_hash.h"
#endif

#define PHP_SESSION_API 20150121
#define PHP_SESSION_API 20161017

#include "php_version.h"
#define PHP_SESSION_VERSION PHP_VERSION
Expand Down Expand Up @@ -265,13 +265,13 @@ PHPAPI int php_session_register_serializer(const char *name,
int (*decode)(PS_SERIALIZER_DECODE_ARGS));

PHPAPI void php_session_set_id(char *id);
PHPAPI void php_session_start(void);
PHPAPI int php_session_start(void);

PHPAPI ps_module *_php_find_ps_module(char *name);
PHPAPI const ps_serializer *_php_find_ps_serializer(char *name);

PHPAPI int php_session_valid_key(const char *key);
PHPAPI void php_session_reset_id(void);
PHPAPI int php_session_reset_id(void);

#define PS_ADD_VARL(name) do { \
php_add_session_var(name); \
Expand Down