Skip to content

Build Failure on PHP 8.2 for 1.7.x #847

@xyu

Description

@xyu

Describe the bug
Trying to build off the main branch for the latest 1.7.0/1.7.1 with PHP 8.2 appears to fail with the following error:

In file included from /home/builder/apm-agent-php/ConfigManager.h:30,
                 from /home/builder/apm-agent-php/Tracer.h:23,
                 from /home/builder/apm-agent-php/php_elastic_apm.h:27,
                 from /home/builder/apm-agent-php/elastic_apm.c:23:
/home/builder/apm-agent-php/elastic_apm.c: In function 'registerElasticApmIniEntries':
/usr/local/php8.2/include/php/Zend/zend_ini.h:199:89: error: 'type' undeclared (first use in this function); did you mean 'Byte'?
 #define REGISTER_INI_ENTRIES() zend_register_ini_entries_ex(ini_entries, module_number, type)
                                                                                         ^~~~
/home/builder/apm-agent-php/ResultCode.h:58:23: note: in definition of macro 'ELASTIC_APM_CALL_IF_FAILED_GOTO'
         resultCode = (expr); \
                       ^~~~
/home/builder/apm-agent-php/elastic_apm.c:161:74: note: in expansion of macro 'REGISTER_INI_ENTRIES'
     ELASTIC_APM_CALL_IF_FAILED_GOTO( zendToResultCode( (ZEND_RESULT_CODE)REGISTER_INI_ENTRIES() ) );
                                                                          ^~~~~~~~~~~~~~~~~~~~
/usr/local/php8.2/include/php/Zend/zend_ini.h:199:89: note: each undeclared identifier is reported only once for each function it appears in
 #define REGISTER_INI_ENTRIES() zend_register_ini_entries_ex(ini_entries, module_number, type)
                                                                                         ^~~~
/home/builder/apm-agent-php/ResultCode.h:58:23: note: in definition of macro 'ELASTIC_APM_CALL_IF_FAILED_GOTO'
         resultCode = (expr); \
                       ^~~~
/home/builder/apm-agent-php/elastic_apm.c:161:74: note: in expansion of macro 'REGISTER_INI_ENTRIES'
     ELASTIC_APM_CALL_IF_FAILED_GOTO( zendToResultCode( (ZEND_RESULT_CODE)REGISTER_INI_ENTRIES() ) );
                                                                          ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/php8.2/include/php/main/php_ini.h:20,
                 from /usr/local/php8.2/include/php/main/fopen_wrappers.h:22,
                 from /usr/local/php8.2/include/php/main/php.h:422,
                 from /home/builder/apm-agent-php/php_elastic_apm.h:22,
                 from /home/builder/apm-agent-php/elastic_apm.c:23:
/home/builder/apm-agent-php/elastic_apm.c: In function 'unregisterElasticApmIniEntries':
/usr/local/php8.2/include/php/Zend/zend_ini.h:200:80: error: 'type' undeclared (first use in this function); did you mean 'Byte'?
 #define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries_ex(module_number, type)
                                                                                ^~~~
/home/builder/apm-agent-php/elastic_apm.c:196:9: note: in expansion of macro 'UNREGISTER_INI_ENTRIES'
         UNREGISTER_INI_ENTRIES();
         ^~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:220: elastic_apm.lo] Error 1

To Reproduce
Build with PHP 8.2 (initial release 8 Dec 2022)

Expected behavior
Build works and generates elastic_apm.so

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions