mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 00:02:21 +09:00
Fix strict count() behavior in PHP 7.2
This commit is contained in:
parent
6f7f92f3e2
commit
6f35f5bafc
7 changed files with 43 additions and 16 deletions
|
|
@ -41,6 +41,7 @@ if (function_exists('mb_regex_encoding'))
|
|||
require_once __DIR__ . '/constants.php';
|
||||
require_once __DIR__ . '/functions.php';
|
||||
require_once __DIR__ . '/legacy.php';
|
||||
require_once RX_BASEDIR . 'classes/object/Object.class.php';
|
||||
|
||||
/**
|
||||
* Load user configuration.
|
||||
|
|
@ -98,8 +99,6 @@ $GLOBALS['RX_AUTOLOAD_FILE_MAP'] = array_change_key_case(array(
|
|||
'Mobile' => 'classes/mobile/Mobile.class.php',
|
||||
'ModuleHandler' => 'classes/module/ModuleHandler.class.php',
|
||||
'ModuleObject' => 'classes/module/ModuleObject.class.php',
|
||||
'BaseObject' => 'classes/object/Object.class.php',
|
||||
'Object' => 'classes/object/Object.class.php',
|
||||
'PageHandler' => 'classes/page/PageHandler.class.php',
|
||||
'EmbedFilter' => 'classes/security/EmbedFilter.class.php',
|
||||
'IpFilter' => 'classes/security/IpFilter.class.php',
|
||||
|
|
@ -193,7 +192,7 @@ spl_autoload_register(function($class_name)
|
|||
/**
|
||||
* Also include the Composer autoloader.
|
||||
*/
|
||||
require_once RX_BASEDIR . 'vendor/autoload.php';
|
||||
require_once RX_BASEDIR . 'vendor/autoload.php';
|
||||
|
||||
/**
|
||||
* Load system configuration.
|
||||
|
|
|
|||
|
|
@ -517,6 +517,28 @@ function tobool($input)
|
|||
return (bool)$input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts members of an array or an object.
|
||||
*
|
||||
* @param mixed $array_or_object
|
||||
* @return int
|
||||
*/
|
||||
function countobj($array_or_object)
|
||||
{
|
||||
if (is_array($array_or_object))
|
||||
{
|
||||
return count($array_or_object);
|
||||
}
|
||||
elseif (is_object($array_or_object))
|
||||
{
|
||||
return count(get_object_vars($array_or_object));
|
||||
}
|
||||
else
|
||||
{
|
||||
return @count($array_or_object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given string contains valid UTF-8.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue