Skip to content

Commit

Permalink
Merge pull request phpbb#5310 from rubencm/ticket/15738
Browse files Browse the repository at this point in the history
[ticket/15738] Remove code related with safe_mode
  • Loading branch information
marc1706 authored Aug 3, 2018
2 parents 4f1ec3a + 6742f3e commit d0b1a20
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 14 deletions.
1 change: 0 additions & 1 deletion phpBB/adm/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
define('IN_ADMIN', true);

// 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;
$module_id = $request->variable('i', '');
$mode = $request->variable('mode', '');
Expand Down
6 changes: 0 additions & 6 deletions phpBB/includes/functions_posting.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,6 @@ function create_thumbnail($source, $destination, $mimetype)
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'])
{
case IMG_GIF:
Expand Down
3 changes: 0 additions & 3 deletions phpBB/includes/questionnaire/questionnaire.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ function get_data()
'version' => PHP_VERSION,
'sapi' => PHP_SAPI,
'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '',
'safe_mode' => (int) @ini_get('safe_mode'),
'open_basedir' => (int) @ini_get('open_basedir'),
'memory_limit' => @ini_get('memory_limit'),
'allow_url_fopen' => (int) @ini_get('allow_url_fopen'),
Expand All @@ -121,8 +120,6 @@ function get_data()
'disable_functions' => @ini_get('disable_functions'),
'disable_classes' => @ini_get('disable_classes'),
'enable_dl' => (int) @ini_get('enable_dl'),
'magic_quotes_gpc' => (int) @ini_get('magic_quotes_gpc'),
'register_globals' => (int) @ini_get('register_globals'),
'filter.default' => @ini_get('filter.default'),
'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'),
'unicode.semantics' => (int) @ini_get('unicode.semantics'),
Expand Down
2 changes: 1 addition & 1 deletion phpBB/language/en/acp/board.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth',
'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_DN' => 'LDAP base <var>dn</var>',
Expand Down
2 changes: 1 addition & 1 deletion phpBB/phpbb/files/filespec.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public function move_file($destination, $overwrite = false, $skip_image_check =
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;
$this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname);

Expand Down
4 changes: 2 additions & 2 deletions tests/upload/filespec_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public function 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
$upload_ary = array(
Expand All @@ -436,7 +436,7 @@ public function test_move_file_copy($tmp_name, $move_success, $safe_mode_on, $ex
$php_ini->expects($this->any())
->method('getBool')
->with($this->anything())
->willReturn($safe_mode_on);
->willReturn($open_basedir_on);
$upload = new phpbb_mock_fileupload();
$upload->max_filesize = self::UPLOAD_MAX_FILESIZE;
$filespec = new \phpbb\files\filespec($this->filesystem, $this->language, $php_ini, new \FastImageSize\FastImagesize, '', $this->mimetype_guesser);
Expand Down

0 comments on commit d0b1a20

Please sign in to comment.