Skip to content

Commit ce61f5e

Browse files
author
Yasuo Ohgaki
committed
Merge branch 'PHP-7.1'
* PHP-7.1: Update NEWS Fixed Bug #68015 Session does not report invalid uid for files save handler
2 parents fd5f0e4 + 17dbb91 commit ce61f5e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ session_write_close();
2222
print "I live\n";
2323
?>
2424
--EXPECTF--
25-
Warning: session_start(): Failed to read session data: files (path: 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_start(): Failed to read session data: files (path: 123;:/really\completely:::/invalid;;,23123;213) in %s on line 4
28+
I live

0 commit comments

Comments
 (0)