🌑

小羊儿的心情天空

Discuz! X3.0 移植 PHP7.0 脑洞测试

Dec 6, 2015 由 小羊

更新:好吧……大神总是比我快23333

http://loger.me/tech/discuz-x32-php7.html

选择狗带,选择新生

没错我的脑洞就是这样的大~

之所以用X3.0而不用X3.2是因为X3.2太“腾讯”了233333

数据库引擎

PHP7.0开始正式弃用mysql(其实5.4开始已经标记Deprecated了),所以需要mysqli代替。

Action: 从X3.2复制过来。(才不是偷懒呢~)

XML相关函数

PHP7.0已经用不了xml_parse系列函数了(php manual上是这么写的quq)

Action: /source/class/class_xml.php

<?php
/*来自dz的版权233*/

function xml2array(&$xml, $isnormal = FALSE) {
	$doc = simplexml_load_string($xml);
	$sa = _int_xml2array($doc);
	return $sa;
}

function _int_xml2array(&$xml) {
	if (!$xml->children()) return (string) $xml;
	$array = array();
	foreach ($xml->children() as $element => $node) {
		foreach($node->attributes() as $name)
		{
			$array[(string)$name] = (count($node) > 0) ? _int_xml2array($node) : (string)$node;
		}
	}
	return $array;
}

$_G[setting]内容集体失踪

目前插入print_r显示的setting都为空,而初始化函数都还在。

等待排查。

…… Coming soon~~~

选择狗带,选择新生。