Re: Help with updating from PHP 5 to PHP 7
| From: | Benedikt Carda | Date: | Thu, 28 Jan 2021 09:03:43 +0000 |
| Subject: | Re: Help with updating from PHP 5 to PHP 7 | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-17200@lists.php.net to get a copy of this message | ||
Hello,
I understand that everybody is too busy to help me learn this. Is there anybody willing to update this package if I pay for it? I believe a skilled php extension programmer can do it in one or two hours, I just can't find somebody with this knowledge.
Best Regards,
Benedikt.
Am 26.01.2021 um 08:53 schrieb Benedikt Carda:
Hello, I am not sure if it is o.k. to ask for help on this mailing list. Unfortunately at stackoverflow.com nobody who is familiar with php-extensions seems to be around. I found this guide for upgrading PHP: https://wiki.php.net/phpng-upgrading. And I searched other packages to see how they did it. I managed that the package I try to update compiles without errors, but I get some warnings and one of those at least is still breaking the functionality of the package. Here is the diff of one function I changed that now breaks. Can somebody tell me where I am wrong? PHP_FUNCTION(scard_connect) { DWORD dwPreferredProtocol = SCARD_PROTOCOL_T1|SCARD_PROTOCOL_T0; DWORD dwCurrentProtocol; SCARDHANDLE hCard = 0; LONG rc = 0; zval* ctx_res; - zval* current_protocol; + zval current_protocol; SCARDCONTEXT context; char *strReaderName; int strReaderNameLen; - MAKE_STD_ZVAL(current_protocol); - ZVAL_LONG(current_protocol,0); + ZVAL_LONG(¤t_protocol,0); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &ctx_res, &strReaderName, &strReaderNameLen, &dwPreferredProtocol,¤t_protocol) == FAILURE) { RETURN_NULL(); } - ZEND_FETCH_RESOURCE(context,SCARDCONTEXT,&ctx_res,-1,PHP_PCSC_CTX_RES_NAME,le_pcsc_ctx_res); + if ((context = (SCARDCONTEXT)zend_fetch_resource(Z_RES_P(ctx_res), PHP_PCSC_CTX_RES_NAME, le_pcsc_ctx_res)) == NULL) {+ RETURN_FALSE;+ } rc = SCardConnect(context, strReaderName, SCARD_SHARE_SHARED, dwPreferredProtocol, &hCard, &dwCurrentProtocol); if (rc != SCARD_S_SUCCESS) {PCSC_G(last_errno)=rc; RETURN_FALSE;} - ZVAL_LONG(current_protocol,dwCurrentProtocol); + ZVAL_LONG(¤t_protocol,dwCurrentProtocol); - ZEND_REGISTER_RESOURCE(return_value,(void*)hCard,le_pcsc_conn_res); + RETURN_RES(zend_register_resource((void*)hCard,le_pcsc_conn_res)); } Thanks in advance, Benedikt.