[go: up one dir, main page]

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

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

Closed
Jan1205 opened this issue Apr 12, 2023 · 13 comments
Closed

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

Jan1205 opened this issue Apr 12, 2023 · 13 comments

Comments

@Jan1205
Copy link
Jan1205 commented Apr 12, 2023

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

@iluuu1994
Copy link
Member
iluuu1994 commented Apr 12, 2023

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

@Jan1205
Copy link
Author
Jan1205 commented Apr 12, 2023

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

@iluuu1994
Copy link
Member
iluuu1994 commented Apr 12, 2023

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?

@Jan1205
Copy link
Author
Jan1205 commented Apr 12, 2023

@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.

@Jan1205
Copy link
Author
Jan1205 commented Apr 12, 2023

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?

@iluuu1994
Copy link
Member
iluuu1994 commented Apr 13, 2023

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.

@Jan1205
Copy link
Author
Jan1205 commented Apr 13, 2023

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!

@iluuu1994
Copy link
Member

Hmm, then I don't know 😞

@nielsdos
Copy link
Member
nielsdos commented May 3, 2023

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).

@ingamedeo
Copy link

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]},

remicollet referenced this issue May 11, 2023
Accidentally introduced in 175ff60. arData was
not part of an anonymous union.
@remicollet
Copy link
Member
remicollet commented May 11, 2023

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)

@nielsdos
Copy link
Member

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

@iluuu1994
Copy link
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
Projects
None yet
Development

No branches or pull requests

5 participants