我的网站上有一个PHP文件,从PHP 5.3升级到PHP 5.4后产生错误。这是它产生的错误:
警告:从空值中创建默认对象(删除它 第60行的/arcade.php错误的一部分
这就是60之后的代码:
{
$this->arcade->version = '';
}else
{
$this->arcade->version = '3.4.0';
}
我假设它与那里的空白值有关。我研究了一些类似的修复程序,但我仍然无法确定应该添加到php文件中的确切内容来修复它。
非常感谢您提前提供任何帮助!
编辑:这里的其余代码我不知道它在哪里初具。我对这些事情一无所知。
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files. <br /> <b>File Version 3.3.0</b>";
exit();
}
class component_public
{
var $ipsclass = '';
var $arcade = '';
function run_component()
{
$this->ipsclass->load_language( 'lang_Arcade' );
if( !$this->ipsclass->cache['arcade_settings']['allow_user_skin'] )
{
if( $this->ipsclass->cache['arcade_settings']['skin'] == 0 ) {
$this->ipsclass->load_template('skin_Arcade1');
}
if( $this->ipsclass->cache['arcade_settings']['skin'] == 1 ) {
$this->ipsclass->load_template('skin_Arcade2');
}
if( $this->ipsclass->cache['arcade_settings']['skin'] == 2 ) {
$this->ipsclass->load_template('skin_Arcade3');
}
}else
if( $this->ipsclass->cache['arcade_settings']['allow_user_skin'] && !$this->ipsclass->member['id'] )
{
if( $this->ipsclass->cache['arcade_settings']['skin'] == 0 ) {
$this->ipsclass->load_template('skin_Arcade1');
}
if( $this->ipsclass->cache['arcade_settings']['skin'] == 1 ) {
$this->ipsclass->load_template('skin_Arcade2');
}
if( $this->ipsclass->cache['arcade_settings']['skin'] == 2 ) {
$this->ipsclass->load_template('skin_Arcade3');
}
}else
if( $this->ipsclass->cache['arcade_settings']['allow_user_skin'] && $this->ipsclass->member['id'] )
{
$this->ipsclass->DB->query("SELECT arcade_skin FROM ".$this->ipsclass->vars['sql_tbl_prefix']."members WHERE id=".intval($this->ipsclass->member['id']));
$this->arcade->lib->user = $this->ipsclass->DB->fetch_row();
if( $this->arcade->lib->user['arcade_skin'] == 0) {
$this->ipsclass->load_template('skin_Arcade1');
}
if( $this->arcade->lib->user['arcade_skin'] == 1) {
$this->ipsclass->load_template('skin_Arcade2');
}
if( $this->arcade->lib->user['arcade_skin'] == 2) {
$this->ipsclass->load_template('skin_Arcade3');
}
}
if( !$this->ipsclass->cache['arcade_settings']['build'] )
{
$this->arcade->version = '';
}else
{
$this->arcade->version = '3.4.0';
}
$this->ipsclass->vars['arcade_dir'] = 'arcade';
$component_copyright = '<div class="copyright" align="center"><a href="http://www.ibparcade.com" style="text-decoration: none;" target="_blank">ibProArcade</a> '.$this->arcade->version.' © '.date('Y').'</div>';
$this->ipsclass->skin['_wrapper'] = str_replace("<% COPYRIGHT %>", $component_copyright . "<% COPYRIGHT %>", $this->ipsclass->skin['_wrapper']);
require ROOT_PATH.$this->ipsclass->vars['arcade_dir'].'/db/arcade_mysql.php';
$this->arcade->db = new arcade_db;
$this->arcade->db->ipsclass =& $this->ipsclass;
require ROOT_PATH.$this->ipsclass->vars['arcade_dir'].'/modules/arcadelib.php';
$this->arcade->lib = new arcadelib;
$this->arcade->lib->ipsclass =& $this->ipsclass;
$this->arcade->lib->arcade =& $this->arcade;
$this->arcade->lib->init();
require ROOT_PATH.$this->ipsclass->vars['arcade_dir'].'/modules/scoreboard.php';
$this->arcade->sb = new scoreboard;
$this->arcade->sb->ipsclass =& $this->ipsclass;
$this->arcade->sb->arcade =& $this->arcade;
require ROOT_PATH.$this->ipsclass->vars['arcade_dir'].'/modules/arcadeskin.php';
$this->arcade->skin = new arcadeskin;
$this->arcade->skin->ipsclass =& $this->ipsclass;
$this->arcade->skin->arcade =& $this->arcade;
require_once ROOT_PATH.'sources/api/api_topics_and_posts.php';
$this->arcade->api = new api_topics_and_posts();
$this->arcade->api->ipsclass =& $this->ipsclass;
if( $this->arcade->lib->settings['arcade_status'] )
{
$this->arcade->lib->arcade_error( array( LEVEL => 1, MSG => 'arcade_offlinemsg' ) );
}
$page = (isset($this->ipsclass->input['p'])) ? $this->ipsclass->txt_alphanumerical_clean( $this->ipsclass->input['p'] ) : 'default';
$code = (isset($this->ipsclass->input['code'])) ? $this->ipsclass->input['code'] : '';
// Backwords compatibility with older games
if( isset($this->ipsclass->input['do']) && ($this->ipsclass->input['do'] == 'newscore') )
{
$code = 'newscore';
}
if( isset($this->ipsclass->input['do']) && ($this->ipsclass->input['do'] == 'verifyscore') )
{
$code = 'verifyscore';
}
if( isset($this->ipsclass->input['do']) && ($this->ipsclass->input['do'] == 'savescore') )
{
$code = 'savescore';
}
$file = ROOT_PATH.$this->ipsclass->vars['arcade_dir'].'/modules/page_'.$page.'.php';
if( file_exists($file) )
{
require $file;
}
else
{
require ROOT_PATH.$this->ipsclass->vars['arcade_dir'].'/modules/page_default.php';
}
$runme = new arcade_page;
$runme->ipsclass =& $this->ipsclass;
$runme->arcade =& $this->arcade;
$runme->exec_page( $code );
}
}
答案 0 :(得分:0)
如果尝试访问不存在的对象的属性,则会出现此错误,如下所示:
$arcade = null;
$arcade->version = '3.4.0';
为了解决此问题,您的$this->arcade
属性不应为空。
<强> UPD。强>
首先,完全删除arcade
定义/初始化的行:
class component_public
{
var $ipsclass = '';
function run_component()
{
$this->ipsclass->load_language( 'lang_Arcade' );
接下来,添加这段代码:
class SilentAssasin {
public function __get($property) {
return $this->{$property} = new static();
}
}
class component_public extends SilentAssasin
{
而不是:
class component_public
{
必须修复creating from empty
错误。
啊,忘记提及...... SilentAssasin
只是自定义类的名称,您实际上可以将其命名为任何名称,例如PathosErrorSuppressor
或OversizedBanHammerForThatStupidError
等的