【问题标题】:Porting php5 extension to php7 and MAKE_STD_ZVAL missing将 php5 扩展移植到 php7 并且缺少 MAKE_STD_ZVAL
【发布时间】:2017-01-08 15:38:22
【问题描述】:

我正在尝试为 php7 编译一个 php5 扩展,但遇到了 MAKE_STD_ZVAL 的一些问题,这在 php7 中似乎不再存在。

我正在尝试编译:php-sweph 这使得一些 c 函数可用于一些天文计算。我不是 c 专家,我只对使这个模块适用于 php7 感兴趣。那是什么 MAKE_STD_ZVAL 的全部内容,想知道我需要如何更改或更改什么,以便下面的函数在没有 MAKE_STD_ZVAL 的情况下工作?

PHP_FUNCTION(swe_houses)
{
   char *arg = NULL;
   int hsys_len, rc;
   char *hsys = NULL;
   double tjd_ut, geolat, geolon;
   double cusps[37], ascmc[10]; 
   int i, houses;
   zval *cusps_arr, *ascmc_arr;

   if(ZEND_NUM_ARGS() != 4) WRONG_PARAM_COUNT;

   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddds",
        &tjd_ut, &geolat, &geolon, &hsys, &hsys_len) == FAILURE) {
        return;
   }

   if (hsys_len < 1)
        return;

   rc = swe_houses(tjd_ut, geolat, geolon, hsys[0], cusps, ascmc);

   /* create 2 index array, and 1 assoc array */
   array_init(return_value);

   MAKE_STD_ZVAL(cusps_arr);
   array_init(cusps_arr);

   if (hsys[0] == 'G')
       houses = 37;
   else
       houses = 13;

   for(i = 0; i < houses; i++)
       add_index_double(cusps_arr, i, cusps[i]);

       MAKE_STD_ZVAL(ascmc_arr);

       array_init(ascmc_arr);

   for(i = 0; i < 10; i++)

   add_index_double(ascmc_arr, i, ascmc[i]);

   add_assoc_zval(return_value, "cusps", cusps_arr);
   add_assoc_zval(return_value, "ascmc", ascmc_arr);
   add_assoc_long(return_value, "rc", rc);
}

【问题讨论】:

标签: compiler-errors php-7 php-extension


【解决方案1】:

this link 提到了从 php 7 中更改或删除的宏的详细信息。

【讨论】:

猜你喜欢
  • 2021-04-15
  • 1970-01-01
  • 1970-01-01
  • 2021-01-28
  • 2014-01-22
  • 2018-02-27
  • 1970-01-01
  • 1970-01-01
  • 2013-06-13
相关资源
最近更新 更多