久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='UwmRZ'></bdo><ul id='UwmRZ'></ul>

      <small id='UwmRZ'></small><noframes id='UwmRZ'>

      <legend id='UwmRZ'><style id='UwmRZ'><dir id='UwmRZ'><q id='UwmRZ'></q></dir></style></legend>

    1. <tfoot id='UwmRZ'></tfoot>
      <i id='UwmRZ'><tr id='UwmRZ'><dt id='UwmRZ'><q id='UwmRZ'><span id='UwmRZ'><b id='UwmRZ'><form id='UwmRZ'><ins id='UwmRZ'></ins><ul id='UwmRZ'></ul><sub id='UwmRZ'></sub></form><legend id='UwmRZ'></legend><bdo id='UwmRZ'><pre id='UwmRZ'><center id='UwmRZ'></center></pre></bdo></b><th id='UwmRZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='UwmRZ'><tfoot id='UwmRZ'></tfoot><dl id='UwmRZ'><fieldset id='UwmRZ'></fieldset></dl></div>
      1. E_STRICT 有什么作用?

        What does E_STRICT do?(E_STRICT 有什么作用?)

            <tbody id='VtRpM'></tbody>
          <tfoot id='VtRpM'></tfoot>

          <small id='VtRpM'></small><noframes id='VtRpM'>

          • <bdo id='VtRpM'></bdo><ul id='VtRpM'></ul>
              <legend id='VtRpM'><style id='VtRpM'><dir id='VtRpM'><q id='VtRpM'></q></dir></style></legend>

                1. <i id='VtRpM'><tr id='VtRpM'><dt id='VtRpM'><q id='VtRpM'><span id='VtRpM'><b id='VtRpM'><form id='VtRpM'><ins id='VtRpM'></ins><ul id='VtRpM'></ul><sub id='VtRpM'></sub></form><legend id='VtRpM'></legend><bdo id='VtRpM'><pre id='VtRpM'><center id='VtRpM'></center></pre></bdo></b><th id='VtRpM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VtRpM'><tfoot id='VtRpM'></tfoot><dl id='VtRpM'><fieldset id='VtRpM'></fieldset></dl></div>

                  本文介紹了E_STRICT 有什么作用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我實際上很想確保我們的代碼庫沒有錯誤,PHP 的內置錯誤檢查會警告這些錯誤,但我想確切地了解 E_STRICT 強制執行的內容.通過擴展,PHP 的嚴格標準"是什么?我查看了但找不到完整的列表.

                  I'm actually interested in making sure our codebase is free of errors that would be warned against by PHP's builtin error checking, but I'd like to see exactly what E_STRICT enforces. By extension, what are PHP's "strict standards"? I looked but couldn't find a comprehensive list.

                  我從經驗中了解到的一些嚴格標準:

                  Some strict standards that I know offhand from experience:

                  • 警告不要靜態調用非靜態方法
                  • 警告不兼容的子類函數簽名
                  • 警告不要通過引用分配值

                  我所知道的關于 E_STRICT 的全部內容是它對可能破壞向前兼容性的代碼發出警告,但我不確定這具體意味著什么.

                  All I know about E_STRICT is that it warns against code which might break forward compatibility, but I'm not sure what that means concretely.

                  有沒有關于這方面的信息的好資源?

                  Is there a good resource out there for information on this?

                  推薦答案

                  E_STRICT 和嚴格標準"是一回事.(并且 它們在 PHP 7 中被移除.)

                  E_STRICT and "strict standards" are the same thing. (And they're removed in PHP 7.)

                  該文檔目前沒有 E_STRICT 特定警告的列表,但我們可以通過搜索 PHP 源代碼.

                  The documentation presently has no list of E_STRICT-specific warnings, but we can construct one reasonably easily by searching the PHP source.

                  以下列表(我認為自 PHP 5.6 起是準確的)是通過以下方法在 Unix 系統上形成的:

                  The list below (which I believe to be accurate as of PHP 5.6) was formed on a Unix system via the following methodology:

                  1. 克隆 PHP Git 存儲庫:

                  1. Cloning the PHP Git repo:

                  git clone https://github.com/php/php-src
                  

                2. 正在檢查 5.6.0 版:

                3. Checking out version 5.6.0:

                  cd php-src
                  git checkout PHP-5.6.0
                  

                4. 搜索包含 E_STRICT 的所有 C 文件(帶有 .h.c 擴展名的文件):

                5. Searching for all C files (ones with .h and .c extensions) containing E_STRICT:

                  grep --include=*.[ch] -rl . -e E_STRICT
                  

                6. 手動查看 (21) 個匹配文件中的每一個以查找發出 E_STRICT 警告的代碼,嘗試推斷發出警告的情況(我不是 C程序員,但對這些東西做出很好的猜測并不太難,尤其是代碼中的人類可讀錯誤消息可以指導您)然后在交互式 PHP shell 中測試它們以確保我是對的.

                7. Manually looking through each of the (21) matched files to find code emitting E_STRICT warnings, attempting to deduce the circumstances in which the warning would be emitted (I'm not a C programmer, but it's not too hard to take a good guess at this stuff, especially with the human-readable error messages right there in the code to guide you) then testing them at the interactive PHP shell to make sure I was right.

                  鑒于上述方法略顯粗糙,并且依賴于以下假設:E_STRICT 可以在源代碼中所有發出 E_STRICT 警告的地方旁邊找到,我可能遺漏了一些東西 - 但希望這至少接近成為一個全面的列表.

                  Given that the methodology described above is slightly crude and depends upon the assumption that E_STRICT can be found in the source code next to all places where E_STRICT warnings are emitted, it's possible I've missed some stuff - but this is hopefully at least close to being a comprehensive list.

                  1. 調用mktime()沒有參數

                  php > mktime();
                  PHP Strict Standards:  mktime(): You should be using the time() function
                  instead in php shell code on line 1

                8. 使用資源作為數組索引>

                9. Using a resource as an array index

                  php > $file_pointer = fopen('/dev/null', 'r');
                  php > $array = [3,4,5,6];
                  php > $array[$file_pointer];
                  PHP Strict Standards:  Resource ID#2 used as offset, casting to integer (2)
                  in php shell code on line 1

                10. 將 UTF-8 以外的多字節編碼傳遞給 htmlentities

                  php > htmlentities('qwertyuiop', 0, 'BIG5');
                  PHP Strict Standards:  htmlentities(): Only basic entities substitution is
                  supported for multi-byte encodings other than UTF-8; functionality is
                  equivalent to htmlspecialchars in php shell code on line 1

                11. 聲明一個抽象 靜態方法

                  php > abstract class Foo { static abstract function bar(); }
                  PHP Strict Standards:  Static function Foo::bar() should not be abstract in
                  php shell code on line 1

                12. 使用 聲明一個類__construct 方法和 舊式構造函數以類命名的函數

                  php > class MyClass {
                  php {     function MyClass () {}
                  php {     function __construct () {}
                  php { }
                  PHP Strict Standards:  Redefining already defined constructor for class
                  MyClass in php shell code on line 3

                13. 調用mysqli_next_resultmysqli::next_result 在沒有準備下一個結果的 Mysqli 連接對象上

                14. Calling mysqli_next_result or mysqli::next_result on a Mysqli connection object that does not have a next result to prepare

                  php > $conn = mysqli_connect('127.0.0.1', 'root');
                  php > mysqli_multi_query($conn, "SELECT 'first'; SELECT 'second';");
                  php > echo mysqli_use_result($conn)->fetch_row()[0];
                  first
                  php > mysqli_next_result($conn);
                  php > echo mysqli_use_result($conn)->fetch_row()[0];
                  second
                  php > mysqli_next_result($conn);
                  PHP Strict Standards:  mysqli_next_result(): There is no next result set.
                  Please, call mysqli_more_results()/mysqli::more_results() to check whether
                  to call this function/method in php shell code on line 1

                15. 覆蓋子類中的方法以將不同數量的參數傳遞給其父類中的同一方法

                16. Overriding a method in a subclass to take a different number of arguments to the same method in its parent

                  php > class A           { public function foo ($x) {} }
                  php > class B extends A { public function foo () {} }
                  PHP Strict Standards:  Declaration of B::foo() should be compatible with
                  A::foo($x) in php shell code on line 1
                  php > class C extends A { public function foo ($x, $y) {} }
                  PHP Strict Standards:  Declaration of C::foo() should be compatible with
                  A::foo($x) in php shell code on line 1

                17. 在特征和使用它的類中以兼容方式聲明相同的屬性.這個實際上很好文檔化:

                  如果一個trait定義了一個屬性,那么一個類就不能定義一個同名的屬性,否則會報錯.如果類定義兼容(相同的可見性和初始值),則為 E_STRICT,否則為致命錯誤.

                  If a trait defines a property then a class can not define a property with the same name, otherwise an error is issued. It is an E_STRICT if the class definition is compatible (same visibility and initial value) or fatal error otherwise.

                  <?php
                  trait PropertiesTrait {
                      public $same = true;
                      public $different = false;
                  }
                  
                  class PropertiesExample {
                      use PropertiesTrait;
                      public $same = true; // Strict Standards
                      public $different = true; // Fatal error
                  }
                  ?>
                  

                  嚴格模式警告示例:

                  php > trait PropertiesTrait {
                  php {     public $same = true;
                  php { }
                  php > class PropertiesExample {
                  php {     use PropertiesTrait;
                  php {     public $same = true;
                  php { }
                  PHP Strict Standards:  PropertiesExample and PropertiesTrait define the
                  same property ($same) in the composition of PropertiesExample. This might
                  be incompatible, to improve maintainability consider using accessor
                  methods in traits instead. Class was composed in php shell code on line 4

                18. 靜態調用非靜態方法

                19. Calling a non-static method statically

                  php > class Foo { function bar() {} }
                  php > Foo::bar();
                  PHP Strict Standards:  Non-static method Foo::bar() should not be called
                  statically in php shell code on line 1

                20. 非靜態地引用靜態屬性

                21. Referring to a static property non-statically

                  php > class Cow { static public $noise = 'moo'; }
                  php > $cow = new Cow;
                  php > $cow->noise = "MOOOOO";
                  PHP Strict Standards:  Accessing static property Cow::$noise as non static
                  in php shell code on line 1

                22. 直接傳遞函數調用的結果通過引用.

                  php > function foo () { return 1; }
                  php > function bar (&$some_arg) {} 
                  php > bar(foo());
                  PHP Strict Standards:  Only variables should be passed by reference in php
                  shell code on line 1
                  php > $var = &foo();
                  PHP Strict Standards:  Only variables should be assigned by reference in
                  php shell code on line 1

                  請注意,通過引用傳遞其他非變量(如文字或常量)是致命錯誤,而不是 E_STRICT

                  Note that passing other non-variables by reference, like literals or constants, is a fatal error instead of an E_STRICT

                  這篇關于E_STRICT 有什么作用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!
                23. 相關文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)
                    <tbody id='cpNTw'></tbody>

                  • <tfoot id='cpNTw'></tfoot>

                            <bdo id='cpNTw'></bdo><ul id='cpNTw'></ul>

                          • <legend id='cpNTw'><style id='cpNTw'><dir id='cpNTw'><q id='cpNTw'></q></dir></style></legend>
                          • <small id='cpNTw'></small><noframes id='cpNTw'>

                            <i id='cpNTw'><tr id='cpNTw'><dt id='cpNTw'><q id='cpNTw'><span id='cpNTw'><b id='cpNTw'><form id='cpNTw'><ins id='cpNTw'></ins><ul id='cpNTw'></ul><sub id='cpNTw'></sub></form><legend id='cpNTw'></legend><bdo id='cpNTw'><pre id='cpNTw'><center id='cpNTw'></center></pre></bdo></b><th id='cpNTw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cpNTw'><tfoot id='cpNTw'></tfoot><dl id='cpNTw'><fieldset id='cpNTw'></fieldset></dl></div>

                            主站蜘蛛池模板: 亚洲在线一区二区 | 久久精品国产99国产精品亚洲 | 亚洲欧美日韩在线 | 国产成人精品一区二区三区四区 | 久久国产日韩 | 久久丝袜视频 | 九九天堂网 | www.久久.com | 欧美精品一区在线发布 | 亚洲黄色在线免费观看 | 久久久这里都是精品 | 亚洲高清久久 | 成人性视频免费网站 | 成人免费一区二区三区牛牛 | 超碰97av| 日韩精品久久一区二区三区 | 亚洲一区二区三区免费观看 | 日日草夜夜草 | 亚洲一区二区高清 | 国产免费一区 | 在线观看欧美一区 | 亚洲午夜视频在线观看 | 欧美中文字幕一区 | 久久久成人精品 | 午夜视频在线播放 | 91国内视频在线 | 91精品国产91久久久久青草 | 中文日韩在线视频 | 黄久久久| 99re视频精品 | 国产99小视频 | 日本免费小视频 | 国产第一区二区 | 中文字幕一区二区三区精彩视频 | 永久免费在线观看 | 久久综合九色综合欧美狠狠 | 国产欧美精品 | 国产精品国产精品国产专区不卡 | 国产精品欧美日韩 | 高清一区二区三区 | 91精品久久久久久久久中文字幕 |