3

For example this method of Dataset object returns NULL, How do I make it to return $this

PHP_METHOD(TSet, nextLine)
{
    TSet *MySet;
    tset_object *obj = (tset_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
    MySet = obj->DataSet;
    if (MySet != NULL) {
        MySet->nextLine();
    }
    RETURN_NULL();
}

Tried

zval *object = getThis();
RETURN_ZVAL(object,false,false);

Gave me segfault
And just to be sure also this

RETURN_ZVAL(getThis(),false,false);

With same result

hakre
  • 193,403
  • 52
  • 435
  • 836
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278

1 Answers1

3

RETURN_ZVAL(getThis(), 1, 0);

Is the correct answer, not sure why though.
Got it from http://www.snailinaturtleneck.com/blog/2011/08/11/php-extensions-made-eldrich-classes/#comment-466980122

Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278