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

Fails to Compile with PHP 8 includes (changed prototype for "zend_prepare_string_for_scanning()") #237

Open
TurtleWilly opened this issue Jun 18, 2023 · 1 comment

Comments

@TurtleWilly
Copy link

It looks like between PHP 7 and PHP 8 the return code of zend_prepare_string_for_scanning() was changed from "int" to "void", see includes/php/Zend/zend_language_scanner.h for the respective installation.

PHP 7: ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename);
PHP 8: ZEND_API void zend_prepare_string_for_scanning(zval *str, zend_string *filename);

Naturally this breaks compilation with the following construct in the php-ast code base. It also triggers some warnings for the filename type.

if (zend_prepare_string_for_scanning(&code_zv, filename) == SUCCESS) {
		…
		}
/php-ast-1.0.4 $ make
/bin/sh /tmp/php-ast-1.0.4/libtool --mode=compile cc -I. -I/tmp/php-ast-1.0.4 -I/tmp/php-ast-1.0.4/include -I/tmp/php-ast-1.0.4/main -I/tmp/php-ast-1.0.4 -I/usr/local/php8/include/php -I/usr/local/php8/include/php/main -I/usr/local/php8/include/php/TSRM -I/usr/local/php8/include/php/Zend -I/usr/local/php8/include/php/ext -I/usr/local/php8/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -D_GNU_SOURCE    -DZEND_COMPILE_DL_EXT=1 -c /tmp/php-ast-1.0.4/ast.c -o ast.lo  -MMD -MF ast.dep -MT ast.lo
mkdir .libs
 cc -I. -I/tmp/php-ast-1.0.4 -I/tmp/php-ast-1.0.4/include -I/tmp/php-ast-1.0.4/main -I/tmp/php-ast-1.0.4 -I/usr/local/php8/include/php -I/usr/local/php8/include/php/main -I/usr/local/php8/include/php/TSRM -I/usr/local/php8/include/php/Zend -I/usr/local/php8/include/php/ext -I/usr/local/php8/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -DZEND_COMPILE_DL_EXT=1 -c /tmp/php-ast-1.0.4/ast.c -MMD -MF ast.dep -MT ast.lo  -fno-common -DPIC -o .libs/ast.o
/tmp/php-ast-1.0.4/ast.c:309:49: warning: incompatible pointer types passing 'char *' to parameter of type 'zend_string *' (aka 'struct _zend_string *') [-Wincompatible-pointer-types]
        if (zend_prepare_string_for_scanning(&code_zv, filename) == SUCCESS) {
                                                       ^~~~~~~~
/usr/local/php8/include/php/Zend/zend_language_scanner.h:78:72: note: passing argument to parameter 'filename' here
ZEND_API void zend_prepare_string_for_scanning(zval *str, zend_string *filename);
                                                                       ^
/tmp/php-ast-1.0.4/ast.c:309:59: error: invalid operands to binary expression ('void' and 'int')
        if (zend_prepare_string_for_scanning(&code_zv, filename) == SUCCESS) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~
1 warning and 1 error generated.
make: *** [ast.lo] Error 1
@TurtleWilly TurtleWilly changed the title Fails to Compile with PHP 8 includes (nchanged prototype for "zend_prepare_string_for_scanning()") Fails to Compile with PHP 8 includes (changed prototype for "zend_prepare_string_for_scanning()") Jun 18, 2023
@TurtleWilly
Copy link
Author

TurtleWilly commented Jun 18, 2023

Or rather… how about a new release? 😱 I guess 1.0.4 is a bit outdated.

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

No branches or pull requests

1 participant