【问题标题】:What is the substitute for is_ref__gc in php7php7中is_ref__gc的替代品是什么
【发布时间】:2016-05-02 18:58:30
【问题描述】:

在 php5 中,zval 结构有一个成员 'is_ref__gc'。我们可以这样使用它:

zval *x
...
...
if (!x->is_ref__gc)
   {
       printf("newx or newy isn't by ref");
       return;
   }  

但是,在php7中,zval没有这样的成员。
php7 中 is_ref__gc 的替代品是什么?即如何修改上面的代码?

【问题讨论】:

  • Z_ISREF_P。就像你应该在 PHP 5 中做的那样。你知道,它被称为is_ref__gc 是有原因的。
  • PHP 7 中的 zval 通常不作为指针传递,并且它们本身不包含引用计数。阅读:wiki.php.net/phpng-upgrading

标签: php-internals php-7


【解决方案1】:

我变了

if (!x->is_ref__gc)

if (x->value.ref->gc.refcount == 0)

现在看来,效果不错。

【讨论】:

    猜你喜欢
    • 2019-02-22
    • 2011-05-07
    • 2012-04-24
    • 2019-12-03
    • 2010-09-17
    • 2012-03-27
    • 2012-09-30
    • 2010-10-20
    • 2014-03-12
    相关资源
    最近更新 更多