php / pecl-file_formats-yaml

YAML-1.1 parser and emitter
https://pecl.php.net/package/yaml
MIT License
71 stars 33 forks source link

PHP 8.3: Warning about passing argument 1 of 'zval_ptr_dtor' from incompatible pointer type #81

Open kdambekalns opened 10 months ago

kdambekalns commented 10 months ago

Here is what the compilation says:

/opt/php/src/ext/yaml/parse.c: In function 'handle_sequence':
/opt/php/src/ext/yaml/parse.c:534:18: warning: passing argument 1 of 'zval_ptr_dtor' from incompatible pointer type [-Wincompatible-pointer-types]
  534 |    zval_ptr_dtor(&retval);
      |                  ^~~~~~~
      |                  |
      |                  zval ** {aka struct _zval_struct **}
In file included from /opt/php/include/php/Zend/zend.h:36,
                 from /opt/php/include/php/main/php.h:31,
                 from /opt/php/src/ext/yaml/php_yaml.h:46,
                 from /opt/php/src/ext/yaml/parse.c:36:
/opt/php/include/php/Zend/zend_variables.h:79:35: note: expected 'zval *' {aka 'struct _zval_struct *'} but argument is of type 'zval **' {aka 'struct _zval_struct **'}
   79 | ZEND_API void zval_ptr_dtor(zval *zval_ptr);
      |                             ~~~~~~^~~~~~~~
bd808 commented 10 months ago

That warning was fixed by https://github.com/php/pecl-file_formats-yaml/pull/74 (https://github.com/php/pecl-file_formats-yaml/commit/e7bffc01c496ef36ce672c612984b13a27426788). This and a few other small fixes have not yet been released but are available from the php7 default branch.

kdambekalns commented 10 months ago

Thanks! I would not have checked the php7 branch for this… 🙈 Great to hear – and "small fixes" sounds like nothing that would block a release around the time PHP 8.3 is released as stable. 🎉

Anankke commented 3 months ago

When would such a release be available? We have php 8.3 out for a long time now.

caringi commented 2 weeks ago

Folks, I have a problem... I'd like to install php yaml extension on Fedora 40 using pecl (php-pecl-yaml rpm package is no longer available on F40), but...

# pecl install yaml
.
.
.
/var/tmp/yaml/parse.c: In function 'handle_sequence':
/var/tmp/yaml/parse.c:534:39: error: passing argument 1 of 'zval_ptr_dtor' from incompatible pointer type [-Wincompatible-pointer-types]
  534 |                         zval_ptr_dtor(&retval);
      |                                       ^~~~~~~
      |                                       |
      |                                       zval ** {aka struct _zval_struct **}
In file included from /usr/include/php/Zend/zend.h:36,
                 from /usr/include/php/main/php.h:31,
                 from /var/tmp/yaml/php_yaml.h:46,
                 from /var/tmp/yaml/parse.c:36:
/usr/include/php/Zend/zend_variables.h:79:35: note: expected 'zval *' {aka 'struct _zval_struct *'} but argument is of type 'zval **' {aka 'struct _zval_struct **'}
   79 | ZEND_API void zval_ptr_dtor(zval *zval_ptr);
      |                             ~~~~~~^~~~~~~~
make: *** [Makefile:214: parse.lo] Error 1
ERROR: `make' failed
Sweetchuck commented 1 week ago

So far, I haven't experienced this problem, but I just run into it.

openSUSE Tumbleweed gcc (SUSE Linux) 14.2.0 (and all the related things on 14.x) libyaml-devel 0.2.5-2.5 PHP 8.3.8 GOOD PHP 8.3.11 FAIL

ext/yaml/parse.c:534:39: error: passing argument 1 of ‘zval_ptr_dtor’


Update: With my setup:

I haven't tried the „patch” mentioned by Anankke

just remove the & in zval_ptr_dtor(&retval);

Anankke commented 1 week ago

For folks have no idea how to fix it, just remove the & in zval_ptr_dtor(&retval);

caringi commented 1 week ago

@Anankke yes, but how to solve this using the "pecl install" kind of installation?