php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46040 [PATCH] pcre_internal.h parse error during compilation
Submitted: 2008-09-10 07:49 UTC Modified: 2009-03-01 08:54 UTC
From: Bjorn dot Wiberg at its dot uu dot se Assigned:
Status: Closed Package: Compile Failure
PHP Version: 5.3CVS-2008-09-10 (snap) OS: IBM AIX 5.3 5300-08-01-0819
Private report: No CVE-ID: None
 [2008-09-10 07:49 UTC] Bjorn dot Wiberg at its dot uu dot se
Description:
------------
using gcc on AIX. Compilation failure due to BOOL not being defined?

Probably due to the ifndef check at ext/pcre/pcrelib/pcre_internal.h:565:

#ifndef FALSE
typedef int BOOL;

#define FALSE   0
#define TRUE    1
#endif

I supposed FALSE is already defined (but apparently not BOOL), and hence compilation fails.

Perhaps two checks instead would fix this? Something like:

#ifndef BOOL
typedef int BOOL;
#endif

#ifndef FALSE
#define FALSE   0
#define TRUE    1
#endif

Best regards,
Bj?rn

Reproduce code:
---------------
#! /bin/sh
#
# Created by configure

LDFLAGS='-Wl,-bbigtoc' \
CC='gcc' \
'./configure' \
'--enable-bcmath' \
'--enable-calendar' \
'--enable-cli' \
'--enable-dba' \
'--enable-dbase' \
'--enable-debug' \
'--enable-exif' \
'--enable-flatfile' \
'--enable-ftp' \
'--enable-gd-jis-conv' \
'--enable-gd-native-ttf' \
'--enable-inifile' \
'--enable-mbstring' \
'--enable-pcntl' \
'--enable-shmop' \
'--enable-soap' \
'--enable-sockets' \
'--enable-sqlite-utf8' \
'--enable-sysvmsg' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-wddx' \
'--enable-zip' \
'--enable-zend-multibyte' \
'--prefix=/apache/php' \
'--with-apxs2=/apache/bin/apxs' \
'--with-bz2' \
'--with-cdb' \
'--with-curl' \
'--with-freetype-dir' \
'--with-gd' \
'--with-gdbm' \
'--with-gettext' \
'--with-jpeg-dir' \
'--with-ldap' \
'--with-libxml-dir=/usr/local' \
'--with-mime-magic' \
'--with-mysql=mysqlnd' \
'--with-mysqli=mysqlnd' \
'--with-openssl=/opt/freeware' \
'--with-pdo-mysql=mysqlnd' \
'--with-png-dir' \
'--with-xmlrpc' \
'--with-xpm-dir' \
'--with-xsl' \
'--with-zlib' \
'--with-zlib-dir' \
"$@"

Expected result:
----------------
No compile failure.

Actual result:
--------------
 gcc -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib -Iext/pcre/ -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/ -DPHP_ATOM_INC -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/include -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/main -I/home/bwiberg/rpm/BUILD/php5.3-200809100630 -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/ereg/regex -I/usr/local/include/libxml2 -I/opt/freeware/include -I/usr/local/include -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/date/lib -I/usr/X11R6/include -I/usr/include/freetype2 -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/mbstring/oniguruma -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/mbstring/libmbfl -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/mbstring/libmbfl/mbfl -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/sqlite3/libsqlite -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/TSRM -I/home/bwiberg/rpm/BUILD/php5.3-200809100630/Zend -I/usr/include -g -fvisibility=hidden -O0 -Wall -c /home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_chartables.c  -DPIC -o ext/pcre/pcrelib/.libs/pcre_chartables.o
