mirror of
https://github.com/phpbb/phpbb.git
synced 2025-10-04 19:51:39 +02:00
[ticket/17543] Fix more PHP 8.5 deprecation warnings
PHPBB-17543
This commit is contained in:
@@ -763,8 +763,6 @@ function create_thumbnail($source, $destination, $mimetype)
|
||||
imagewebp($new_image, $destination);
|
||||
break;
|
||||
}
|
||||
|
||||
imagedestroy($new_image);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -325,7 +325,7 @@ class recaptcha_v3 extends captcha_abstract
|
||||
$token = $request->variable('recaptcha_token', '', true);
|
||||
$action = $request->variable('recaptcha_action', '', true);
|
||||
$action = in_array($action, self::$actions) ? $action : reset(self::$actions);
|
||||
$threshold = (double) $config["recaptcha_v3_threshold_{$action}"] ?? 0.5;
|
||||
$threshold = (float) $config["recaptcha_v3_threshold_{$action}"] ?? 0.5;
|
||||
|
||||
// No token was provided, discard spam submissions
|
||||
if (empty($token))
|
||||
|
@@ -150,7 +150,18 @@ class connection_parameter_factory
|
||||
|
||||
if ($params['driver'] === 'pdo_mysql' && extension_loaded('pdo_mysql'))
|
||||
{
|
||||
$params[\PDO::MYSQL_ATTR_FOUND_ROWS] = true;
|
||||
// Constant PDO::MYSQL_ATTR_FOUND_ROWS is deprecated since 8.5, use Pdo\Mysql::ATTR_FOUND_ROWS instead
|
||||
if (class_exists('\Pdo\Mysql'))
|
||||
{
|
||||
/**
|
||||
* @psalm-suppress UndefinedClass
|
||||
*/
|
||||
$params[\Pdo\Mysql::ATTR_FOUND_ROWS] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$params[\PDO::MYSQL_ATTR_FOUND_ROWS] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $params;
|
||||
|
@@ -386,7 +386,7 @@ class post extends \phpbb\notification\type\base
|
||||
|
||||
// Topics can be "read" before they are public (while awaiting approval).
|
||||
// Make sure that if the user has read the topic, it's marked as read in the notification
|
||||
if ($this->inherit_read_status && isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time)
|
||||
if ($this->inherit_read_status && isset($this->user_id, $pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time)
|
||||
{
|
||||
$this->notification_read = true;
|
||||
}
|
||||
|
@@ -1577,7 +1577,7 @@ class fulltext_native extends base implements search_backend_interface
|
||||
// Remove common words
|
||||
if ($this->config['num_posts'] >= 100 && $this->config['fulltext_native_common_thres'])
|
||||
{
|
||||
$common_threshold = ((double) $this->config['fulltext_native_common_thres']) / 100.0;
|
||||
$common_threshold = ((float) $this->config['fulltext_native_common_thres']) / 100.0;
|
||||
// First, get the IDs of common words
|
||||
$sql = 'SELECT word_id, word_text
|
||||
FROM ' . $this->search_wordlist_table . '
|
||||
@@ -2034,14 +2034,14 @@ class fulltext_native extends base implements search_backend_interface
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="fulltext_native_common_thres">' . $this->language->lang('COMMON_WORD_THRESHOLD') . $this->language->lang('COLON') . '</label><br /><span>' . $this->language->lang('COMMON_WORD_THRESHOLD_EXPLAIN') . '</span></dt>
|
||||
<dd><input id="fulltext_native_common_thres" type="text" name="config[fulltext_native_common_thres]" value="' . (double) $this->config['fulltext_native_common_thres'] . '" /> %</dd>
|
||||
<dd><input id="fulltext_native_common_thres" type="text" name="config[fulltext_native_common_thres]" value="' . (float) $this->config['fulltext_native_common_thres'] . '" /> %</dd>
|
||||
</dl>
|
||||
';
|
||||
|
||||
// These are fields required in the config table
|
||||
return array(
|
||||
'tpl' => $tpl,
|
||||
'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:255', 'fulltext_native_max_chars' => 'integer:0:255', 'fulltext_native_common_thres' => 'double:0:100')
|
||||
'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:255', 'fulltext_native_max_chars' => 'integer:0:255', 'fulltext_native_common_thres' => 'float:0:100')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -187,7 +187,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
|
||||
|
||||
public function is_set_callback($field_id, $lang_id, $field_value)
|
||||
{
|
||||
return isset($this->options[$field_value]);
|
||||
return isset($field_value, $this->options[$field_value]);
|
||||
}
|
||||
|
||||
public function get($field_id, $lang_id, $field_value)
|
||||
|
@@ -225,7 +225,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
|
||||
|
||||
public function is_set_callback($field_id, $lang_id, $field_value)
|
||||
{
|
||||
return isset($this->dropdown_options[$field_value]);
|
||||
return isset($field_value, $this->dropdown_options[$field_value]);
|
||||
}
|
||||
|
||||
public function get($field_id, $lang_id, $field_value)
|
||||
|
Reference in New Issue
Block a user