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

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.