### 錯誤和異常處理的變更
許多可以被修正的 Fatal 錯誤,在 PHP7 中將以 Exceptions 異常的形式拋出。這些 Error Exceptions 繼承于?[Error](http://php.net/manual/en/class.error.php)?類。而[Error](http://php.net/manual/en/class.error.php)?類則實現了異常基類?[Throwable](http://php.net/manual/en/class.throwable.php)?接口。?
PHP7 中詳細的 Error 信息可以參考?[PHP7 錯誤](http://php.net/manual/en/language.errors.php7.php)?。本文中僅僅介紹和向后兼容有關的信息如下。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#類構造函數在失敗時拋出異常)類構造函數在失敗時拋出異常
之前,類構造函數在失敗時總是返回NULL或者返回一個不可用的 Object,但從 PHP7 開始,在構造函數初始化失敗時會拋出[異常](http://php.net/manual/en/class.exception.php)。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#解析錯誤時會拋出-解析異常)解析錯誤時會拋出?[解析異常](http://php.net/manual/en/class.parseerror.php)
現在,解析?[eval()](http://php.net/manual/en/function.eval.php)?錯誤會拋出一個?[解析異常](http://php.net/manual/en/class.parseerror.php)?對象。其可以通過?[catch](http://php.net/manual/en/language.exceptions.php#language.exceptions.catch)?捕捉,并做相應處理。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#e_strict-等級的報錯被重新分配)E_STRICT 等級的報錯被重新分配
所有?**E_STRICT**?級別的報錯已重新分配到其他報錯等級中。**E_STRICT**?常量依然保留,所以當你設置報錯等級為**error_reporting(E_ALL|E_STRICT)**?時,不會引起報錯。
變更情況如下表?[](https://box.kancloud.cn/2015-09-11_55f24d39112dc.png)
### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#變量處理環節的變更)變量處理環節的變更
由于 PHP7 采用抽象的語法樹解析代碼文件,并且過去的 PHP 版本無法滿足該特性,這一變化將引起一些一致性問題。本節詳細介紹這塊的情況。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#對于間接變量屬性方法的變動)對于間接變量、屬性、方法的變動
間接的使用變量、屬性、方法,將嚴格按照從左到右的順序執行,而不會因形式問題導致歧義。下表將表明這一改變引起的差異。?[](https://box.kancloud.cn/2015-09-11_55f24d3b79f95.png)以上使用老的從右到左的方式的代碼,將被重寫。通過花括號來明確順序(見上圖中間列),使代碼向前兼容 PHP7.x,并向后兼容 PHP5.x。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#對于-list-函數處理上的修改)對于?[list()](http://php.net/manual/en/function.list.php)?函數處理上的修改
##### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#list-不再按照相反順序插入元素)[list()](http://php.net/manual/en/function.list.php)?不再按照相反順序插入元素
[list()](http://php.net/manual/en/function.list.php)?函數從此開始按照原數組中的順序插入到函數參數制定的位置上,不再翻轉數據。這點修改只會作用在?[list()](http://php.net/manual/en/function.list.php)?函數參數一起用了數組的?`[]`?符號時。舉例如下:
~~~
<?php
list($a[], $a[], $a[]) = [1, 2, 3];
var_dump($a);
?>
~~~
上述例子在 PHP5 中的輸出為:
~~~
array(3) {
[0]=>
int(3)
[1]=>
int(2)
[2]=>
int(1)
}
~~~
而在 PHP7 中的輸出為:
~~~
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
~~~
在實際開發中,不建議使用依靠?[list()](http://php.net/manual/en/function.list.php)?函數的參數來做排順序這一操作,畢竟這樣的 hack 用法在未來依然有可能被調整。
##### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#list-函數參數不再允許為空)[list()](http://php.net/manual/en/function.list.php)?函數參數不再允許為空
[list()](http://php.net/manual/en/function.list.php)?構造時不再允許參數為空的情況,下列情況將不再支持!
~~~
<?php
list() = $a;
list(,,) = $a;
list($x, list(), $y) = $a;
?>
~~~
##### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#list-函數不再支持拆解字符串)[list()](http://php.net/manual/en/function.list.php)?函數不再支持拆解字符串
[list()](http://php.net/manual/en/function.list.php)?不再允許拆解[字符串](http://php.net/manual/en/language.types.string.php)變量為字母,[str_split](http://php.net/manual/en/function.str-split.php)?函數可以用于做此事。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#在數組中的元素通過引用方式創建時數組順序會被改變)在數組中的元素通過引用方式創建時,數組順序會被改變
數組中的元素在通過引用方式創建時,其數組順序會被自動的改變。例如:
~~~
<?php
$array = [];
$array["a"] =& $array["b"];
$array["b"] = 1;
var_dump($array);
?>
~~~
PHP5 中的輸出:
~~~
array(2) {
["b"]=>
&int(1)
["a"]=>
&int(1)
}
~~~
PHP7 中的輸出
~~~
array(2) {
["a"]=>
&int(1)
["b"]=>
&int(1)
}
~~~
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#global-僅支持簡單的變量)[global](http://php.net/manual/en/language.variables.scope.php#language.variables.scope.global)?僅支持簡單的變量
[可變變量](http://php.net/manual/en/language.variables.variable.php)將不能再使用?[global](http://php.net/manual/en/language.variables.scope.php#language.variables.scope.global)?標記。如果真的需要,可以用花括號來間隔開寫,例如下面代碼:
~~~
<?php
function f() {
// Valid in PHP 5 only.
global $$foo->bar;
// Valid in PHP 5 and 7.
global ${$foo->bar};
}
?>
~~~
作為一個基本原則,這樣的變量套變量的使用方式,在?[global](http://php.net/manual/en/language.variables.scope.php#language.variables.scope.global)?這種場景下不被提倡。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#函數參數中的括號不再影響行為)函數參數中的括號不再影響(行為?)
在 PHP5 中,函數引用參數如果匹配括號操作,不會觸發嚴格標準警告。但從 PHP7 開始,這種場景都會引發一個警告信息。
~~~
<?php
function getArray() {
return [1, 2, 3];
}
function squareArray(array &$a) {
foreach ($a as &$v) {
$v **= 2;
}
}
// Generates a warning in PHP 7.
squareArray((getArray()));
?>
~~~
上述示例代碼將會產生如下輸出:
~~~
Notice: Only variables should be passed by reference in /tmp/test.php on line 13
~~~
### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#foreach-的改變)[foreach](http://php.net/manual/en/control-structures.foreach.php)?的改變
關于?[foreach](http://php.net/manual/en/control-structures.foreach.php)?的修改比較少,主要是修改了數組遍歷時的數組指針,以及修改了數組的迭代。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#foreach-遍歷期間不再修改數組指針)[foreach](http://php.net/manual/en/control-structures.foreach.php)?遍歷期間不再修改數組指針
在 PHP7 之前,當數組通過?[foreach](http://php.net/manual/en/control-structures.foreach.php)?迭代時,數組指針會移動。現在開始,不再如此,見下面代碼:
~~~
<?php
$array = [0, 1, 2];
foreach ($array as &$val) {
var_dump(current($array));
}
?>
~~~
PHP5 中的輸出
~~~
int(1)
int(2)
bool(false)
~~~
PHP7 中的輸出
~~~
int(0)
int(0)
int(0)
~~~
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#foreach-通過值遍歷時操作的值為數組的副本)[foreach](http://php.net/manual/en/control-structures.foreach.php)?通過值遍歷時,操作的值為數組的副本
當默認使用通過值遍歷數組時,[foreach](http://php.net/manual/en/control-structures.foreach.php)?實際操作的是數組的迭代副本,而非數組本身。這就意味著,[foreach](http://php.net/manual/en/control-structures.foreach.php)?中的操作不會修改原數組的值。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#foreach-通過引用遍歷時有更好的迭代特性)[foreach](http://php.net/manual/en/control-structures.foreach.php)?通過引用遍歷時,有更好的迭代特性
當使用引用遍歷數組時,現在?[foreach](http://php.net/manual/en/control-structures.foreach.php)?在迭代中能更好的跟蹤變化。例如,在迭代中添加一個迭代值到數組中,例如下面代碼:
~~~
<?php
$array = [0];
foreach ($array as &$val) {
var_dump($val);
$array[1] = 1;
}
?>
~~~
在 PHP5 的輸出為:
~~~
int(0)
~~~
在 PHP7 的輸出為:
~~~
int(0)
int(1)
~~~
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#non-traversable-對象的遍歷)[non-Traversable](http://php.net/manual/en/class.traversable.php)?對象的遍歷
[non-Traversable](http://php.net/manual/en/class.traversable.php)?對象的遍歷與通過引用遍歷相似,具有相同的行為特性,[在遍歷期間對原數據進行的操作將會被感知](http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.foreach.by-ref)。
### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#整型處理上的調整)[整型](http://php.net/manual/en/language.types.integer.php)處理上的調整
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#無效的八進制常量)無效的八進制常量
此前,八進制中包含無效數據會自動被截斷(0128 被當做為 012)。現在,一個無效的八進制字面會造成分析錯誤。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#負位置)負位置
位移的負數將拋出一個?[ArithmeticError](http://php.net/manual/en/class.arithmeticerror.php)
~~~
<?php
var_dump(1 >> -1);
?>
~~~
PHP5 中的輸出:
~~~
int(0)
~~~
PHP7 中的輸出:
~~~
Fatal error: Uncaught ArithmeticError: Bit shift by negative number in /tmp/test.php:2
Stack trace:
#0 {main}
thrown in /tmp/test.php on line 2
~~~
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#超出范圍的位移)超出范圍的位移
位移(任一方向)超出一個整數的位寬度會得到 0。以前,這種轉變的行為是依賴于運行環境的機器架構結構。
### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#字符串處理上的調整)[字符串](http://php.net/manual/en/language.types.string.php)處理上的調整
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#十六進制字符串不再被認為是數字)十六進制字符串不再被認為是數字
含十六進制字符串不再被認為是數字。例如:
~~~
<?php
var_dump("0x123" == "291");
var_dump(is_numeric("0x123"));
var_dump("0xe" + "0x1");
var_dump(substr("foo", "0x1"));
?>
~~~
在 PHP5 中的輸出:
~~~
bool(true)
bool(true)
int(15)
string(2) "oo"
~~~
在 PHP7 中的輸出:
~~~
bool(false)
bool(false)
int(0)
Notice: A non well formed numeric value encountered in /tmp/test.php on line 5
string(3) "foo"
~~~
[filter_var()](http://php.net/manual/en/function.filter-var.php)?函數可以用于檢查一個字符串中是否包含十六進制數,同時也可以轉換一個字符串為十六進制數。
~~~
<?php
$str = "0xffff";
$int = filter_var($str, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX);
if (false === $int) {
throw new Exception("Invalid integer!");
}
var_dump($int); // int(65535)
?>
~~~
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#u-可能觸發錯誤)\u{ 可能觸發錯誤
由于新的?[Unicode 轉譯語法](http://php.net/manual/en/migration70.new-features.php#migration70.new-features.unicode-codepoint-escape-syntax),字符串中含有 **\u{ **?時會觸發Fatal錯誤。為了避免這一報錯,應該避免反斜杠開頭。
### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#被移除的函數)被移除的函數
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#call_user_method-與-call_user_method_array)[call_user_method()](http://php.net/manual/en/function.call-user-method.php)?與?[call_user_method_array()](http://php.net/manual/en/function.call-user-method-array.php)
這些函數被在 PHP4.1.0 開始被標記為過時的,在 PHP7 開始被刪除。建議使用?[call_user_func()](http://php.net/manual/en/function.call-user-func.php)?和?[call_user_func_array()](http://php.net/manual/en/function.call-user-func-array.php)。你可以考慮下[變量函數](http://php.net/manual/en/functions.variable-functions.php)或者參考其他函數。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#mcrypt-相關)[mcrypt](http://php.net/manual/en/book.mcrypt.php)?相關
[mcrypt_generic_end()](http://php.net/manual/en/function.mcrypt-generic-end.php)?被刪除,建議使用?[mcrypt_generic_deinit()](http://php.net/manual/en/function.mcrypt-generic-deinit.php)?。 此外,廢棄的[mcrypt_ecb()](http://php.net/manual/en/function.mcrypt-ecb.php),[mcrypt_cbc()](http://php.net/manual/en/function.mcrypt-cbc.php),[mcrypt_cfb()](http://php.net/manual/en/function.mcrypt-cfb.php)?和?[mcrypt_ofb()](http://php.net/manual/en/function.mcrypt-ofb.php)?功能,建議使用目前還支持的?[mcrypt_decrypt()](http://php.net/manual/en/function.mcrypt-decrypt.php)?與適當的 MCRYPT_MODE_* 常量。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#intl-相關)[intl](http://php.net/manual/en/book.intl.php)?相關
[datefmt_set_timezone_id()](http://php.net/manual/en/intldateformatter.settimezoneid.php)?與?[IntlDateFormatter::setTimeZoneID()](http://php.net/manual/en/intldateformatter.settimezoneid.php)?被刪除,建議使用?[datefmt_set_timezone()](http://php.net/manual/en/intldateformatter.settimezone.php)?與[IntlDateFormatter::setTimeZone()](http://php.net/manual/en/intldateformatter.settimezone.php)?。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#set_magic_quotes_runtime)[set_magic_quotes_runtime()](http://php.net/manual/en/function.set-magic-quotes-runtime.php)
[set_magic_quotes_runtime()](http://php.net/manual/en/function.set-magic-quotes-runtime.php)?與它的別名函數?[magic_quotes_runtime()](http://php.net/manual/en/function.magic-quotes-runtime.php)?被刪除。他們在 PHP5.3.0 中就被標記被過時的。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#set_socket_blocking)[set_socket_blocking()](http://php.net/manual/en/function.set-socket-blocking.php)
[set_socket_blocking()](http://php.net/manual/en/function.set-socket-blocking.php)?已被移除,建議使用?[stream_set_blocking()](http://php.net/manual/en/function.stream-set-blocking.php)。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#dl-在php-fpm中)[dl()](http://php.net/manual/en/function.dl.php)?在PHP-FPM中
[dl()](http://php.net/manual/en/function.dl.php)?函數不能在 PHP-FPM 中使用了,它的功能做在了 CLI、嵌入到 SAPIs 中了。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#gd-類型的函數)[GD](http://php.net/manual/en/book.image.php)?類型的函數
PostScript Type1 字體的支持已經從 GD 擴展刪除,涉及的函數有:
* imagepsbbox()
* imagepsencodefont()
* imagepsextendfont()
* imagepsfreefont()
* imagepsloadfont()
* imagepsslantfont()
* imagepstext() 建議使用 TrueType 字體和其相關的功能代替。
### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#刪除ini配置)刪除INI配置
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#刪除的功能)刪除的功能
下面的INI指令以及相關的功能被刪除:
* [always_populate_raw_post_data](http://php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data)
* [asp_tags](http://php.net/manual/en/ini.core.php#ini.asp-tags)
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#xslsecurity_prefs)xsl.security_prefs
xsl.security_prefs 指令已被刪除。相反,該?[xsltprocessor::setsecurityprefs()](http://php.net/manual/en/xsltprocessor.setsecurityprefs.php)?方法用于控制在每個處理器上的安全選項。
### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#其他不向后兼容的變更)其他不向后兼容的變更
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#new-對象不能被引用分配)[New](http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.new)?對象不能被引用分配
[New](http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.new)?語句的結果不再能通過引用賦值給一個變量,如下代碼:
~~~
<?php
class C {}
$c =& new C;
?>
~~~
PHP5 中的輸出:
~~~
Deprecated: Assigning the return value of new by reference is deprecated in /tmp/test.php on line 3
~~~
PHP7 中的輸出:
~~~
Parse error: syntax error, unexpected 'new' (T_NEW) in /tmp/test.php on line 3
~~~
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#無效的類接口和特性的名字)無效的類、接口和特性的名字
下面的名稱不能被用來作為類、接口、特性的名稱:
* bool
* int
* float
* string
* NULL
* TRUE
* FALSE
此外,不推薦下列名稱,它們已被標記為過時
* resource
* object
* mixed
* numeric
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#asp-語法標記script-php-語法標記被移除)ASP 語法標記、Script PHP 語法標記被移除
使用 ASP 腳本標簽,或者 Script 的 PHP 代碼,已被刪除。受影響的標簽是:?[](https://box.kancloud.cn/2015-09-11_55f24d3c12688.png)
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#禁止調用不確定的情況)禁止調用不確定的情況
[之前 PHP5.6 的過時說明中](http://php.net/manual/en/migration56.deprecated.php#migration56.deprecated.incompatible-context),靜態調用一個非靜態方法,會在靜態調用中被提示未定義 $this ,并會報錯。
~~~
<?php
class A {
public function test() { var_dump($this); }
}
// Note: Does NOT extend A
class B {
public function callNonStaticMethodOfA() { A::test(); }
}
(new B)->callNonStaticMethodOfA();
?>
~~~
在 PHP5 中會輸出:
~~~
Deprecated: Non-static method A::test() should not be called statically, assuming $this from incompatible context in /tmp/test.php on line 8
object(B)#1 (0) {
}
~~~
在 PHP7 中會輸出:
~~~
Deprecated: Non-static method A::test() should not be called statically in /tmp/test.php on line 8
Notice: Undefined variable: this in /tmp/test.php on line 3
NULL
~~~
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#yield-現在開始作為右關聯運算符)[yield](http://php.net/manual/en/language.generators.syntax.php#control-structures.yield)?現在開始作為(右)關聯運算符
[yield](http://php.net/manual/en/language.generators.syntax.php#control-structures.yield)?不再需要括號,可以作為一個(右)關聯運算符,優先于?`print`?與?`=>`,這將產生下列行為:
~~~
<?php
echo yield -1;
// Was previously interpreted as
echo (yield) - 1;
// And is now interpreted as
echo yield (-1);
yield $foo or die;
// Was previously interpreted as
yield ($foo or die);
// And is now interpreted as
(yield $foo) or die;
?>
~~~
括號可以用來消除歧義的情況。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#函數不能有多個相同的名稱的參數)函數不能有多個相同的名稱的參數
不允許函數在參數中出現相同名稱的參數。例如下列代碼,將會產生?**E_COMPILE_ERROR**?的報錯。
~~~
<?php
function foo($a, $b, $unused, $unused) {
//
}
?>
~~~
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#http_raw_post_data-被移除)[$HTTP_RAW_POST_DATA](http://php.net/manual/en/reserved.variables.httprawpostdata.php)?被移除
`$HTTP_RAW_POST_DATA`?不再被支持。 可以使用 php://input 流數據來代替實現。
#### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Backward-incompatible-changes.md#-注釋已被移除)# 注釋已被移除
INI 文件中以 # 符號作為注釋的內容已被移除,**;**?符號將代替?**#**,這個改變同樣適用于?`PHP.ini`?文件,以及?[parse_ini_file()](http://php.net/manual/en/function.parse-ini-file.php)和?[parse_ini_string()](http://php.net/manual/en/function.parse-ini-string.php)?處理文件期間。