Skip to content

Commit 0e3b30f

Browse files
author
Yasuo Ohgaki
committed
Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6: Fixed Bug #68015 Session does not report invalid uid for files save handler
2 parents 4fda0a9 + 38553e8 commit 0e3b30f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ext/session/mod_files.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ static void ps_files_open(ps_files *data, const char *key)
175175
}
176176

177177
if (!ps_files_path_create(buf, sizeof(buf), data, key)) {
178+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d)", MAXPATHLEN);
178179
return;
179180
}
180181

@@ -199,6 +200,7 @@ static void ps_files_open(ps_files *data, const char *key)
199200
if (fstat(data->fd, &sbuf) || (sbuf.st_uid != 0 && sbuf.st_uid != getuid() && sbuf.st_uid != geteuid())) {
200201
close(data->fd);
201202
data->fd = -1;
203+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session data file is not created by your uid");
202204
return;
203205
}
204206
#endif

ext/session/tests/016.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,9 @@ session_write_close();
2222
print "I live\n";
2323
?>
2424
--EXPECTF--
25-
Warning: session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (123;:/really%scompletely:::/invalid;;,23123;213) in %s on line %d
26-
I live
25+
Warning: session_start(): Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d) in %s on line 4
26+
27+
Warning: session_write_close(): Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d) in %s on line 6
28+
29+
Warning: session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (123;:/really\completely:::/invalid;;,23123;213) in %s on line 6
30+
I live

0 commit comments

Comments
 (0)