編寫PHP擴充遇到的 Z_OBJ_P warning問題

來源:互聯網
上載者:User
想實現個簡單的模板引擎擴充,最近在調試中.但是將擴充編譯成so之後卻發生了下面的狀況:

運行make的時候出現以下warning:

/home/x64-debian-fxy/php5-5.4.4/ext/template_parser/template_parser.c: In function 'zif_template_parser_pause':/home/x64-debian-fxy/php5-5.4.4/ext/template_parser/template_parser.c:114:21: warning: assignment makes pointer from integer without a cast [enabled by default]

相應程式碼片段如下:

//Fetch real object in order to fetch it's scope.    if(Z_TYPE_P(object_container) == IS_OBJECT){        //問題在下行.        real_object = Z_OBJ_P(object_container);    } else {        real_object = NULL;    }

起初我認為是宏的定義有問題,但是當我將Z_OBJ_P替換成應該使用的zend_object_get_address時,同樣的warning會出現.我在引入標頭檔時只是將php.h引入.不知是否有同樣經曆的前輩解決過這樣的問題,望指教!謝謝!

回複內容:

想實現個簡單的模板引擎擴充,最近在調試中.但是將擴充編譯成so之後卻發生了下面的狀況:

運行make的時候出現以下warning:

/home/x64-debian-fxy/php5-5.4.4/ext/template_parser/template_parser.c: In function 'zif_template_parser_pause':/home/x64-debian-fxy/php5-5.4.4/ext/template_parser/template_parser.c:114:21: warning: assignment makes pointer from integer without a cast [enabled by default]

相應程式碼片段如下:

//Fetch real object in order to fetch it's scope.    if(Z_TYPE_P(object_container) == IS_OBJECT){        //問題在下行.        real_object = Z_OBJ_P(object_container);    } else {        real_object = NULL;    }

起初我認為是宏的定義有問題,但是當我將Z_OBJ_P替換成應該使用的zend_object_get_address時,同樣的warning會出現.我在引入標頭檔時只是將php.h引入.不知是否有同樣經曆的前輩解決過這樣的問題,望指教!謝謝!

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.