1 頁 (共 1 頁)

[問題] 2.0.17更新到2.0.18

發表於 : 2005-11-16 14:25
streitleak
發生了
Warning: in_array(): Wrong datatype for second argument in D:\ACG3\phpBB2\common.php on line 79

Warning: Cannot modify header information - headers already sent by (output started at D:\ACG3\phpBB2\common.php:79) in D:\ACG3\phpBB2\includes\sessions.php on line 255

Warning: Cannot modify header information - headers already sent by (output started at D:\ACG3\phpBB2\common.php:79) in D:\ACG3\phpBB2\includes\sessions.php on line 256

Warning: Cannot modify header information - headers already sent by (output started at D:\ACG3\phpBB2\common.php:79) in D:\ACG3\phpBB2\includes\sessions.php on line 255

Warning: Cannot modify header information - headers already sent by (output started at D:\ACG3\phpBB2\common.php:79) in D:\ACG3\phpBB2\includes\sessions.php on line 256

Warning: Cannot modify header information - headers already sent by (output started at D:\ACG3\phpBB2\common.php:79) in D:\ACG3\phpBB2\includes\functions.php on line 831

紅色部分出現很多次..其他部分有參考此篇
http://phpbb-tw.net/phpbb/viewtopic.php?t=39729
檢查後沒有多餘的空白...純手動更新...目前還在找原因中...

代碼: 選擇全部

if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
	if (!isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS))
	{
		$HTTP_SESSION_VARS = array();
	}

	// Merge all into one extremely huge array; unset
	// this later
	$input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);

	unset($input['input']);
	unset($input['not_unset']);

	while (list($var,) = @each($input))
	{
[color=red]line 79		if(!in_array($var,$not_unset))[/color]
		{
			unset($$var);
		}
	}
	
	unset($input);
}

發表於 : 2005-11-16 14:56
~倉木麻衣~
升級文件中關於common.php的修改部份再怎麼改, 也不致於會缺了這一行(紅色標示部份)
底下是以修改後的程式碼為例
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
// PHP4+ path
$not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path');

// Not only will array_merge give a warning if a parameter
// is not an array, it will actually fail. So we check if
// HTTP_SESSION_VARS has been initialised.

if (!isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS))
{
$HTTP_SESSION_VARS = array();
}

發表於 : 2005-11-16 14:58
flower
那段應該是這樣才對....您可能在取代的時候不小心刪除了 PHP4+ path 那部份...
可以比對一下 2.0.18 完整檔案中的 common.php

代碼: 選擇全部

if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
	// PHP4+ path
	$not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path');

	// Not only will array_merge give a warning if a parameter
	// is not an array, it will actually fail. So we check if
	// HTTP_SESSION_VARS has been initialised.
	if (!isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS))
	{
		$HTTP_SESSION_VARS = array();
	}

	// Merge all into one extremely huge array; unset
	// this later
	$input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);

	unset($input['input']);
	unset($input['not_unset']);

	while (list($var,) = @each($input))
	{
		if (!in_array($var, $not_unset))
		{
			unset($$var);
		}
	}

	unset($input);
}

發表於 : 2005-11-16 15:06
streitleak

代碼: 選擇全部

#
#-----[ OPEN ]---------------------------------------------
#
common.php

#
#-----[ FIND ]---------------------------------------------
#
// The following code (unsetting globals) was contributed by Matt Kavanagh

#
#-----[ REPLACE WITH ]---------------------------------------------
#
// The following code (unsetting globals)
// Thanks to Matt Kavanagh and Stefan Esser for providing feedback as well as patch files

#
#-----[ FIND ]---------------------------------------------
#
// PHP5 with register_long_arrays off?
if (!isset($HTTP_POST_VARS) && isset($_POST))
{
	$HTTP_POST_VARS = $_POST;
	$HTTP_GET_VARS = $_GET;
	$HTTP_SERVER_VARS = $_SERVER;
	$HTTP_COOKIE_VARS = $_COOKIE;
	$HTTP_ENV_VARS = $_ENV;
	$HTTP_POST_FILES = $_FILES;

	// _SESSION is the only superglobal which is conditionally set
	if (isset($_SESSION))
	{
		$HTTP_SESSION_VARS = $_SESSION;
	}
}

#
#-----[ REPLACE WITH ]---------------------------------------------
#
// PHP5 with register_long_arrays off?
if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off'))
{
	$HTTP_POST_VARS = $_POST;
	$HTTP_GET_VARS = $_GET;
	$HTTP_SERVER_VARS = $_SERVER;
	$HTTP_COOKIE_VARS = $_COOKIE;
	$HTTP_ENV_VARS = $_ENV;
	$HTTP_POST_FILES = $_FILES;

	// _SESSION is the only superglobal which is conditionally set
	if (isset($_SESSION))
	{
		$HTTP_SESSION_VARS = $_SESSION;
	}
}

// Protect against GLOBALS tricks
if (isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS']) || isset($HTTP_COOKIE_VARS['GLOBALS']))
{
	die("Hacking attempt");
}

// Protect against HTTP_SESSION_VARS tricks
if (isset($HTTP_SESSION_VARS) && !is_array($HTTP_SESSION_VARS))
{
	die("Hacking attempt");
}

#
#-----[ FIND ]---------------------------------------------
#
if (@phpversion() < '4.0.0')
{
	// PHP3 path; in PHP3, globals are _always_ registered
	
	// We 'flip' the array of variables to test like this so that
	// we can validate later with isset($test[$var]) (no in_array())
	$test = array('HTTP_GET_VARS' => NULL, 'HTTP_POST_VARS' => NULL, 'HTTP_COOKIE_VARS' => NULL, 'HTTP_SERVER_VARS' => NULL, 'HTTP_ENV_VARS' => NULL, 'HTTP_POST_FILES' => NULL, 'phpEx' => NULL, 'phpbb_root_path' => NULL);

	// Loop through each input array
	@reset($test);
	while (list($input,) = @each($test))
	{
		while (list($var,) = @each($$input))
		{
			// Validate the variable to be unset
			if (!isset($test[$var]) && $var != 'test' && $var != 'input')
			{
				unset($$var);
			}
		}
	}
}
else if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{

#
#-----[ REPLACE WITH ]---------------------------------------------
#
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{

#
#-----[ FIND ]---------------------------------------------
#
	if (!isset($HTTP_SESSION_VARS))
	{
		$HTTP_SESSION_VARS = array();
	}

	// Merge all into one extremely huge array; unset
	// this later
	$input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);

	unset($input['input']);
	unset($input['not_unset']);

	while (list($var,) = @each($input))
	{
		if (!in_array($var, $not_unset))
		{
			unset($$var);
		}
	}

	unset($input);
}

#
#-----[ REPLACE WITH ]---------------------------------------------
#
	if (!isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS))
	{
		$HTTP_SESSION_VARS = array();
	}

	// Merge all into one extremely huge array; unset
	// this later
	$input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);

	unset($input['input']);
	unset($input['not_unset']);

	while (list($var,) = @each($input))
	{
		if (!in_array($var, $not_unset))
		{
			unset($$var);
		}
	}

	unset($input);
}

#
#-----[ FIND ]---------------------------------------------
#
	header("Location: install/install.$phpEx");

#
#-----[ REPLACE WITH ]---------------------------------------------
#
	header('Location: ' . $phpbb_root_path . 'install/install.' . $phpEx);
這是官方給的升級說明XD

發表於 : 2005-11-16 15:09
streitleak
剛看了舊版的...果然是我耍笨把他砍了XD
現在OK了....