Miscellaneous static analysis improvements for php 7.1 (#620)

* Miscellaneous static analysis improvements for php 7.1

* Update changes.txt
This commit is contained in:
Yury Pikhtarev 2023-03-17 22:02:00 +07:00 committed by GitHub
commit 7019d31353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 156 additions and 151 deletions

View file

@ -473,6 +473,7 @@ function _set_var(&$result, $var, $type, $multibyte = false)
*/
function get_var($var_name, $default, $multibyte = false)
{
$type = null;
if (!isset($_REQUEST[$var_name]) ||
(is_array($_REQUEST[$var_name]) && !is_array($default)) ||
(is_array($default) && !is_array($_REQUEST[$var_name]))) {

View file

@ -16,6 +16,7 @@
*/
function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, $user_id = 0)
{
$lang = [];
// Generate Array, if it's not an array
if ($post_id_array === 0 && $attach_id_array === 0 && $page === 0) {
return;

View file

@ -51,6 +51,10 @@ function read_byte($fp)
*/
function image_getdimension($file)
{
$xmax = null;
$xmin = null;
$ymax = null;
$ymin = null;
$size = @getimagesize($file);
if ($size[0] != 0 || $size[1] != 0) {

View file

@ -29,6 +29,7 @@ function attach_build_auth_levels($is_auth, &$s_auth_can)
function attachment_quota_settings($admin_mode, $submit = false, $mode)
{
global $template, $lang, $attach_config;
$this_userdata = [];
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':')) {
$upload_dir = $attach_config['upload_dir'];

View file

@ -98,6 +98,7 @@ function download_select($select_name, $group_id = 0)
function category_select($select_name, $group_id = 0)
{
global $types_category, $modes_category;
$category_type = null;
$sql = 'SELECT group_id, cat_id FROM ' . BB_EXTENSION_GROUPS;
@ -172,6 +173,7 @@ function size_select($select_name, $size_compare)
function quota_limit_select($select_name, $default_quota = 0)
{
global $lang;
$quota_name = [];
$sql = 'SELECT quota_limit_id, quota_desc FROM ' . BB_QUOTA_LIMITS . ' ORDER BY quota_limit ASC';
@ -203,6 +205,7 @@ function quota_limit_select($select_name, $default_quota = 0)
function default_quota_limit_select($select_name, $default_quota = 0)
{
global $lang;
$quota_name = [];
$sql = 'SELECT quota_limit_id, quota_desc FROM ' . BB_QUOTA_LIMITS . ' ORDER BY quota_limit ASC';

View file

@ -94,6 +94,7 @@ function get_supported_image_types($type)
function create_thumbnail($source, $new_file, $mimetype)
{
global $attach_config, $imagick;
$image = null;
$source = amod_realpath($source);
$min_filesize = (int)$attach_config['img_min_thumb_filesize'];