Porting Snuffleupagus to PHP8 was tedious, but not hard, thanks to PHP's nice page on how to migrate extensions from PHP7 to PHP8.,
ZEND_ARG_IS_VARIADIC(execute_data->func->op_array.arg_info)is used instead ofexecute_data->func->op_array.arg_info->is_variadic:TSRMLS_CandTSRMLS_FETCH, relics of some thread-safety related black-magic that never really worked aren't defined anymore.- Some
char*function parameters were constified, changing signatures. - The biggest piece was the eternal pcre to pcre2 "situation". I had oh so much fun dealing with bundled pcre, bundled pcre2, non-bundled pcre2, weird headers, inclusion order, … across different version of php, because we're still supporting php7.0.
To debug everything in PHP8, I used Alpine Linux in a docker image, resulting in the following mystery that I took way to much time to solve:
# git clone https://github.com/jvoisin/snuffleupagus; cd snuffleupagus
# make tests
cd src; phpize
Configuring for:
PHP Api Version: 20200930
Zend Module Api No: 20200930
Zend Extension Api No: 420200930
cd src; ./configure --enable-snuffleupagus
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... no
checking for cc... cc
checking whether the C compiler works... no
configure: error: in `/var/www/html/snuffleupagus/src':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [Makefile:10: release] Error 77
# tail config.log
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find Scrt1.o: No such file or directory
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find crti.o: No such file or directory
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssp_nonshared
#
The solution is simply to apk add musl-dev.
You can check Snuffleupagus' commits from December 2020 if you want the gory details.