Skip to content

(FIX) deprecated messages and minor bugs - #405

Open
danieldpl wants to merge 1 commit into
rathena:masterfrom
danieldpl:php-update
Open

(FIX) deprecated messages and minor bugs#405
danieldpl wants to merge 1 commit into
rathena:masterfrom
danieldpl:php-update

Conversation

@danieldpl

Copy link
Copy Markdown
Contributor

Changes proposed in this Pull Request:

  • Update Readme
  • Fixed deprecated warnings
  • Removed some unnecessary whitespace
  • Fixed issues in the monster module

Fixes

PHP and Readme

  • Updated Readme minimum PHP version to 7.0 due to usage of the null coalescing operator (??).
  • Fixed deprecated warnings in PHP 8.2 related to strtolower, trim, and ctype functions.

Monster module:

  • Fixed MVP search with "no" option, which previously failed by comparing to 0 instead of checking for null.
  • Added support for renewal tables to allow searching for custom monsters.

chore: update PHP to version 7 and fix compatibility with PHP 8.2

- Updated minimum PHP version to 7.0 due to usage of the null coalescing operator (??).
- Fixed deprecated warnings in PHP 8.2 related to strtolower, trim, and ctype functions.

Monster module:
- Fixed MVP search with "no" option, which previously failed by comparing to 0 instead of checking for null.
- Added support for renewal tables to allow searching for custom monsters.
Comment thread modules/cplog/ban.php

$account = trim($params->get('account'));
$bannedBy = trim($params->get('banned_by'));
$account = trim($params->get('account') ?? '');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of putting ?? '' all over the place can we just put the sanitizer in the class init itself?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you proposing to automatically apply trim() to all parameters returned by the ->get() method?

Or is the idea to provide a way to return sanitized data directly from the method, something like:
$email = $params->get('email', '', FILTER_SANITIZE_EMAIL);

As in most modern frameworks, the responsibility for sanitizing input data is typically not handled directly by accessor methods like get().
Instead, it is generally up to the developer to perform sanitization manually or through custom helper methods, such as validations or specific input filters.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean put this on class init, it's too much work to do it on each class instantiation

Comment thread modules/cplog/txnview.php
if ($txn) {
$title = "Viewing PayPal Transaction ({$txn->txn_id}, status: {$txn->payment_status})";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style only changes in this file.
Please revert the whole file.

Comment thread modules/ipban/edit.php
$errorMessage = sprintf(Flux::message('IpbanAlreadyBanned'), $ipban2->list);
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style only changes in this file.
Please revert the whole file.

Comment thread modules/item/index.php
$tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables);
$shopTable = Flux::config('FluxTables.ItemShopTable');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style only changes in this file.
Please revert the whole file.

Comment thread modules/item/iteminfo.php
@@ -1,6 +1,8 @@
<?php
if (!defined('FLUX_ROOT')) exit;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style only changes in this file.
Please revert the whole file.

$datefrom = $params->get('from_date');
$dateto = $params->get('to_date');
$type = array();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style only changes in this file.
Please revert the whole file.

$sql .= "VALUES (?, ?)";
$sth = $server->connection->getStatement($sql);
$sth->execute(array($_POST['name'],$_POST['display']));
$sth->execute(array($_POST['name'],$_POST['display']));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style change only.
Please revert.

if(isset($option) && $option == 'delete'){
$sth = $server->connection->getStatement("DELETE FROM {$server->loginDatabase}.$tbl WHERE account_id = $staffid");
$sth->execute();
$sth->execute();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style change only.
Please revert.

}

$sth->execute();
$sth->execute();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style change only.
Please revert.

$sql .= "VALUES (?, ?, ?, ?, ?)";
$sth = $server->connection->getStatement($sql);
$sth->execute(array($_POST['account_id'],$_POST['account_name'],$_POST['prefered_name'],$_POST['team'], $_POST['emailalerts']));
$sth->execute(array($_POST['account_id'],$_POST['account_name'],$_POST['prefered_name'],$_POST['team'], $_POST['emailalerts']));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style change only.
Please revert.

Comment thread README.md
Requirements
---------
* PHP 5.2
* PHP 7.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just bumped PHP minimum version to 7.3
Please merge upstream master into your branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants