Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 325405 - dev-lang/php-5.2.13: Warning: preg_replace() [function.preg-replace]: Internal pcre_fullinfo() error -3
Summary: dev-lang/php-5.2.13: Warning: preg_replace() [function.preg-replace]: Intern...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High blocker
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 324963
  Show dependency tree
 
Reported: 2010-06-24 19:59 UTC by Robin Johnson
Modified: 2010-10-18 20:59 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-06-24 19:59:50 UTC
PHP has broken on several infra machines, recently, with this output whenever a preg_replace call is made:
Warning: preg_replace() [function.preg-replace]: Internal pcre_fullinfo() error -3 in /var/www/dev.gentoo.org/devaway/xml/index.php on line 40

Most importantly, it's broken devaway output.

dev-libs/libpcre-7.9-r1
dev-lang/php-5.2.13

Portage 2.1.8.3 (hardened/linux/x86/10.0, gcc-3.4.6, glibc-2.9_p20081201-r2, 2.6.XX-hardened-r8 i686)
=================================================================
System uname: Linux-2.6.XX-hardened-r8-i686-Intel-R-_Xeon-TM-_CPU_3.00GHz-with-gentoo-1.12.13
Timestamp of tree: Thu, 24 Jun 2010 19:30:01 +0000
app-shells/bash:     4.0_p28
dev-lang/python:     2.4.6, 2.5.4-r2, 2.6.2-r1
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       3.3.6-r1, 3.4.6-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=pentium4 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests buildpkg distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="apache2 bash-completion berkdb bzip2 cli cracklib crypt cups cxx dri gdbm hardened iconv ipv6 mmx modules mudflap ncurses nptl nptlonly openmp pam pcre perl pic pie pppd python readline reflection session snmp spl ssl sysfs tcpd unicode urandom vhost x86 xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 	emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m 	maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 intel 	mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage 	siliconmotion sis sisusb tdfx tga trident tseng v4l vesa via vmware 	voodoo" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-06-24 20:03:37 UTC
I've also tried rebuilding both pcre and PHP, no luck.
Comment 2 Matti Bickel (RETIRED) gentoo-dev 2010-06-25 07:50:18 UTC
This is weird. 7.9 is the version of the bundled lib, too. PHP upstream will tell you to use the bundled lib, but if it's the same version we might have a change there.

Can you post emerge --info pcre && emerge --info php? I'm just interested in the USE combinations. Can you get me a copy of the offending script or preg_replace call? I fail to find it on sources.g.o.
Comment 3 Gef 2010-06-25 08:12:04 UTC
Hi all,

I have an amd64 system running (in production) the same php and pcre libs, compiled with the same compiler. Same libc also, but not an hardened system.
I am able to run some testcase for cross testing purposes, if needed.
Comment 4 Matti Bickel (RETIRED) gentoo-dev 2010-06-25 09:11:06 UTC
Some debugging info scratched from ext/pcre/pcrelib/pcre_fullinfo.c:
-3 is PCRE_ERROR_BADOPTION, which results from prce_fullinfo() being passed a not recognized "what" parameter:
     The third argument specifies  which  piece
       of  information  is required, and the fourth argument is a pointer to a
       variable to receive the data. The yield of the  function  is  zero  for
       success, or one of the following negative numbers:

So i'd say this is something bad happening upstream. I'll dig deeper later today.
Comment 5 Matti Bickel (RETIRED) gentoo-dev 2010-06-25 09:28:42 UTC
Some odd bit: every call from php_pcre.c (the php interface to pcre) to pcre_fullinfo() uses a constant also found in pcre_fullinfo.c. Weird, seems like the compiled code differs from what's written in the source file.

If anybody wants to try: please remove lines 285 to 288 (the part that calls configures external pcre) from php-5.2.13.ebuild and rebuild php with that.

If the error persists, I'll file an upstream bug about this.
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-06-26 02:00:11 UTC
I confirm that commenting those lines DOES produce a working PHP.
Comment 7 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-06-26 02:01:14 UTC
Also, the other info:
=================================================================
                        Package Settings
=================================================================

dev-lang/php-5.2.13 was built with the following:
USE="apache2 berkdb bzip2 cli crypt fastbuild gd gdbm iconv ipv6 ncurses pcre pic posix readline reflection session sockets spell spl ssl tokenizer unicode xml xsl zlib -adabas -bcmath -birdstep -calendar -cdb -cgi -cjk -concurrentmodphp -ctype -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd-external -gmp -hash -imap -inifile -interbase -iodbc (-java-external) -json -kerberos -kolab -ldap -ldap-sasl -libedit -mcve -mhash -msql -mssql -mysql -mysqli -nls -oci8 -oci8-instant-client -odbc -pcntl -pdo -postgres -qdbm -recode -sapdb -sharedext -sharedmem -simplexml -snmp -soap -solid -sqlite -suhosin -sybase -sybase-ct -sysvipc -threads -tidy -truetype -wddx -xmlreader -xmlrpc -xmlwriter -xpm -yaz -zip" 
CFLAGS="-O2 -march=pentium4 -pipe -D_GNU_SOURCE"
CXXFLAGS="-O2 -march=pentium4 -pipe -D_GNU_SOURCE"

Comment 8 Matti Bickel (RETIRED) gentoo-dev 2010-07-03 13:10:23 UTC
I've gotten around to testing the devaway script with the current dev.Status file on amd64, no errors or warnings.

Setup:

dev-libs/libpcre-7.9-r1
dev-lang/php-5.2.13

terra php # emerge --info
Portage 2.1.8.3 (default/linux/amd64/10.0/desktop, gcc-4.4.3, glibc-2.11.1-r0, 2.6.32-gentoo-r7 x86_64)
=================================================================
System uname: Linux-2.6.32-gentoo-r7-x86_64-Intel-R-_Core-TM-_i5_CPU_750_@_2.67GHz-with-gentoo-1.12.13
Timestamp of tree: Sat, 03 Jul 2010 10:45:02 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.5-r2, 3.1.2-r3
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.4_p6-r1, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ABI="amd64"
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
ACCEPT_PROPERTIES="*"

I need to figure out a way to debug this, but have no clue how to, currently.
Does this happen to you on every invocation of preg_replace or just on some specific input and/or pattern data?
Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-07-04 01:02:14 UTC
I'll have to rebuild to back to the stock PHP to see if it's changed, will do so in the next few days.
Comment 10 Matti Bickel (RETIRED) gentoo-dev 2010-10-17 18:24:25 UTC
php-5.3 is stable now. Does it still fail on you?
Comment 11 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-10-18 17:30:40 UTC
Building on woodpecker now.
Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-10-18 18:03:50 UTC
mabi: 5.3 on woodpecker now, and it works, no pcre_fullinfo error.
Comment 13 Matti Bickel (RETIRED) gentoo-dev 2010-10-18 20:59:37 UTC
I propose RESO FIXED then, even if not in 5.2.13; but with 5.3.3-r1 going stable, it won't hit users anymore. Reopen if you disagree and thanks for testing!