Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticket/17097] Fix PHP 8.2 deprecation warnings #6478

Merged
merged 1 commit into from May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions phpBB/phpbb/attachment/upload.php
Expand Up @@ -48,6 +48,9 @@ class upload
/** @var dispatcher */
protected $phpbb_dispatcher;

/** @var string */
protected $phpbb_root_path;

/** @var plupload Plupload */
protected $plupload;

Expand Down
28 changes: 14 additions & 14 deletions phpBB/phpbb/auth/auth.php
Expand Up @@ -524,19 +524,19 @@ function acl_clear_prefetch($user_id = false)
ORDER BY role_id ASC';
$result = $db->sql_query($sql);

$this->role_cache = array();
$role_cache = array();
while ($row = $db->sql_fetchrow($result))
{
$this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
$role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
}
$db->sql_freeresult($result);

foreach ($this->role_cache as $role_id => $role_options)
foreach ($role_cache as $role_id => $role_options)
{
$this->role_cache[$role_id] = serialize($role_options);
$role_cache[$role_id] = serialize($role_options);
}

$cache->put('_role_cache', $this->role_cache);
$cache->put('_role_cache', $role_cache);

// Now empty user permissions
$where_sql = '';
Expand Down Expand Up @@ -828,9 +828,9 @@ function acl_raw_data_single_user($user_id)
global $db, $cache;

// Check if the role-cache is there
if (($this->role_cache = $cache->get('_role_cache')) === false)
if (($role_cache = $cache->get('_role_cache')) === false)
{
$this->role_cache = array();
$role_cache = array();

// We pre-fetch roles
$sql = 'SELECT *
Expand All @@ -840,16 +840,16 @@ function acl_raw_data_single_user($user_id)

while ($row = $db->sql_fetchrow($result))
{
$this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
$role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
}
$db->sql_freeresult($result);

foreach ($this->role_cache as $role_id => $role_options)
foreach ($role_cache as $role_id => $role_options)
{
$this->role_cache[$role_id] = serialize($role_options);
$role_cache[$role_id] = serialize($role_options);
}

$cache->put('_role_cache', $this->role_cache);
$cache->put('_role_cache', $role_cache);
}

$hold_ary = array();
Expand All @@ -865,7 +865,7 @@ function acl_raw_data_single_user($user_id)
// If a role is assigned, assign all options included within this role. Else, only set this one option.
if ($row['auth_role_id'])
{
$hold_ary[$row['forum_id']] = (empty($hold_ary[$row['forum_id']])) ? unserialize($this->role_cache[$row['auth_role_id']]) : $hold_ary[$row['forum_id']] + unserialize($this->role_cache[$row['auth_role_id']]);
$hold_ary[$row['forum_id']] = (empty($hold_ary[$row['forum_id']])) ? unserialize($role_cache[$row['auth_role_id']]) : $hold_ary[$row['forum_id']] + unserialize($role_cache[$row['auth_role_id']]);
}
else
{
Expand All @@ -890,9 +890,9 @@ function acl_raw_data_single_user($user_id)
{
$this->_set_group_hold_ary($hold_ary[$row['forum_id']], $row['auth_option_id'], $row['auth_setting']);
}
else if (!empty($this->role_cache[$row['auth_role_id']]))
else if (!empty($role_cache[$row['auth_role_id']]))
{
foreach (unserialize($this->role_cache[$row['auth_role_id']]) as $option_id => $setting)
foreach (unserialize($role_cache[$row['auth_role_id']]) as $option_id => $setting)
{
$this->_set_group_hold_ary($hold_ary[$row['forum_id']], $option_id, $setting);
}
Expand Down
4 changes: 4 additions & 0 deletions phpBB/phpbb/config/config.php
Expand Up @@ -50,6 +50,7 @@ public function getIterator()
* @param string $key The configuration option's name.
* @return bool Whether the configuration option exists.
*/
#[\ReturnTypeWillChange]
public function offsetExists($key)
{
return isset($this->config[$key]);
Expand All @@ -61,6 +62,7 @@ public function offsetExists($key)
* @param string $key The configuration option's name.
* @return string The configuration value
*/
#[\ReturnTypeWillChange]
public function offsetGet($key)
{
return (isset($this->config[$key])) ? $this->config[$key] : '';
Expand All @@ -75,6 +77,7 @@ public function offsetGet($key)
* @param string $key The configuration option's name.
* @param string $value The temporary value.
*/
#[\ReturnTypeWillChange]
public function offsetSet($key, $value)
{
$this->config[$key] = $value;
Expand All @@ -85,6 +88,7 @@ public function offsetSet($key, $value)
*
* @param string $key The configuration option's name.
*/
#[\ReturnTypeWillChange]
public function offsetUnset($key)
{
trigger_error('Config values have to be deleted explicitly with the \phpbb\config\config::delete($key) method.', E_USER_ERROR);
Expand Down
1 change: 1 addition & 0 deletions phpBB/phpbb/datetime.php
Expand Up @@ -57,6 +57,7 @@ public function __construct($user, $time = 'now', \DateTimeZone $timezone = null
* @param boolean $force_absolute Force output of a non relative date
* @return string Formatted date time
*/
#[\ReturnTypeWillChange]
public function format($format = '', $force_absolute = false)
{
$format = $format ? $format : $this->user->date_format;
Expand Down
4 changes: 4 additions & 0 deletions phpBB/phpbb/event/data.php
Expand Up @@ -44,21 +44,25 @@ public function get_data_filtered($keys)
return array_intersect_key($this->data, array_flip($keys));
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->data[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->data[$offset] = $value;
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->data[$offset]);
Expand Down