上一个问题:get_magic_quotes_gpc()返回代码中未定义的值
那么...
我修复了以下问题:
Fatal error: Cannot declare class CI_Log, because the name is already in use in D:\xampp\htdocs\system\libraries\Log.php on line 27 (line 27) class CI_Log {
以这种方式:
/**
* Error Logging Interface
*
* We use this as a simple mechanism to access the logging
* class and send messages to be logged.
*
* @access public
* @return void
*/
if ( ! function_exists('log_message'))
{
function log_message($level = 'error', $message, $php_error = FALSE)
{
static $_log;
if (config_item('log_threshold') == 1)
{
return;
}
$_log =& load_class('Log');
$_log->write_log($level, $message, $php_error);
}
}
我变了
"if (config_item ('log_threshold') == 0)"
到
"if (config_item ('log_threshold') == 1)"
在Common.php文件中
在
D:\xampp\htdocs\system\core\Common.php
但现在出现了新错误。
Fatal error: Uncaught TypeError: filter_var(): Argument #3 ($options) must be of type array|int, string given in
D:\xampp\htdocs\system\core\Input.php:391
Stack trace:
_______________________________________________________________________________
#0 D:\xampp\htdocs\system\core\Input.php(391): filter_var('127.0.0.1', 275, '')
// First check if filter_var is available
if (is_callable('filter_var'))
{
switch ($which) {
case 'ipv4':
$flag = FILTER_FLAG_IPV4;
break;
case 'ipv6':
$flag = FILTER_FLAG_IPV6;
break;
default:
$flag = '';
break;
}
return (bool) filter_var($ip, FILTER_VALIDATE_IP, $flag);
}
_______________________________________________________________________________
#1 D:\xampp\htdocs\system\core\Input.php(354): CI_Input->valid_ip('127.0.0.1')
if ( ! $this->valid_ip($this->ip_address))
_______________________________________________________________________________
#2 D:\xampp\htdocs\application\models\cms_model.php(32): CI_Input->ip_address()
if(!$this->input->is_ajax_request() && !isset($_GET['is_json_ajax']))
{
$this->db->query("INSERT INTO visitor_log(`date`, `ip`) VALUES(?, ?)", array(date("Y-m-d"), $this->input->ip_address()));
}
_______________________________________________________________________________
#3 D:\xampp\htdocs\application\models\cms_model.php(24): Cms_model->logVisit()
$this->logVisit();
_______________________________________________________________________________
#4 D:\xampp\htdocs\system\core\Loader.php(303): Cms_model->__construct()
$CI->$name = new $model();
_______________________________________________________________________________
#5 D:\xampp\htdocs\application\third_party\MX\Loader.php(192): CI_Loader->model('Cms_model', 'cms_model', false)
/* check application & packages */
parent::model($model, $object_name, $connect);
_______________________________________________________________________________
#6 D:\xampp\htdocs\application\libraries\realms.php(42): MX_Loader->model('cms_model')
// Get the realms
$this->CI->load->model('cms_model');
_______________________________________________________________________________
#7 D:\xampp\htdocs\system\core\Loader.php(1099): Realms->__construct()
{
$CI->$classvar = new $name;
}
_______________________________________________________________________________
#8 D:\xampp\htdocs\system\core\Loader.php(975): CI_Loader->_ci_init_class('realms', '', NULL, NULL)
return $this->_ci_init_class($class, '', $params, $object_name);
_______________________________________________________________________________
#9 D:\xampp\htdocs\application\third_party\MX\Loader.php(155): CI_Loader->_ci_load_class('Realms', NULL, NULL)
$this->_ci_load_class($library, $params, $object_name);
_______________________________________________________________________________
#10 D:\xampp\htdocs\system\core\Loader.php(1178): MX_Loader->library('realms')
{
$this->library($item);
}
_______________________________________________________________________________
#11 D:\xampp\htdocs\system\core\Loader.php(152): CI_Loader->_ci_autoloader()
/**
* Initialize the Loader
*
* This method is called once in CI_Controller.
*
* @param array
* @return object
*/
public function initialize()
{
$this->_ci_classes = array();
$this->_ci_loaded_files = array();
$this->_ci_models = array();
$this->_base_classes =& is_loaded();
$this->_ci_autoloader();
return $this;
}
_______________________________________________________________________________
#12 D:\xampp\htdocs\application\third_party\MX\Loader.php(59): CI_Loader->initialize()
/** Initialize the loader variables **/
public function initialize($controller = NULL) {
if (is_a($controller, 'MX_Controller')) {
/* reference to the module controller */
$this->controller = $controller;
/* references to ci loader variables */
foreach (get_class_vars('CI_Loader') as $var => $val) {
if ($var != '_ci_ob_level') {
$this->$var =& CI::$APP->load->$var;
}
}
} else {
parent::initialize();
}
_______________________________________________________________________________
#13 D:\xampp\htdocs\system\core\Controller.php(51): MX_Loader->initialize()
public function __construct()
{
self::$instance =& $this;
// Assign all the class objects that were instantiated by the
// bootstrap file (CodeIgniter.php) to local class variables
// so that CI can run as one big super object.
foreach (is_loaded() as $var => $class)
{
$this->$var =& load_class($class);
}
$this->load =& load_class('Loader', 'core');
$this->load->initialize();
log_message('debug', "Controller Class Initialized");
}
_______________________________________________________________________________
#14 D:\xampp\htdocs\application\third_party\MX\Base.php(55): CI_Controller->__construct()
class CI extends CI_Controller
{
public static $APP;
public function __construct() {
/* assign the application instance */
self::$APP = $this;
global $LANG, $CFG;
/* re-assign language and config for modules */
if ( ! is_a($LANG, 'MX_Lang')) $LANG = new MX_Lang;
if ( ! is_a($CFG, 'MX_Config')) $CFG = new MX_Config;
parent::__construct();
}
}
_______________________________________________________________________________
#15 D:\xampp\htdocs\application\third_party\MX\Base.php(60): CI->__construct()
/* create the application object */
new CI;
_______________________________________________________________________________
#16 D:\xampp\htdocs\application\third_party\MX\Controller.php(4): require('D:\\xampp\\htdocs...')
/** load the CI class for Modular Extensions **/
require dirname(__FILE__).'/Base.php';
_______________________________________________________________________________
#17 D:\xampp\htdocs\application\third_party\MX\Modules.php(119): include_once('D:\\xampp\\htdocs...')
/* autoload Modular Extensions MX core classes */
if (strstr($class, 'MX_') AND is_file($location = dirname(__FILE__).'/'.substr($class, 3).EXT)) {
include_once $location;
return;
}
_______________________________________________________________________________
#18 D:\xampp\htdocs\application\modules\news\controllers\news.php(3): Modules::autoload('MX_Controller')
class News extends MX_Controller
_______________________________________________________________________________
#19 D:\xampp\htdocs\system\core\CodeIgniter.php(249): include('D:\\xampp\\htdocs...')
include(APPPATH.'controllers/'.$RTR->directory.$RTR->class.'.php');
_______________________________________________________________________________
#20 D:\xampp\htdocs\index.php(228): require_once('D:\\xampp\\htdocs...')
require_once BASEPATH.'core/CodeIgniter.php';
_______________________________________________________________________________
#21 {main} thrown in D:\xampp\htdocs\system\core\Input.php on line 391
我不是一个有经验的程序员,我是一个新手。
我用直觉修复了一些东西,因为直觉是我的主导技能,但直觉可以帮助我到一定程度,我需要那些谁知道比我更多的经验和知识,不仅修复这个问题,而且提高自己,这将是非常感谢,如果有人是善良的帮助我走出这个错误的洪水恢复我的网站,谢谢。
2条答案
按热度按时间pgpifvop1#
将switch语句的默认部分更改为以下内容应可解决此问题:
看起来这一定是旧版本CodeIgniter中的一个bug。在switch语句的“default”情况下,它将一个空字符串作为第三个参数传递给
filter_var
,但它必须接收一个array
或int
。在PHP 8上,它可能只是开始导致致命错误,因为8引入了混合类型的类型提示:https://www.php.net/manual/en/language.types.declarations.php
mixed等效于联合类型数组|布尔|可赎回的|整数|浮动|客体|资源|弦|null。自PHP 8.0.0起可用。
您可以使用此工具查看不同版本的PHP上发生的情况:https://3v4l.org/Sd6oS
**EDIT -**这可能不会修复 * 所有 * 你的错误,但可能是最好的过去,一个第一,看看你留下了什么。
snz8szmq2#
我通过将PHP版本从8更改为7.4修复了此问题,基本上只使用xampp版本https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/7.4.33/