Closed remicollet closed 3 years ago
Hi @remicollet great question!
Tensor PHP is 100% PHP 8 compatible
Parts of the Tensor extension are built with Zephir which may or may not be PHP 8 compatible, I haven't tried it yet. As far as I know the Zephir people are working on PHP 8 compatibility in general.
https://github.com/phalcon/zephir/issues/2111
Have you tried compiling the extension on PHP 8?
Thanks again for the question and feel free to join us in our Telegram Channel https://t.me/RubixML
At least I see ice 1.8.0 which use zephyr and works with PHP 8
For this project, build fails
Ex:
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:355:38: warning: passing argument 1 of 'clone_call' from incompatible pointer type [-Wincompatible-pointer-types]
355 | ZVAL_OBJ(destination, clone_call(obj));
| ^~~
| |
| zval * {aka struct _zval_struct *}
/opt/remi/php80/root/usr/include/php/Zend/zend_types.h:970:19: note: in definition of macro 'ZVAL_OBJ'
970 | Z_OBJ_P(__z) = (o); \
| ^
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:355:38: note: expected 'zend_object *' {aka 'struct _zend_object *'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
355 | ZVAL_OBJ(destination, clone_call(obj));
| ^~~
/opt/remi/php80/root/usr/include/php/Zend/zend_types.h:970:19: note: in definition of macro 'ZVAL_OBJ'
970 | Z_OBJ_P(__z) = (o); \
| ^
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c: In function 'zephir_read_property':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:548:42: warning: passing argument 1 of 'object->value.obj->handlers->read_property' from incompatible pointer type [-Wincompatible-pointer-types]
548 | res = Z_OBJ_HT_P(object)->read_property(object, &property,
| ^~~~~~
| |
| zval * {aka struct _zval_struct *}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:548:42: note: expected 'zend_object *' {aka 'struct _zend_object *'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:548:50: warning: passing argument 2 of 'object->value.obj->handlers->read_property' from incompatible pointer type [-Wincompatible-pointer-types]
548 | res = Z_OBJ_HT_P(object)->read_property(object, &property,
| ^~~~~~~~~
| |
| zval * {aka struct _zval_struct *}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:548:50: note: expected 'zend_string *' {aka 'struct _zend_string *'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c: In function 'zephir_update_property_zval':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:691:37: warning: passing argument 1 of 'object->value.obj->handlers->write_property' from incompatible pointer type [-Wincompatible-pointer-types]
691 | Z_OBJ_HT_P(object)->write_property(object, &property, &sep_value, 0);
| ^~~~~~
| |
| zval * {aka struct _zval_struct *}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:691:37: note: expected 'zend_object *' {aka 'struct _zend_object *'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:691:45: warning: passing argument 2 of 'object->value.obj->handlers->write_property' from incompatible pointer type [-Wincompatible-pointer-types]
691 | Z_OBJ_HT_P(object)->write_property(object, &property, &sep_value, 0);
| ^~~~~~~~~
| |
| zval * {aka struct _zval_struct *}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:691:45: note: expected 'zend_string *' {aka 'struct _zend_string *'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c: In function 'zephir_unset_property':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:956:37: warning: passing argument 1 of 'object->value.obj->handlers->unset_property' from incompatible pointer type [-Wincompatible-pointer-types]
956 | Z_OBJ_HT_P(object)->unset_property(object, &member, 0);
| ^~~~~~
| |
| zval * {aka struct _zval_struct *}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:956:37: note: expected 'zend_object *' {aka 'struct _zend_object *'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:956:45: warning: passing argument 2 of 'object->value.obj->handlers->unset_property' from incompatible pointer type [-Wincompatible-pointer-types]
956 | Z_OBJ_HT_P(object)->unset_property(object, &member, 0);
| ^~~~~~~
| |
| zval * {aka struct _zval_struct *}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:956:45: note: expected 'zend_string *' {aka 'struct _zend_string *'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c: In function 'zephir_create_instance':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:1320:7: error: 'zend_fcall_info' {aka 'struct _zend_fcall_info'} has no member named 'no_separation'
1320 | fci.no_separation = 1;
| ^
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c: In function 'zephir_create_instance_params':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/object.c:1384:7: error: 'zend_fcall_info' {aka 'struct _zend_fcall_info'} has no member named 'no_separation'
1384 | fci.no_separation = 1;
| ^
make[1]: *** [Makefile:221: kernel/object.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c: In function 'populate_fcic':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c:261:82: warning: passing argument 1 of 'func->value.obj->handlers->get_closure' from incompatible pointer type [-Wincompatible-pointer-types]
261 | if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(func, &fcic->calling_scope, &fcic->function_handler, &fcic->object) == SUCCESS) {
| ^~~~
| |
| zval * {aka struct _zval_struct *}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c:261:82: note: expected 'zend_object *' {aka 'struct _zend_object *'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
In file included from /opt/remi/php80/root/usr/include/php/Zend/zend.h:27,
from /opt/remi/php80/root/usr/include/php/main/php.h:31,
from /dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c:12:
/opt/remi/php80/root/usr/include/php/Zend/zend_types.h:826:49: error: too few arguments to function 'func->value.obj->handlers->get_closure'
826 | #define Z_OBJ_HANDLER_P(zv_p, hf) Z_OBJ_HANDLER(*(zv_p), hf)
| ^
/opt/remi/php80/root/usr/include/php/Zend/zend_types.h:819:26: note: in definition of macro 'Z_OBJ'
819 | #define Z_OBJ(zval) (zval).value.obj
| ^~~~
/opt/remi/php80/root/usr/include/php/Zend/zend_types.h:825:34: note: in expansion of macro 'Z_OBJ_HT'
825 | #define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf
| ^~~~~~~~
/opt/remi/php80/root/usr/include/php/Zend/zend_types.h:826:35: note: in expansion of macro 'Z_OBJ_HANDLER'
826 | #define Z_OBJ_HANDLER_P(zv_p, hf) Z_OBJ_HANDLER(*(zv_p), hf)
| ^~~~~~~~~~~~~
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c:261:47: note: in expansion of macro 'Z_OBJ_HANDLER_P'
261 | if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(func, &fcic->calling_scope, &fcic->function_handler, &fcic->object) == SUCCESS) {
| ^~~~~~~~~~~~~~~
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c: In function 'zephir_call_user_function':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c:339:5: error: 'zend_fcall_info' {aka 'struct _zend_fcall_info'} has no member named 'no_separation'
339 | fci.no_separation = 1;
| ^
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c: In function 'zephir_eval_php':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c:604:37: warning: passing argument 1 of 'zend_compile_string' from incompatible pointer type [-Wincompatible-pointer-types]
604 | new_op_array = zend_compile_string(str, context);
| ^~~
| |
| zval * {aka struct _zval_struct *}
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/kernel/fcall.c:604:37: note: expected 'zend_string *' {aka 'struct _zend_string *'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
make[1]: *** [Makefile:227: kernel/fcall.lo] Error 1
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c: In function 'zm_shutdown_tensor':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c:75:29: error: 'TSRMLS_C' undeclared (first use in this function); did you mean 'TSRM_H'?
75 | zephir_deinitialize_memory(TSRMLS_C);
| ^~~~~~~~
| TSRM_H
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c:75:29: note: each undeclared identifier is reported only once for each function it appears in
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c: At top level:
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c:84:73: error: expected ';', ',' or ')' before 'TSRMLS_DC'
84 | static void php_zephir_init_globals(zend_tensor_globals *tensor_globals TSRMLS_DC)
| ^~~~~~~~~
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c:104:80: error: expected ';', ',' or ')' before 'TSRMLS_DC'
104 | static void php_zephir_init_module_globals(zend_tensor_globals *tensor_globals TSRMLS_DC)
| ^~~~~~~~~
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c: In function 'zm_activate_tensor':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c:115:2: warning: implicit declaration of function 'php_zephir_init_globals'; did you mean 'zephir_get_global'? [-Wimplicit-function-declaration]
115 | php_zephir_init_globals(tensor_globals_ptr);
| ^~~~~~~~~~~~~~~~~~~~~~~
| zephir_get_global
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c: In function 'zm_deactivate_tensor':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c:125:29: error: 'TSRMLS_C' undeclared (first use in this function); did you mean 'TSRM_H'?
125 | zephir_deinitialize_memory(TSRMLS_C);
| ^~~~~~~~
| TSRM_H
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c: In function 'zm_globals_ctor_tensor':
/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext/tensor.c:155:2: warning: implicit declaration of function 'php_zephir_init_module_globals' [-Wimplicit-function-declaration]
155 | php_zephir_init_module_globals(tensor_globals);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:209: tensor.lo] Error 1
make[1]: Leaving directory '/dev/shm/BUILD/php80-php-pecl-tensor-2.1.03/NTS/ext'
erreur : Mauvais statut de sortie pour /var/tmp/rpm-tmp.f3MyWQ (%build)
Nice @remicollet, it looks like Ice is using the php8-development branch to compile their Zephir source down to C. Maybe the same will work for us!
https://github.com/ice/framework/blob/dev/composer.json#L19
Ok, it looks like we can become PHP 8 compatible with the new updates to Zephir, however, we'll lose PHP 7.2, and 7.3 support. What I think we'll do is wait just a bit more while and then release a new minor version which requires PHP 7.4+ but works with PHP 8. How does that sound?
Happy retirement PHP 7.2, and 7.3, and thank you for your service.
How does that sound?
No problem for me
Happy retirement PHP 7.2, and 7.3, and thank you for your service.
PHP 7.2, 7.3 ... you guys, it's been REAL
Zephir is ready to be used for PHP8 since v0.13
. Feel free to upgrade.
Any plan ?