Skip to content

Broken build with PHP 7.4.0RC1 #6624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
remicollet opened this issue Sep 6, 2019 · 3 comments
Closed

Broken build with PHP 7.4.0RC1 #6624

remicollet opened this issue Sep 6, 2019 · 3 comments
Assignees
Labels

Comments

@remicollet
Copy link

/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/storage.c:106:9: error: too few arguments to function 'zend_assign_to_variable'
         zend_assign_to_variable(cached_zval, value, IS_CV);
         ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/remi/php74/root/usr/include/php/Zend/zend_API.h:29,
                 from /opt/remi/php74/root/usr/include/php/main/php.h:37,
                 from ./protobuf.h:34,
                 from /dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/storage.c:32:
/opt/remi/php74/root/usr/include/php/Zend/zend_execute.h:100:33: note: declared here
 static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type, zend_bool strict)
                                 ^~~~~~~~~~~~~~~~~~~~~~~

Notice: there is also tons of warnings related to bad type usage, some seems critical

/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c: In function 'zim_Util_checkMessage':
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c:444:65: warning: format '%s' expects argument of type 'char *', but argument 4 has type 'zend_string *' {aka 'struct _zend_string *'} [-Wformat=]
                             "Given value is not an instance of %s.",
                                                                ~^
                             klass->name);
                             ~~~~~~~~~~~                          
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c: In function 'check_repeated_field':
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c:489:67: warning: format '%s' expects argument of type 'char *', but argument 4 has type 'zend_string *' {aka 'struct _zend_string *'} [-Wformat=]
                               "Given value is not an instance of %s.",
                                                                  ~^
                               repeated_field_type->name);
                               ~~~~~~~~~~~~~~~~~~~~~~~~~            
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c:501:60: warning: format '%s' expects argument of type 'char *', but argument 4 has type 'zend_string * const' {aka 'struct _zend_string * const'} [-Wformat=]
                               "Expect a repeated field of %s, but %s is given.",
                                                           ~^
                               klass->name, intern->msg_ce->name);
                               ~~~~~~~~~~~                   
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c:501:68: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'zend_string * const' {aka 'struct _zend_string * const'} [-Wformat=]
                               "Expect a repeated field of %s, but %s is given.",
                                                                   ~^
                               klass->name, intern->msg_ce->name);
                                            ~~~~~~~~~~~~~~~~~~~~     
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c: In function 'check_map_field':
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c:565:67: warning: format '%s' expects argument of type 'char *', but argument 4 has type 'zend_string *' {aka 'struct _zend_string *'} [-Wformat=]
                               "Given value is not an instance of %s.",
                                                                  ~^
                               map_field_type->name);
                               ~~~~~~~~~~~~~~~~~~~~                 
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c:584:55: warning: format '%s' expects argument of type 'char *', but argument 4 has type 'zend_string * const' {aka 'struct _zend_string * const'} [-Wformat=]
                               "Expect a map field of %s, but %s is given.",
                                                      ~^
                               klass->name, intern->msg_ce->name);
                               ~~~~~~~~~~~              
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/type_check.c:584:63: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'zend_string * const' {aka 'struct _zend_string * const'} [-Wformat=]
                               "Expect a map field of %s, but %s is given.",
                                                              ~^
                               klass->name, intern->msg_ce->name);
                                            ~~~~~~~~~~~~~~~~~~~~

You need to use ZTSR_VAL(ntern->msg_ce->name) (PHP 7+)

Also in various place

/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/message.c: In function 'zim_Field_Kind_name':
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/message.c:1181:31: warning: format '%d' expects argument of type 'int', but argument 4 has type 'zend_long' {aka 'long int'} [-Wformat=]
                               "Enum Google\\Protobuf\\Field_Kind has no name "
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/message.c:1183:31:
                               value);
                               ~~~~~
/dev/shm/BUILD/php74-php-pecl-protobuf-3.10.0~RC1/NTS/message.c:1182:51: note: format string is defined here
                               "defined for value %d.",
                                                  ~^
                                                  %ld

Should use ZEND_LONG_FMT and other FMT macros.

@remicollet remicollet changed the title Broken build with 7.4.0RC1 Broken build with PHP 7.4.0RC1 Sep 6, 2019
@remicollet
Copy link
Author

BTW, using patch from pr #6626 fix the build, but the extension is still unusable

$ php --no-php-ini -d extension=protobuf  --modules
zend_mm_heap corrupted

@camry
Copy link

camry commented Dec 2, 2019

I also encountered the same problem.

@haberman
Copy link
Member

Closing as obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants