Skip to content
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

[NFR]: PHP 8.2 support #15973

Closed
Jeckerson opened this issue May 30, 2022 · 9 comments
Closed

[NFR]: PHP 8.2 support #15973

Jeckerson opened this issue May 30, 2022 · 9 comments
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release new feature request Planned Feature or New Feature Request

Comments

@Jeckerson
Copy link
Member

Jeckerson commented May 30, 2022

Blocked by zephir-lang/zephir#2370

@Jeckerson Jeckerson added the new feature request Planned Feature or New Feature Request label May 30, 2022
@Jeckerson Jeckerson self-assigned this May 30, 2022
@Jeckerson Jeckerson pinned this issue May 30, 2022
@andypost
Copy link

andypost commented Aug 9, 2022

Used to build 5.0_rc4 for Alpinelinux, just a small patch allowed to build without errors

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/37407/diffs#b79d2b5ff56a34ca9289565a23e8b9f62d3db676

https://gitlab.alpinelinux.org/alpine/aports/-/blob/cbcb3a88b4350e735f294d50f78163f13737bead/testing/php82-pecl-phalcon/fix-build.patch

@andypost
Copy link

It still fails to build on PHP 8.2 with a huge log of warnings and notices

...
/usr/include/php82/Zend/zend_portability.h:364:52: note: in definition of macro 'UNEXPECTED'
  364 | # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
      |                                                    ^~~~~~~~~
/usr/include/php82/Zend/zend_API.h:1944:9: note: in expansion of macro 'Z_PARAM_STR_EX'
 1944 |         Z_PARAM_STR_EX(dest, 0, 0)
      |         ^~~~~~~~~~~~~~
/home/buildozer/aports/testing/php82-pecl-phalcon/src/phalcon-5.0.0/phalcon.zep.c:218942:17: note: in expansion of macro 'Z_PARAM_STR'
218942 |                 Z_PARAM_STR(key)
       |                 ^~~~~~~~~~~
