php-src
php-src copied to clipboard
master doesn't build with GCC 15: ZEND_ATTRIBUTE_DEPRECATED after PHPAPI in php_session.h
Description
Since #25081, master doesn't build with GCC 15:
ext/session/php_session.h:252:34: error: expected identifier or '(' before 'zend_result'
252 | PHPAPI ZEND_ATTRIBUTE_DEPRECATED zend_result php_session_valid_key(const char *key);
| ^~~~~~~~~~~
GCC 15 defaults to C23, where ZEND_ATTRIBUTE_DEPRECATED is [[deprecated]] since #25325. A standard attribute has to come before the other declaration specifiers, so it can't follow PHPAPI. With -std=gnu17 it compiles, and clang 21 builds it.
I'm opening a PR that moves the attribute first, in the declaration and the definition, as the other uses in php-src do.
PHP Version
PHP 8.7.0-dev (master)
Operating System
Ubuntu 26.04, GCC 15.2