[ticket/15738] Remove code related with safe_mode

PHPBB3-15738
This commit is contained in:
Rubén Calvo 2018-07-30 13:58:52 +02:00 committed by Marc Alexander
parent ab0dae6003
commit 688d022f42
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
5 changed files with 4 additions and 11 deletions

View file

@ -49,7 +49,6 @@ if (!$auth->acl_get('a_'))
define('IN_ADMIN', true); define('IN_ADMIN', true);
// Some oft used variables // Some oft used variables
$safe_mode = (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) === 'on') ? true : false;
$file_uploads = (@ini_get('file_uploads') == '1' || strtolower(@ini_get('file_uploads')) === 'on') ? true : false; $file_uploads = (@ini_get('file_uploads') == '1' || strtolower(@ini_get('file_uploads')) === 'on') ? true : false;
$module_id = $request->variable('i', ''); $module_id = $request->variable('i', '');
$mode = $request->variable('mode', ''); $mode = $request->variable('mode', '');

View file

@ -613,12 +613,6 @@ function create_thumbnail($source, $destination, $mimetype)
imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
} }
// If we are in safe mode create the destination file prior to using the gd functions to circumvent a PHP bug
if (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on')
{
@touch($destination);
}
switch ($type['format']) switch ($type['format'])
{ {
case IMG_GIF: case IMG_GIF:

View file

@ -437,7 +437,7 @@ $lang = array_merge($lang, array(
'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth', 'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth',
'AUTH_PROVIDER_OAUTH_SECRET' => 'Secret', 'AUTH_PROVIDER_OAUTH_SECRET' => 'Secret',
'APACHE_SETUP_BEFORE_USE' => 'You have to setup apache authentication before you switch phpBB to this authentication method. Keep in mind that the username you use for apache authentication has to be the same as your phpBB username. Apache authentication can only be used with mod_php (not with a CGI version) and safe_mode disabled.', 'APACHE_SETUP_BEFORE_USE' => 'You have to setup apache authentication before you switch phpBB to this authentication method. Keep in mind that the username you use for apache authentication has to be the same as your phpBB username. Apache authentication can only be used with mod_php (not with a CGI version).',
'LDAP' => 'LDAP', 'LDAP' => 'LDAP',
'LDAP_DN' => 'LDAP base <var>dn</var>', 'LDAP_DN' => 'LDAP base <var>dn</var>',

View file

@ -420,7 +420,7 @@ class filespec
return false; return false;
} }
$upload_mode = ($this->php_ini->getBool('open_basedir') || $this->php_ini->getBool('safe_mode')) ? 'move' : 'copy'; $upload_mode = ($this->php_ini->getBool('open_basedir')) ? 'move' : 'copy';
$upload_mode = ($this->local) ? 'local' : $upload_mode; $upload_mode = ($this->local) ? 'local' : $upload_mode;
$this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname); $this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname);

View file

@ -420,7 +420,7 @@ class phpbb_filespec_test extends phpbb_test_case
/** /**
* @dataProvider data_move_file_copy * @dataProvider data_move_file_copy
*/ */
public function test_move_file_copy($tmp_name, $move_success, $safe_mode_on, $expected_error) public function test_move_file_copy($tmp_name, $move_success, $open_basedir_on, $expected_error)
{ {
// Initialise a blank filespec object for use with trivial methods // Initialise a blank filespec object for use with trivial methods
$upload_ary = array( $upload_ary = array(
@ -436,7 +436,7 @@ class phpbb_filespec_test extends phpbb_test_case
$php_ini->expects($this->any()) $php_ini->expects($this->any())
->method('getBool') ->method('getBool')
->with($this->anything()) ->with($this->anything())
->willReturn($safe_mode_on); ->willReturn($open_basedir_on);
$upload = new phpbb_mock_fileupload(); $upload = new phpbb_mock_fileupload();
$upload->max_filesize = self::UPLOAD_MAX_FILESIZE; $upload->max_filesize = self::UPLOAD_MAX_FILESIZE;
$filespec = new \phpbb\files\filespec($this->filesystem, $this->language, $php_ini, new \FastImageSize\FastImagesize, '', $this->mimetype_guesser); $filespec = new \phpbb\files\filespec($this->filesystem, $this->language, $php_ini, new \FastImageSize\FastImagesize, '', $this->mimetype_guesser);