From: martijn at grendelman dot net
Operating system: Debian Linux (testing)
PHP version: 4.3.4
PHP Bug Type: PCRE related
Bug description: PCRE related segmentation fault
Description:
------------
PHP crashes when using PEAR-DB. Looks like a problem with PCRE.
'./configure' '--prefix=/usr/local'
'--with-apxs2=/usr/local/apache2/bin/apxs' '--with-regex=php'
'--with-config-file-path=/usr/local/apache2/conf' '--disable-rpath'
'--disable-debug' '--enable-memory-limit' '--enable-calendar'
'--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars'
'--enable-trans-sid' '--enable-bcmath' '--with-bz2' '--enable-ctype'
'--with-iconv' '--enable-exif' '--enable-ftp' '--enable-mbstring'
'--with-pcre-regex=/usr' '--enable-shmop' '--enable-sockets'
'--enable-wddx' '--with-xml=/usr' '--with-expat-dir=/usr' '--enable-yp'
'--with-zlib' '--without-pgsql' '--disable-static' '--with-layout=GNU'
'--with-curl=shared,/usr' '--with-dom=shared,/usr' '--with-zlib-dir=/usr'
'--with-gd=shared,/usr' '--with-jpeg-dir=shared,/usr'
'--with-xpm-dir=shared,/usr/X11R6' '--with-png-dir=shared,/usr'
'--with-freetype-dir=shared,/usr' '--with-imap=shared,/usr'
'--with-ldap=shared,/usr' '--with-mcal=shared,/usr'
'--with-mhash=shared,/usr' '--with-mysql=shared,/usr'
'--with-unixODBC=shared,/usr' '--enable-xslt'
'--with-xslt-sablot=shared,/usr' '--with-ttf=shared,/usr'
'--with-t1lib=shared,/usr' '--with-kerberos' '--enable-debug'
So, the PCRE library in /usr (from Debian) is used.
php.ini:
;extension=gd.so
extension=imap.so
;extension=curl.so
extension=ldap.so
extension=mysql.so
;extension=domxml.so
;extension=mcal.so
;extension=mhash.so
;extension=odbc.so
so not all shared modules are loaded.
pcre
PCRE (Perl Compatible Regular Expressions) Support enabled
PCRE Library Version 3.9 02-Jan-2002
(gdb) run -X
Starting program: /usr/local/apache2/bin/httpd -X
[New Thread 1077983808 (LWP 24414)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1077983808 (LWP 24414)]
0x404c29d6 in php_pcre_match (ht=3, return_value=0x81df3f4, this_ptr=0x0,
return_value_used=1, global=0)
at /extra0/home/martijn/src/php-4.3.4/ext/pcre/php_pcre.c:442
442 name_idx = 0xff * name_table[0] +
name_table[1];
Reproduce code:
---------------
<?
include "DB.php"; // PEAR
define("DBTYPE","mysql");
define("DBUSER","user");
define("DBPASS","password");
define("DBSERV","localhost");
define("DB","mydb");
$dsn = DBTYPE."://".DBUSER.":".DBPASS."@".DBSERV."/".DB;
$dbc = DB::connect($dsn);
if (DB::isError($dbc)) {
$page="dberror";
}
else {
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
}
echo "test";
?>
Expected result:
----------------
The word "test" should have been displayed.
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1077983808 (LWP 24414)]
0x404c29d6 in php_pcre_match (ht=3, return_value=0x81df3f4, this_ptr=0x0,
return_value_used=1, global=0)
at /extra0/home/martijn/src/php-4.3.4/ext/pcre/php_pcre.c:442
442 name_idx = 0xff * name_table[0] +
name_table[1];
--
Edit bug report at http://bugs.php.net/?id=26977&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26977&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26977&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26977&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26977&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26977&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26977&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26977&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26977&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26977&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26977&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26977&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26977&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26977&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26977&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26977&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26977&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26977&r=float