Skip to content

error: unknown field ‘arData’ specified in initializer #11063

Closed

Description

@Jan1205

Description

Since PHP 8.2 with old compilers we have the following error:

/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_vspprintf’:
/usr/local/src/php-8.2.4/Zend/zend.c:211:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend.c:211:2: warning: (near initialization for ‘buf.len’)
/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_vstrpprintf’:
/usr/local/src/php-8.2.4/Zend/zend.c:263:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend.c:263:2: warning: (near initialization for ‘buf.a’)
/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_print_flat_zval_r’:
/usr/local/src/php-8.2.4/Zend/zend.c:462:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend.c:462:2: warning: (near initialization for ‘buf.a’)
/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_print_zval_r_to_str’:
/usr/local/src/php-8.2.4/Zend/zend.c:542:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend.c:542:2: warning: (near initialization for ‘buf.a’)
/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_error_zstr_at’:
/usr/local/src/php-8.2.4/Zend/zend.c:1321:20: warning: ‘saved_class_entry’ may be used uninitialized in this function
/usr/local/src/php-8.2.4/Zend/zend_hash.c:240:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend_hash.c:240:2: warning: (near initialization for ‘zend_empty_array.gc.u’)
/usr/local/src/php-8.2.4/Zend/zend_hash.c:243:2: error: unknown field ‘arData’ specified in initializer
/usr/local/src/php-8.2.4/Zend/zend_hash.c:243:2: warning: missing braces around initializer
/usr/local/src/php-8.2.4/Zend/zend_hash.c:243:2: warning: (near initialization for ‘zend_empty_array.’)
/usr/local/src/php-8.2.4/Zend/zend_hash.c:243:2: warning: initialization from incompatible pointer type

Is there a chance to fix this?

PHP Version

PHP 8.2.4

Operating System

No response

Activity

  1. iluuu1994 commented on Apr 12, 2023

    @iluuu1994
    Member

    Hi @Jan1205. Can you specify what compiler you're using? Have you tried a full rebuild? (make distclean, ./buildconf, ./configure, make)?

  2. Jan1205 commented on Apr 12, 2023

    @Jan1205
    Author

    That was my frist try. The error still appears. Unfortunately it is a very old system and version: gcc 4.1.2

  3. iluuu1994 commented on Apr 12, 2023

    @iluuu1994
    Member

    That is indeed a very old version. Is there a particular reason why you can't upgrade? Would it be possible to try with a new version to confirm this is actually the issue? What ./configure flags are you using?

  4. Jan1205 commented on Apr 12, 2023

    @Jan1205
    Author

    @iluuu1994 Thanks for your reply. The migration is already being planned. So in the next time we will use a newer version. It works with perfectly with version 8.3. or newer. It would be great if there is a solution for the older version. My configure:

    ./configure --with-config-file-path=/etc --with-pear --with-mysqli=mysqlnd --with-zlib --enable-ftp --with-gettext --with-openssl --enable-mbstring --enable-calendar --with-curl --with-pdo-mysql --without-sqlite3 --without-pdo-sqlite --enable-gd --with-jpeg --with-freetype --with-zip --enable-sockets --enable-soap --enable-exif --enable-pcntl --enable-opcache --enable-fpm

    The issue only effects on PHP 8.2.

    Thank you very much for your support.

  5. Jan1205 commented on Apr 12, 2023

    @Jan1205
    Author

    This line produces the error:

    /bin/sh /usr/local/src/php-8.2.4/libtool --silent --preserve-dup-deps --tag CC --mode=compile cc -std=gnu99 -IZend/ -I/usr/local/src/php-8.2.4/Zend/ -I/usr/local/src/php-8.2.4/include -I/usr/local/src/php-8.2.4/main -I/usr/local/src/php-8.2.4 -I/usr/local/src/php-8.2.4/ext/date/lib -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include/libpng12 -I/usr/local/include/freetype2 -I/usr/local/src/php-8.2.4/ext/mbstring/libmbfl -I/usr/local/src/php-8.2.4/ext/mbstring/libmbfl/mbfl -I/usr/local/lib/libzip/include -I/usr/local/src/php-8.2.4/TSRM -I/usr/local/src/php-8.2.4/Zend -D_GNU_SOURCE -fno-common -Wstrict-prototypes -Wlogical-op -Wno-clobbered -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-sign-compare -lrt -fvisibility=hidden -DZEND_SIGNALS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/local/src/php-8.2.4/Zend/zend_hash.c -o Zend/zend_hash.lo -MMD -MF Zend/zend_hash.dep -MT Zend/zend_hash.lo

    When i remove "-std=gnu99" it works. Is there any configure options?

  6. iluuu1994 commented on Apr 13, 2023

    @iluuu1994
    Member

    I think -std=gnu99 comes from b51a99a. This has been removed in master. bf5fdbd

    Can you remove it locally to confirm it works without it? I'm really not proficient enough with the build system to know if backporting is a good idea. @Girgias maybe?

    Edit: It looks like the macro is still added for autoconf <2.70 so backporting this should be safe.

  7. Jan1205 commented on Apr 13, 2023

    @Jan1205
    Author

    When I remove AC_PROG_CC_C99 the flag is still added. autoconf is > 2.70. bf5fdbd works not for me. When I remove the flag manually the build is not possible. PHP 8.1 can I build with -std=gnu99. @iluuu1994 many thany for your support!

  8. iluuu1994 commented on Apr 13, 2023

    @iluuu1994
    Member

    Hmm, then I don't know 😞

  9. ndossche commented on May 3, 2023

    @ndossche
    Member

    Looks like an old GCC shortcoming with anonymous unions in structs: https://godbolt.org/z/v5frzzo8v (last version of GCC on Godbolt that breaks is 4.5.3, first working version is 4.6.4).

  10. ingamedeo commented on May 9, 2023

    @ingamedeo
    Contributor

    I have encountered the same error when trying to compile with:
    gcc version 4.4.7 20120313 (Red Hat 4.4.7-23.0.1) (GCC)

    I was able to compile PHP successfully. Edit Zend/zend_hash.c:

    .arData = (Bucket*)&uninitialized_bucket[2],

    replace with

    {.arData = (Bucket*)&uninitialized_bucket[2]},

  11. added a commit that references this issue on May 10, 2023
    175ff60
  12. added a commit that references this issue on May 11, 2023
  13. remicollet commented on May 11, 2023

    @remicollet
    Member

    Notice: the fix have been reverted, see 8f66b67

    GCC 4.1.2 may be from EL-5...

    For memory

    • EL-5 have GCC 4.1.2 and is EOL for ~6 years (after 10 years of support, so this version is 16 years old)
    • EL-6 have GCC 4.4.7 and is EOL for ~3 years
    • EL-7 have GCC 4.8.5 and will be EOL in ~1 year (but also have GCC 10, 11 or 12)

    IMHO, it makes sense to stop supporting such old things and encouraging people to use dead cows.
    (building recent PHP versions on EL-7 is already a nightmare, so many libraries being outdated)

  14. ndossche commented on May 11, 2023

    @ndossche
    Member

    Only reverted for 8.1 afaict, because only 8.2+ needed the fix.

  15. iluuu1994 commented on May 11, 2023

    @iluuu1994
    Member

    Yes, @nielsdos is right. I merged this for 8.1, not realizing the array structure was different then.

    I agree we shouldn't make large changes to support old versions. This change was small and seemed harmless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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