1
0
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:
rxu
2025-09-16 23:36:35 +07:00
parent 9e764b2a98
commit b2aa276a2a
7 changed files with 19 additions and 10 deletions

View File

@@ -763,8 +763,6 @@ function create_thumbnail($source, $destination, $mimetype)
imagewebp($new_image, $destination); imagewebp($new_image, $destination);
break; break;
} }
imagedestroy($new_image);
} }
else else
{ {

View File

@@ -325,7 +325,7 @@ class recaptcha_v3 extends captcha_abstract
$token = $request->variable('recaptcha_token', '', true); $token = $request->variable('recaptcha_token', '', true);
$action = $request->variable('recaptcha_action', '', true); $action = $request->variable('recaptcha_action', '', true);
$action = in_array($action, self::$actions) ? $action : reset(self::$actions); $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 // No token was provided, discard spam submissions
if (empty($token)) if (empty($token))

View File

@@ -149,9 +149,20 @@ class connection_parameter_factory
} }
if ($params['driver'] === 'pdo_mysql' && extension_loaded('pdo_mysql')) if ($params['driver'] === 'pdo_mysql' && extension_loaded('pdo_mysql'))
{
// 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; $params[\PDO::MYSQL_ATTR_FOUND_ROWS] = true;
} }
}
return $params; return $params;
} }

View File

@@ -386,7 +386,7 @@ class post extends \phpbb\notification\type\base
// Topics can be "read" before they are public (while awaiting approval). // 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 // 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; $this->notification_read = true;
} }

View File

@@ -1577,7 +1577,7 @@ class fulltext_native extends base implements search_backend_interface
// Remove common words // Remove common words
if ($this->config['num_posts'] >= 100 && $this->config['fulltext_native_common_thres']) 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 // First, get the IDs of common words
$sql = 'SELECT word_id, word_text $sql = 'SELECT word_id, word_text
FROM ' . $this->search_wordlist_table . ' FROM ' . $this->search_wordlist_table . '
@@ -2034,14 +2034,14 @@ class fulltext_native extends base implements search_backend_interface
</dl> </dl>
<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> <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> </dl>
'; ';
// These are fields required in the config table // These are fields required in the config table
return array( return array(
'tpl' => $tpl, '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')
); );
} }
} }

View File

@@ -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) 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) public function get($field_id, $lang_id, $field_value)

View File

@@ -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) 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) public function get($field_id, $lang_id, $field_value)