Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101970 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67652 invoked from network); 12 Mar 2018 16:45:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2018 16:45:29 -0000 Received: from [127.0.0.1] ([127.0.0.1:10100]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 06/8E-24487-9AEA6AA5 for ; Mon, 12 Mar 2018 11:45:29 -0500 X-Host-Fingerprint: 178.82.90.159 178-82-90-159.dynamic.hispeed.ch Date: Mon, 12 Mar 2018 08:47:10 -0500 Received: from [178.82.90.159] ([178.82.90.159:3434] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/8C-24487-ED486AA5 for ; Mon, 12 Mar 2018 08:47:10 -0500 Message-ID: <55.8C.24487.ED486AA5@pb1.pair.com> To: internals@lists.php.net User-Agent: Pan/0.141 (Tarzan's Death; 168b179 git.gnome.org/pan2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Posted-By: 178.82.90.159 Subject: Migrating php extension from 5 to 7, ZVAL_STRINGL no value returned From: richard@klingler.net (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