Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82173 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50755 invoked from network); 8 Feb 2015 21:06:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2015 21:06:47 -0000 X-Host-Fingerprint: 84.243.199.158 unknown Received: from [84.243.199.158] ([84.243.199.158:26525] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/84-26926-0EFC7D45 for ; Sun, 08 Feb 2015 16:06:45 -0500 To: internals@lists.php.net Date: Sun, 08 Feb 2015 22:06:39 +0100 Message-ID: References: <54D3EE95.2080109@lerdorf.com> X-Newsreader: Forte Agent 3.3/32.846 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Posted-By: 84.243.199.158 Subject: Re: Annotated PHP 5->7 extension diff From: phpdev@ehrhardt.nl (Jan Ehrhardt) Rasmus Lerdorf in php.internals (Thu, 05 Feb 2015 17:28:37 -0500): >We have had quite a number of changes to the extension API and it >worries me a little bit how long it will take everyone to get their >extensions ported. We have UPGRADING.INTERNALS which still needs some >love, but even if that covered everything it is sometimes hard to match >a bullet point in a long list of changes to actual code. UPGRADING.INTERNALS is far from complete. Take for instance the substantial changes in zend_hash_index_find(_ptr). Look at PHP_FUNCTION(dba_list) in dba.c. In PHP 5.6 that is if (zend_hash_index_find(&EG(regular_list), i, (void **) &le)==FAILURE) { continue; } PHP7: if ((le = zend_hash_index_find_ptr(&EG(regular_list), i)) == NULL) { continue; } You'll have to use another macro, with a different number of arguments and a different false test. There is nothing in UPGRADING.INTERNALS on this. The info on this change can be found in the Wiki: https://wiki.php.net/phpng-upgrading But the wiki on its turn is not complete either. For instance it still mentions ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, LE_LINK, le_link, le_plink); Since the API cleanup interbase does not compile anymore. The reason is that the API cleanup brought substantial changes in ZEND_FETCH_RESOURCE2. I guess this command now must be something like ib_link = (ibase_db_link *)zend_fetch_resource2(Z_RES_P(link_arg), link_id, LE_LINK, le_link, le_plink); But this is only an educated guess based on looking at changes in other extensions. At the moment I am struggling with the PHP7 translation of this block: #define GET_MOVIE_RESOURCE(ff_movie_ctx) {\ zval **_tmp_zval;\ if (zend_hash_find(Z_OBJPROP_P(getThis()), "ffmpeg_movie",\ sizeof("ffmpeg_movie"), (void **)&_tmp_zval) == FAILURE) {\ zend_error(E_WARNING, "Invalid ffmpeg_movie object");\ RETURN_FALSE;\ }\ \ ZEND_FETCH_RESOURCE2(ff_movie_ctx, ff_movie_context*, _tmp_zval, -1,\ "ffmpeg_movie", le_ffmpeg_movie, le_ffmpeg_pmovie);\ }\ I have tried a lot of things, but nothing works so far... An annotated diff would be very welcome! But more or less complete documentation as well. Jan