Re: Idea: use stub.php and arginfo.h in PHP 7.x
| From: | Benjamin Eberlei | Date: | Thu, 23 Apr 2020 12:56:48 +0000 |
| Subject: | Re: Idea: use stub.php and arginfo.h in PHP 7.x | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-16709@lists.php.net to get a copy of this message | ||
On Thu, Apr 23, 2020 at 2:41 PM Remi Collet <remi@fedoraproject.org> wrote:
> Hi,
>
> One interesting feature of PHP 8 is the automatic
> generation of arginfo from a stub file.
>
>
> Just thinking if this can be used for PECL extension
> and used in PHP 7 compatible version.
>
Hi Remi,
i did use the stub gen script with a very basic stub (no reliance on 8
features) on a PHP 7 extension with success as well. It is very helpful!
greetings
Benjamin
>
>
> A WIP exists in xattr [1] extension
>
>
> How it works:
>
> - arginfo are only generated when the extension is build
> against PHP 8, so most of the work must be done there
>
> - Build against PHP 7 will use the same file
>
> - stub.php may have some conditional for PHP 8 new features
> (e.g. union type usage)
>
> - some compat macro defined before including arginfo.h
> may be needed (e.g. ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE)
>
>
> At a first glance, it seems working and nice to use
>
>
> Comment welcome about this.
>
>
>
> Remi
>
>
> [1] https://github.com/php/pecl-file_system-xattr
>
>