Skip to content

Commit

Permalink
PHP8 compliance updates (#1459)
Browse files Browse the repository at this point in the history
* Spelling correction - generated error

* count generates an error if the argument is not an array

* $myts was not a global, needed definition

* Too many = from copy/past

* $icmsModule is not in the global space

* count() needs an object

* The array existed - the parenthesis was in the wrong place

* Use of "parent" in callables is deprecated

* Use of "parent" in callables is deprecated

* Child class methods must be compatible with parent class methods

* Filter constants deprecated and removed in PHP 8.0.

Require scheme  and require host in "validate_url" filter. (Deprecated
as of PHP 7.3.0 and removed as of PHP 8.0.0, as it is implied in the
filter already.)

* Fixed declaration of getAdminViewItemLink and use of count()
  • Loading branch information
skenow authored Jun 5, 2023
1 parent 0e9cef8 commit 01f100d
Show file tree
Hide file tree
Showing 10 changed files with 2,491 additions and 2,623 deletions.
736 changes: 365 additions & 371 deletions htdocs/libraries/icms/core/DataFilter.php

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions htdocs/libraries/icms/db/Connection.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
<?php

/**
* Database connection
*
* @category ICMS
* @package Database
* @category ICMS
* @package Database
*
* @copyright The ImpressCMS Project <http://www.impresscms.org>
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @version SVN: $Id$
* @copyright The ImpressCMS Project <http://www.impresscms.org>
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @version SVN: $Id$
*/

/**
* Database connection
*
* @category ICMS
* @package Database
* @category ICMS
* @package Database
*/
class icms_db_Connection extends PDO implements icms_db_IConnection {

/**
* Safely escape the string, but strips the outer quotes
* Safely escape the string, but strips the outer quotes
*
* This is a legacy method and not part of PDO and must be declared in any class that implements this interface
*
* @see icms_db_IConnection::escape()
* @param string $string
* @return string
* @param string $string
* @return string
*/
public function escape($string) {
return substr($this->quote($string), 1, -1);
}

/**
* Executes an SQL statement and returns a result set as an SQL statement object
*
* @see PDO::query()
* @return
*/
public function query() {
$args = func_get_args();
$sql = $args[0];
// the use of icms_db_IConnection is correct - without it, the query count in debug is not correct
$result = call_user_func_array(array('parent', 'query'), $args);
$result = call_user_func_array(array(parent::class, 'query'), $args);

// trigger events for the debug console - see plugins/preloads/debug_mode.php
if ($result) {
Expand Down
31 changes: 15 additions & 16 deletions htdocs/libraries/icms/db/mysql/Connection.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
<?php

/**
*
*
* @copyright The ImpressCMS Project - http://www.impresscms.org/
* @license GNU General Public License (GPL) - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* @since 2.0
* @category ICMS
* @package Database
* @subpackage MySQL
* @copyright The ImpressCMS Project - http://www.impresscms.org/
* @license GNU General Public License (GPL) - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* @since 2.0
* @category ICMS
* @package Database
* @subpackage MySQL
*/

/**
*
* @copyright The ImpressCMS Project - http://www.impresscms.org/
*
* @copyright The ImpressCMS Project - http://www.impresscms.org/
*
* @category ICMS
* @package Database
* @subpackage MySQL
* @category ICMS
* @package Database
* @subpackage MySQL
*/
class icms_db_mysql_Connection extends PDO implements icms_db_IConnection {

/**
* Safely escape the string, but strips the outer quotes
* Safely escape the string, but strips the outer quotes
*
* @see icms_db_IConnection::escape()
* @param string $string
* @return string
* @param string $string
* @return string
*/
public function escape($string) {
return substr($this->quote($string), 1, -1);
Expand All @@ -42,7 +41,7 @@ public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, ...$fetc
$args = func_get_args();
$sql = $args[0];
// the use of icms_db_IConnection is correct - without it, the query count in debug is not correct
$result = call_user_func_array(array('parent', 'query'), $args);
$result = call_user_func_array(array(parent::class, 'query'), $args);

// trigger events for the debug console - see plugins/preloads/debug_mode.php
if ($result) {
Expand Down
Loading

0 comments on commit 01f100d

Please sign in to comment.