Welcome! Log In Create A New Profile

Advanced

[PHP-DEV] Migrating php extension from 5 to 7, ZVAL_STRINGL no value returned

Posted by Richard Klingler 
EHLO (o;

I am trying to migrate a simple php extension where a function is called
in php like:

$error = readmydevice($device, $string, $length);

$string is supplied as empty string and is filled inside the function
with bytes returned from a hardware.

Now this worked fine with php-5.x...


The function looks like:

ZEND_FUNCTION(readmydevice)
{
zend_long n;
zval *z;
size_t len;
char *p;
long r;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzl", &n,
&z, &len) == FAILURE) {
return;
}

p = (char *) emalloc(len + 1);
memset(p,0,len+1);

r = myread(n, p, len);
printf("Read %d bytes from device %d up to %d bytes\n", mycount,
n, len);
p[ibcnt] = '\0';
ZVAL_STRINGL(z, p, mycount);
printf("Returned %s\n", p);
efree(p);
RETURN_LONG(r);
}


Any ideas why ZVAL_STRINGL is not doing anything?
Or did I miss something?


thanks in advance
richard


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login