php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53423 mysql_statement.c uses C99 syntax
Submitted: 2010-11-29 16:43 UTC Modified: 2010-12-20 13:01 UTC
From: jd at cpanel dot net Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.3SVN-2010-11-29 (SVN) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jd at cpanel dot net
New email:
PHP Version: OS:

 

 [2010-11-29 16:43 UTC] jd at cpanel dot net
Description:
------------
PDO_MySQL fails to compile on an older RedHat 7.3 system using GCC 2.95 because the macros in mysql_statement.c expand into C99 style inline variable declarations. This error was encountered while testing PHP 5.3.4RC1.

Error messages from the compiler:

/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c: In function `pdo_mysql_stmt_dtor':
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:52: structure has no member named `stmt'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:70: structure has no member named `params'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:71: structure has no member named `params'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:73: structure has no member named `in_null'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:74: structure has no member named `in_null'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:76: structure has no member named `in_length'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:77: structure has no member named `in_length'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c: In function `pdo_mysql_stmt_set_row_count':
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:127: structure has no member named `stmt'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c: In function `pdo_mysql_stmt_execute':
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:295: structure has no member named `stmt'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c: In function `pdo_mysql_stmt_param_hook':
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:469: `MYSQL_BIND' undeclared (first use in this function)
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:469: (Each undeclared identifier is reported only once
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:469: for each function it appears in.)
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:469: `b' undeclared (first use in this function)
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c: In function `pdo_mysql_stmt_describe':
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:678: structure has no member named `stmt'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c: In function `pdo_mysql_stmt_get_col':
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:727: structure has no member named `stmt'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c: In function `pdo_mysql_stmt_col_meta':
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:831: structure has no member named `stmt'
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c: In function `pdo_mysql_stmt_cursor_closer':
/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql/mysql_statement.c:898: structure has no member named `stmt'


Test script:
---------------
root@rh73 [/home/cpeasyapache/src/php-5.3.4RC1/ext/pdo_mysql]# cat /home/cpeasyapache/src/php-5.3.4RC1/config.nice 
#! /bin/sh
#
# Created by configure

CFLAGS=' -I/usr/kerberos/include' \
'./configure' \
--disable-fileinfo \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-gd-native-ttf \
--enable-libxml \
--enable-magic-quotes \
--enable-mbstring \
--enable-pdo=shared \
--enable-safe-mode \
--enable-soap \
--enable-sockets \
--enable-wddx \
--enable-zend-multibyte \
--enable-zip \
--prefix=/usr/local \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-bz2 \
--with-config-file-path=/usr/local/lib \
--with-config-file-scan-dir=/usr/local/lib/php.ini.d \
--with-curl=/opt/curlssl/ \
--with-curlwrappers \
--with-freetype-dir=/usr \
--with-gd \
--with-gettext \
--with-imap=/opt/php_with_imap_client/ \
--with-imap-ssl=/usr \
--with-jpeg-dir=/usr \
--with-kerberos \
--with-libexpat-dir=/usr \
--with-libxml-dir=/opt/xml2 \
--with-libxml-dir=/opt/xml2/ \
--with-mcrypt=/opt/libmcrypt/ \
--with-mm=/opt/mm/ \
--with-mysql=/usr \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-pcre-regex=/opt/pcre \
--with-pdo-mysql=shared \
--with-pdo-sqlite=shared \
--with-png-dir=/usr \
--with-pspell \
--with-sqlite=shared \
--with-tidy=/opt/tidy/ \
--with-xmlrpc \
--with-xpm-dir=/usr/X11R6 \
--with-xsl=/opt/xslt/ \
--with-zlib \
--with-zlib-dir=/usr \
"$@"



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-29 16:54 UTC] uw@php.net
-Status: Open +Status: Bogus
 [2010-11-29 16:54 UTC] uw@php.net
From a MySQL perspective supporting RH 7.3/gcc 2.95 is bogus. RH 7.4 has been released in May 2002, hasn't it? That is a little too old for using PHP 5.3 with mysqlnd. RH 7.3 is way before mysqlnd development has started.

As there is an alternative (good old libmysqlclient) for those using 8 years old systems, I'm closing the report.

Of course, we'll check if we can add a test for the GCC version to bail out in case of old GCC.
 [2010-11-29 16:58 UTC] uw@php.net
PS: Don't get me wrong when I say "from a MySQL perspective". Of course, php.net can overrule me but "we MySQL guys" are the ones doing most of the work on mysqlnd. So, "from a maintainer perspective", even with my php.net hat on, ...
 [2010-11-29 17:07 UTC] jd at cpanel dot net
Just to be clear, the idea that RedHat 7.3 isn't supported is fine with me.  It's an ancient system and supporting it shouldn't factor into anyone else's decision making. I always test with RedHat 7.3 because GCC 2.95 points out these types of bugs that many modern compilers allow without complaint.

I'm a little concerned that PHP is going to suddenly start requiring a C99 compatible compiler without testing the compiler for C99 support or putting the compiler into C99 mode though.

PHP 5.3.3 did not require a C99 compatible compiler as far as I'm aware.
 [2010-11-29 17:13 UTC] jd at cpanel dot net
Also, to be clear, the compile that failed was linking with libmysqlclient (MySQL 4.0.27), not mysqlnd.  As far as I can tell though, this has no bearing on the compile failure.
 [2010-11-29 17:14 UTC] johannes@php.net
The actual issue is not C99 or such but that you are using an outdated version of libmsql. You probabl might be successfull when using mysqlnd (--with-mysql=mysqlnd --with-msqli=mysqlnd --with-pdo-mysql=msqlnd) or updating your libmysql version.

The C99 macros are only used when using --enable-debug and GCC is detected.
 [2010-11-29 17:18 UTC] johannes@php.net
Oh and one more comment: Old versions of gcc are quite liberal with their C iterpretation. Modern versions provide options to check this more strictly (see -W options in the docs) if you want. Other compilers might do even better.
 [2010-11-29 18:48 UTC] jd at cpanel dot net
Thanks for the pointer in the right direction.  The problem only happens when compiling against MySQL 4.0. When using MySQL 4.1 and above it compiles correctly.
 [2010-11-29 19:47 UTC] johannes@php.net
Oracle, or its processor, whatever the name was back then, ended _extended_ support for MySQL 4.0 in 2008. I doubt the latest version of PHP have to support it ;-)

http://www.mysql.com/about/legal/lifecycle/#calendar
 [2010-12-20 13:01 UTC] jani@php.net
-Package: Tidy +Package: MySQL related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 12:01:28 2024 UTC