/usr/include/php82/Zend/zend_API.h:2106:76: note: expected 'zend_string **' {aka 'struct _zend_string **'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
 2106 | static zend_always_inline bool zend_parse_arg_str(zval *arg, zend_string **dest, bool check_null, uint32_t arg_num)
      |                                                              ~~~~~~~~~~~~~~^~~~
/home/buildozer/aports/testing/php82-pecl-phalcon/src/phalcon-5.0.0/phalcon.zep.c: In function 'zim_Phalcon_Annotations_Adapter_Stream_write':
/usr/include/php82/Zend/zend_API.h:1937:58: warning: passing argument 2 of 'zend_parse_arg_str' from incompatible pointer type [-Wincompatible-pointer-types]
 1937 |                 if (UNEXPECTED(!zend_parse_arg_str(_arg, &dest, check_null, _i))) { \
/usr/include/php82/Zend/zend_portability.h:364:52: note: in definition of macro 'UNEXPECTED'
  364 | # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
      |                                                    ^~~~~~~~~
/usr/include/php82/Zend/zend_API.h:1944:9: note: in expansion of macro 'Z_PARAM_STR_EX'
 1944 |         Z_PARAM_STR_EX(dest, 0, 0)
      |         ^~~~~~~~~~~~~~
/home/buildozer/aports/testing/php82-pecl-phalcon/src/phalcon-5.0.0/phalcon.zep.c:219024:17: note: in expansion of macro 'Z_PARAM_STR'
219024 |                 Z_PARAM_STR(key)
       |                 ^~~~~~~~~~~
/usr/include/php82/Zend/zend_API.h:2106:76: note: expected 'zend_string **' {aka 'struct _zend_string **'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
 2106 | static zend_always_inline bool zend_parse_arg_str(zval *arg, zend_string **dest, bool check_null, uint32_t arg_num)
      |                                                              ~~~~~~~~~~~~~~^~~~
/home/buildozer/aports/testing/php82-pecl-phalcon/src/phalcon-5.0.0/phalcon.zep.c: In function 'php_zephir_init_globals':
/home/buildozer/aports/testing/php82-pecl-phalcon/src/phalcon-5.0.0/phalcon.zep.c:220757:57: warning: assignment to 'zend_string *' {aka 'struct _zend_string *'} from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
220757 |         phalcon_globals->orm.resultset_prefetch_records = ZSTR_VAL(zend_string_init(ZEND_STRL("0"), 0));
       |                                                         ^
make: *** [Makefile:210: phalcon.lo] Error 1

See https://build.alpinelinux.org/buildlogs/build-edge-x86_64/testing/php82-pecl-phalcon/php82-pecl-phalcon-5.0.0-r0.log

@Jeckerson
Copy link
Member Author

Jeckerson commented Sep 23, 2022

@andypost Yes, Zephir changes are required. Use this branch of Zephir to build and compile Phalcon - https://github.com/zephir-lang/zephir/tree/%232370-php8.2

Zephir:

cd zephir/
wget https://github.com/box-project/box/releases/download/4.0.2/box.phar
php box.phar compile
cp zephir.phar /path/to/cphalcon/

Phalcon:

cd /cphalcon
php zephir.phar generate
php zephir.phar compile -j8

@ghost
Copy link

ghost commented Jan 24, 2023

Updated Arch Linux today, and Phalcon no longer works or updates. Any news on supporting PHP v8.2.x yet? Or maybe at least a workaround that works? Previously used PHP 8.1.13 with Phalcon 5.1.2 and it worked good. Please don't recommend downgrade as a workaround ^_^

uname -r
6.1.7-arch1-1

php -v
PHP 8.2.1 (cli) (built: Jan  4 2023 16:37:54) (NTS)
Zend Engine v4.2.1

PECL Install Failed:

pecl install phalcon
pecl/phalcon requires PHP (version >= 7.4.1, version <= 8.1.99), installed version is 8.2.1
No valid packages found
install failed

Manual Compile Method 1 Failed:

sudo wget https://github.com/zephir-lang/zephir/releases/download/0.16.3/zephir.phar -O /usr/local/bin/zephir
sudo chmod a+x /usr/local/bin/zephir
git clone https://github.com/phalcon/cphalcon
cd cphalcon/
git checkout tags/v5.1.4 ./
zephir build
cat compile-errors.log

/home/build/cphalcon/ext/kernel/main.c: In function ‘zephir_function_exists’:                 
/home/build/cphalcon/ext/kernel/main.c:285:108: warning: comparison between pointer and integer
  285 |         if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)) != NULL) {
      |                                                                                                            ^~
/home/build/cphalcon/ext/kernel/main.c: In function ‘zephir_function_exists_ex’:
/home/build/cphalcon/ext/kernel/main.c:301:83: warning: comparison between pointer and integer
  301 |         if (zend_hash_str_exists(CG(function_table), function_name, function_len) != NULL) {
      |                                                                                   ^~
/home/build/cphalcon/ext/kernel/main.c: In function ‘zephir_get_arg’:
/home/build/cphalcon/ext/kernel/main.c:571:9: error: too many arguments to function ‘zend_forbid_dynamic_call’
  571 |     if (zend_forbid_dynamic_call("func_get_arg()") == FAILURE) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/php/main/php.h:35,
                 from /home/build/cphalcon/ext/kernel/main.c:16:
/usr/include/php/Zend/zend_API.h:782:39: note: declared here
  782 | static zend_always_inline zend_result zend_forbid_dynamic_call(void)
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:213: kernel/main.lo] Error 1
make: *** Waiting for unfinished jobs....
/home/build/cphalcon/ext/phalcon.c: In function ‘php_zephir_init_globals’:
/home/build/cphalcon/ext/phalcon.c:1340:57: warning: assignment to ‘zend_string *’ {aka ‘struct _zend_string *’} from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]
 1340 |         phalcon_globals->orm.resultset_prefetch_records = ZSTR_VAL(zend_string_init(ZEND_STRL("0"), 0));
      |                                                         ^
