You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Vladislav Kalmykov (Jira)" <ji...@apache.org> on 2021/08/16 07:45:01 UTC

[jira] [Created] (THRIFT-5455) Can not build thrift protocol for PHP 8

Vladislav Kalmykov created THRIFT-5455:
------------------------------------------

             Summary: Can not build thrift protocol for PHP 8
                 Key: THRIFT-5455
                 URL: https://issues.apache.org/jira/browse/THRIFT-5455
             Project: Thrift
          Issue Type: Bug
          Components: PHP - Compiler
            Reporter: Vladislav Kalmykov


There is a problem that thrift protocol extension does not compile for PHP 8.

For example, I am using the following Dockerfile to reproduce the error:
{code:java}
FROM php:8-fpm
RUN apt update \
 && apt install -y wget \
 openssl \
 unzip \
 libtool
RUN wget -O /tmp/thrift.zip https://github.com/apache/thrift/archive/refs/tags/v0.14.2.zip \
 && mkdir /tmp/thrift \
 && unzip -q /tmp/thrift.zip -d /tmp/thrift/ \
 && cd /tmp/thrift/thrift-0.14.2/ \
 && ./bootstrap.sh \
 && cd /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/ \
 && ./configure \
 && make \
 && cp /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/modules/thrift_protocol.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/thrift_protocol.so \
 && echo extension=thrift_protocol.so > /usr/local/etc/php/conf.d/thrift_protocol.ini
CMD ["php-fpm"]
{code}
And then I get the following log with errors "cannot convert zval to zend_object":

 
{code:java}
#6 12.42 /bin/bash /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/libtool --mode=compile g++ -I. -I/tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol -I/tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/include -I/tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/main -I/tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -std=c++11    -c /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp -o php_thrift_protocol.lo
#6 12.47 mkdir .libs
#6 12.47  g++ -I. -I/tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol -I/tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/include -I/tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/main -I/tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -std=c++11 -c /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp  -fPIC -DPIC -o .libs/php_thrift_protocol.o
#6 12.64 /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp: In function 'void createObject(const char*, zval*, int, zval*, zval*)':
#6 12.64 /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp:417:20: error: cannot convert 'zval*' {aka '_zval_struct*'} to 'zend_object*' {aka '_zend_object*'}
#6 12.64    zend_call_method(return_value, ce, &constructor, nullptr, 0, &ctor_rv, nargs, arg1, arg2);
#6 12.64                     ^~~~~~~~~~~~
#6 12.64 In file included from /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp:24:
#6 12.64 /usr/local/include/php/Zend/zend_interfaces.h:41:46: note:   initializing argument 1 of 'zval* zend_call_method(zend_object*, zend_class_entry*, zend_function**, const char*, size_t, zval*, uint32_t, zval*, zval*)'
#6 12.64  ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, uint32_t param_count, zval* arg1, zval* arg2);
#6 12.64                                  ~~~~~~~~~~~~~^~~~~~
#6 12.65 /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp: In function 'void validate_thrift_object(zval*)':
#6 12.65 /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp:931:65: error: cannot convert 'zval*' {aka '_zval_struct*'} to 'zend_object*' {aka '_zend_object*'}
#6 12.65              zval* prop = zend_read_property(object_class_entry, object, varname, strlen(varname), false, &rv);
#6 12.65                                                                  ^~~~~~
#6 12.65 In file included from /usr/local/include/php/main/php.h:35,
#6 12.65                  from /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp:23:
#6 12.65 /usr/local/include/php/Zend/zend_API.h:407:73: note:   initializing argument 2 of 'zval* zend_read_property(zend_class_entry*, zend_object*, const char*, size_t, zend_bool, zval*)'
#6 12.65  ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, zend_bool silent, zval *rv);
#6 12.65                                                             ~~~~~~~~~~~~~^~~~~~
#6 12.65 /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp: In function 'void binary_deserialize_spec(zval*, PHPInputTransport&, HashTable*)':
#6 12.65 /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp:972:34: error: cannot convert 'zval*' {aka '_zval_struct*'} to 'zend_object*' {aka '_zend_object*'}
#6 12.65          zend_update_property(ce, zthis, varname, strlen(varname), &rv);
#6 12.65                                   ^~~~~
#6 12.65 In file included from /usr/local/include/php/main/php.h:35,
#6 12.65                  from /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp:23:
#6 12.65 /usr/local/include/php/Zend/zend_API.h:387:74: note:   initializing argument 2 of 'void zend_update_property(zend_class_entry*, zend_object*, const char*, size_t, zval*)'
#6 12.65  ZEND_API void zend_update_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, zval *value);
#6 12.65                                                              ~~~~~~~~~~~~~^~~~~~
#6 12.65 /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp: In function 'void binary_serialize_spec(zval*, PHPOutputTransport&, HashTable*)':
#6 12.65 /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp:1013:55: error: cannot convert 'zval*' {aka '_zval_struct*'} to 'zend_object*' {aka '_zend_object*'}
#6 12.65      zval* prop = zend_read_property(Z_OBJCE_P(zthis), zthis, varname, strlen(varname), false, &rv);
#6 12.65                                                        ^~~~~
#6 12.65 In file included from /usr/local/include/php/main/php.h:35,
#6 12.65                  from /tmp/thrift/thrift-0.14.2/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp:23:
#6 12.65 /usr/local/include/php/Zend/zend_API.h:407:73: note:   initializing argument 2 of 'zval* zend_read_property(zend_class_entry*, zend_object*, const char*, size_t, zend_bool, zval*)'
#6 12.65  ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, zend_bool silent, zval *rv);
#6 12.65                                                             ~~~~~~~~~~~~~^~~~~~
#6 12.67 make: *** [Makefile:209: php_thrift_protocol.lo] Error 1
{code}
 

May be I need to install something?

For PHP 7.4 everything goes well.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)