0

In php5, zval struct has a member 'is_ref__gc'. We can use it as follow:

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

However, in php7, zval doesn't have such a member.
What is the substitute for is_ref__gc in php7? i.e. how does I modify the above code?

Andrea
  • 19,134
  • 4
  • 43
  • 65
Jianglong Chen
  • 515
  • 1
  • 3
  • 13
  • 2
    `Z_ISREF_P`. Like you ought have been doing in PHP 5 as well. There's a reason it's called `is_ref__gc`, you know. – NikiC Jan 26 '16 at 13:19
  • zvals in PHP 7 aren't usually passed around as pointers, and contain no reference counting by themselves. Read this: https://wiki.php.net/phpng-upgrading – Andrea Jan 26 '16 at 15:21

1 Answers1

-2

I change

if (!x->is_ref__gc)

to

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

Now, it seems to be effective.

Jianglong Chen
  • 515
  • 1
  • 3
  • 13