/home/build/cphalcon/ext/kernel/main.c: In function ‘zephir_function_exists’:
/home/build/cphalcon/ext/kernel/main.c:285:108: warning: comparison between pointer and integer
  285 |         if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)) != NULL) {
      |                                                                                                            ^~
/home/build/cphalcon/ext/kernel/main.c: In function ‘zephir_function_exists_ex’:
/home/build/cphalcon/ext/kernel/main.c:301:83: warning: comparison between pointer and integer
  301 |         if (zend_hash_str_exists(CG(function_table), function_name, function_len) != NULL) {
      |                                                                                   ^~
/home/build/cphalcon/ext/kernel/main.c: In function ‘zephir_get_arg’:
/home/build/cphalcon/ext/kernel/main.c:571:9: error: too many arguments to function ‘zend_forbid_dynamic_call’
  571 |     if (zend_forbid_dynamic_call("func_get_arg()") == FAILURE) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/php/main/php.h:35,
                 from /home/build/cphalcon/ext/kernel/main.c:16:
/usr/include/php/Zend/zend_API.h:782:39: note: declared here
  782 | static zend_always_inline zend_result zend_forbid_dynamic_call(void)
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:213: kernel/main.lo] Error 1

Manual Compile Method 2 Failed:

sudo wget https://github.com/zephir-lang/zephir/releases/download/0.16.3/zephir.phar -O /usr/local/bin/zephir
sudo chmod a+x /usr/local/bin/zephir
git clone https://github.com/phalcon/cphalcon
cd cphalcon/
git checkout tags/v5.1.4 ./
zephir fullclean
zephir compile
cd ext
phpize
./configure
make && make install

Errors Output:

/bin/sh /home/build/cphalcon/ext/libtool --mode=compile cc -I. -I/home/build/cphalcon/ext -I/home/build/cphalcon/ext/include -I/home/build/cphalcon/ext/main -I/home/build/cphalcon/ext -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -D_GNU_SOURCE    -DZEND_COMPILE_DL_EXT=1 -c /home/build/cphalcon/ext/kernel/main.c -o kernel/main.lo  -MMD -MF kernel/main.dep -MT kernel/main.lo
 cc -I. -I/home/build/cphalcon/ext -I/home/build/cphalcon/ext/include -I/home/build/cphalcon/ext/main -I/home/build/cphalcon/ext -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -DZEND_COMPILE_DL_EXT=1 -c /home/build/cphalcon/ext/kernel/main.c -MMD -MF kernel/main.dep -MT kernel/main.lo  -fPIC -DPIC -o kernel/.libs/main.o
/home/build/cphalcon/ext/kernel/main.c: In function ‘zephir_function_exists’:
/home/build/cphalcon/ext/kernel/main.c:285:108: warning: comparison between pointer and integer
  285 | s(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)) != NULL) {
      |                                                                             ^~

/home/build/cphalcon/ext/kernel/main.c: In function ‘zephir_function_exists_ex’:
/home/build/cphalcon/ext/kernel/main.c:301:83: warning: comparison between pointer and integer
  301 |   if (zend_hash_str_exists(CG(function_table), function_name, function_len) != NULL) {
      |                                                                             ^~

/home/build/cphalcon/ext/kernel/main.c: In function ‘zephir_get_arg’:
/home/build/cphalcon/ext/kernel/main.c:571:9: error: too many arguments to function ‘zend_forbid_dynamic_call’
  571 |     if (zend_forbid_dynamic_call("func_get_arg()") == FAILURE) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/php/main/php.h:35,
                 from /home/build/cphalcon/ext/kernel/main.c:16:
/usr/include/php/Zend/zend_API.h:782:39: note: declared here
  782 | static zend_always_inline zend_result zend_forbid_dynamic_call(void)
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:213: kernel/main.lo] Error 1

Thanks.

@ghost
Copy link

ghost commented Jan 28, 2023

@Jeckerson link you provided is broken, it shows error page 404

Jeckerson added a commit that referenced this issue Feb 11, 2023
Jeckerson added a commit that referenced this issue Feb 11, 2023
Jeckerson added a commit that referenced this issue Feb 11, 2023
Jeckerson added a commit that referenced this issue Feb 11, 2023
Jeckerson added a commit that referenced this issue Feb 11, 2023
Jeckerson added a commit that referenced this issue Feb 11, 2023
Jeckerson added a commit that referenced this issue Feb 11, 2023
Jeckerson added a commit that referenced this issue Feb 11, 2023
niden added a commit that referenced this issue Feb 12, 2023
@hakimio
Copy link

hakimio commented Feb 12, 2023

@V00V I guess he was referring to this PR which was merged into zephir development branch.

@andypost
Copy link

Yes, and there's new release https://github.com/zephir-lang/zephir/releases/tag/0.17.0

@andypost
Copy link

andypost commented Feb 12, 2023

Used to build from https://github.com/phalcon/cphalcon/archive/44119cf8b3b286b15ad7d6405ad9e1f443d3bc09.tar.gz on Alpinelinux, it's required export CFLAGS="$CFLAGS -DALPINE_LINUX=1" to skip execinfo miss according to zephir-lang/zephir#2397

EDIT CI pipeline for all aches https://gitlab.alpinelinux.org/alpine/aports/-/pipelines/152930

@Jeckerson
Copy link
Member Author

Implemented in #16282

@niden niden added the 5.0 The issues we want to solve in the 5.0 release label Feb 26, 2023
@niden niden added this to Phalcon v5 Feb 26, 2023
@github-project-automation github-project-automation bot moved this to Backlog in Phalcon v5 Feb 26, 2023
@niden niden moved this from Backlog to Implemented in Phalcon v5 Feb 26, 2023
@niden niden unpinned this issue Jul 19, 2023
@niden niden moved this from Implemented to Released in Phalcon v5 Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release new feature request Planned Feature or New Feature Request
Projects
Status: Released
Development

No branches or pull requests

4 participants