In file included from /home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_chartables.c:25:
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:976: error: parse error before 'BOOL'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:976: warning: no semicolon at end of struct or union
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:980: error: parse error before '}' token
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:980: warning: type defaults to 'int' in declaration of 'compile_data'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:980: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1027: error: parse error before 'BOOL'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1027: warning: no semicolon at end of struct or union
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1028: warning: type defaults to 'int' in declaration of 'notbol'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1028: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1029: error: parse error before 'noteol'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1029: warning: type defaults to 'int' in declaration of 'noteol'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1029: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1030: error: parse error before 'utf8'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1030: warning: type defaults to 'int' in declaration of 'utf8'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1030: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1031: error: parse error before 'jscript_compat'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1031: warning: type defaults to 'int' in declaration of 'jscript_compat'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1031: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1032: error: parse error before 'endonly'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1032: warning: type defaults to 'int' in declaration of 'endonly'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1032: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1033: error: parse error before 'notempty'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1033: warning: type defaults to 'int' in declaration of 'notempty'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1033: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1034: error: parse error before 'partial'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1034: warning: type defaults to 'int' in declaration of 'partial'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1034: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1035: error: parse error before 'hitend'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1035: warning: type defaults to 'int' in declaration of 'hitend'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1035: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1036: error: parse error before 'bsr_anycrlf'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1036: warning: type defaults to 'int' in declaration of 'bsr_anycrlf'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1036: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1049: error: parse error before '}' token
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1049: warning: type defaults to 'int' in declaration of 'match_data'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1049: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1137: error: parse error before 'php__pcre_is_newline'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1138: error: parse error before 'BOOL'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1138: warning: type defaults to 'int' in declaration of 'php__pcre_is_newline'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1138: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1143: error: parse error before 'php__pcre_was_newline'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1144: error: parse error before 'BOOL'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1144: warning: type defaults to 'int' in declaration of 'php__pcre_was_newline'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1144: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1145: error: parse error before 'php__pcre_xclass'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1145: warning: type defaults to 'int' in declaration of 'php__pcre_xclass'
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h:1145: warning: data definition has no type or storage class
/home/bwiberg/rpm/BUILD/php5.3-200809100630/ext/pcre/pcrelib/pcre_chartables.c:194: warning: visibility attribute not supported in this configuration; ignored
make: *** [ext/pcre/pcrelib/pcre_chartables.lo] Error 1
Bad exit status from /var/opt/freeware/tmp/rpm-tmp.12742 (%build)
bwiberg@melody-lp04:~/rpm/SPECS$ 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-10 20:13 UTC] jani@php.net
"Perhaps" ?? Why don't you TRY it? And if it works -> send us a 
patch.
 [2008-09-11 11:39 UTC] Bjorn dot Wiberg at its dot uu dot se
Attaching patch below which solves the problem.


*** php5.3-200809100630/ext/pcre/pcrelib/pcre_internal.h.ORIGINAL       2008-09-11 13:19:06.000000000 +0200
--- php5.3-200809100630-my/ext/pcre/pcrelib/pcre_internal.h     2008-09-11 13:19:46.000000000 +0200
***************
*** 562,570 ****
  /* Miscellaneous definitions. The #ifndef is to pacify compiler warnings in
  environments where these macros are defined elsewhere. */
  
! #ifndef FALSE
  typedef int BOOL;
  
  #define FALSE   0
  #define TRUE    1
  #endif
--- 562,572 ----
  /* Miscellaneous definitions. The #ifndef is to pacify compiler warnings in
  environments where these macros are defined elsewhere. */
  
! #ifndef BOOL
  typedef int BOOL;
+ #endif
  
+ #ifndef FALSE
  #define FALSE   0
  #define TRUE    1
  #endif
 [2008-09-11 12:27 UTC] scottmac@php.net
This really needs to go upstream to http://bugs.exim.org/enter_bug.cgi?product=PCRE

We can fix it as well though.
 [2008-09-16 11:29 UTC] Bjorn dot Wiberg at its dot uu dot se
Will you report this upstream?
And apply the fix in the meantime?

Many thanks in advance!

Best regards,
Björn
 [2008-09-28 20:48 UTC] nlopess@php.net
forwarded upstream: http://bugs.exim.org/show_bug.cgi?id=761
 [2008-09-29 06:06 UTC] Bjorn dot Wiberg at its dot uu dot se
Hi again!

It seems that my patch has not (yet?) been included with php5.3-200809290430. Will it be, or are you expecting the PCRE developers to release a fix and include that with PHP 5.3 instead? Should this bug really be closed until this has been resolved?

Thanks in advance!

Best regards,
Bj?rn
 [2008-09-29 18:35 UTC] nlopess@php.net
we will fix it when upstream developers fix it. In general we do not patch bundled libraries for non-critical issues (i.e. security bugs).
 [2008-12-05 09:45 UTC] Bjorn dot Wiberg at its dot uu dot se
Just to let you know that this now also happens in PHP 5.2.7 as the PCRE library has been updated (but no patch upstream?).
 [2009-03-01 08:54 UTC] Bjorn dot Wiberg at its dot uu dot se
Bug fixed in PCRE (head?) now:
http://bugs.exim.org/show_bug.cgi?id=761
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 15:01:23 2019 UTC