From b4d4e58d1710d42f7bb2cb00d27203b6a4d9f752 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Tue, 5 Jun 2007 00:20:56 +0000 Subject: [PATCH] * (bug 9820) session.save_path check no longer halts installation, but warns of possible bad values * (bug 9978) Fixed session.save_path validation when using extended configuration format, e.g. "5;/tmp" --- RELEASE-NOTES | 4 ++++ config/index.php | 15 +++++++-------- install-utils.inc | 18 +++++++++++++++++- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b3d8a8bc2e..a4f08c252e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -114,6 +114,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 10118) Introduced Special:Mostlinkedtemplates, report which lists templates with a high number of inclusion links * (bug 10104) Fixed Database::getLag() for PostgreSQL and Oracle +* (bug 9820) session.save_path check no longer halts installation, but + warns of possible bad values +* (bug 9978) Fixed session.save_path validation when using extended + configuration format, e.g. "5;/tmp" == MediaWiki API changes since 1.10 == diff --git a/config/index.php b/config/index.php index 75db7d007f..0f762f4446 100644 --- a/config/index.php +++ b/config/index.php @@ -395,7 +395,8 @@ if( !function_exists( 'session_name' ) ) # session.save_path doesn't *have* to be set, but if it is, and it's # not valid/writable/etc. then it can cause problems -$sessionSavePath = ini_get( 'session.save_path' ); +$sessionSavePath = mw_get_session_save_path(); +$ssp = htmlspecialchars( $sessionSavePath ); # Warn the user if it's not set, but let them proceed if( !$sessionSavePath ) { print "
  • Warning: A value for session.save_path @@ -404,14 +405,12 @@ if( !$sessionSavePath ) { for the user your web server is running under.
  • "; } elseif ( is_dir( $sessionSavePath ) && is_writable( $sessionSavePath ) ) { # All good? Let the user know - print "
  • Session save path appears to be valid.
  • "; + print "
  • Session save path ({$ssp}) appears to be valid.
  • "; } else { - # Something not right? Halt the installation so the user can fix it up - dieout( "Your session save path appears to be invalid or is not writable. - PHP needs to be able to save data to this location in order for correct - session operation. Please check that session.save_path in - PHP.ini points to a valid path, and is read/write/execute for - the user your web server is running under." ); + # Something not right? Warn the user, but let them proceed + print "
  • Warning: Your session.save_path value ({$ssp}) + appears to be invalid or is not writable. PHP needs to be able to save data to + this location for correct session operation.
  • "; } # Check for PCRE support diff --git a/install-utils.inc b/install-utils.inc index 4e1aad27a3..24480f9165 100644 --- a/install-utils.inc +++ b/install-utils.inc @@ -106,4 +106,20 @@ function dbsource( $fname, $db = false ) { exit(1); } } -?> + +/** + * Get the value of session.save_path + * + * Per http://uk.php.net/manual/en/ref.session.php#ini.session.save-path, + * this might have some additional preceding parts which need to be + * ditched + * + * @return string + */ +function mw_get_session_save_path() { + $path = ini_get( 'session.save_path' ); + $path = substr( $path, strrpos( $path, ';' ) ); + return $path; +} + +?> \ No newline at end of file -- 2.20.1