From: hager at transgene dot fr
Operating system: Red Hat Linux 8.0
PHP version: 5CVS-2003-07-09 (dev)
PHP Bug Type: Reproducible crash
Bug description: preg_match crashes PHP
Description:
------------
Hello,
I use the pear DB package to access Sybase ; everything works fine with
php 4 but with php 5 it crashes. The backtrace helped me to find out that
it was the "preg_match" function's fault, so i could reproduce the
following minimal code. I tried it with today's (09/07/2003) CVS with the
same result.
The configure line is :
./configure
--with-apxs2=/usr/local/apache2/bin/apxs
--enable-ftp
--with-ldap
--with-kerberos
--with-regex=php
--with-gnu-ld
--with-gettext
--with-zlib
--with-sybase-ct=/opt/sybase/OCS-12_5
--with-debug
Thank you for your help.
Reproduce code:
---------------
<?php
preg_match('/php/i','PHP is the web scripting language of choice.');
?>
Actual result:
--------------
(gdb) run -X
Starting program: /usr/local/apache2/bin/httpd -X
[New Thread 8192 (LWP 7920)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 8192 (LWP 7920)]
0x40225563 in php_pcre_match (ht=2, return_value=0x406f4aec, this_ptr=0x0,
return_value_used=0, global=0)
at /root/php5-200307091330/ext/pcre/php_pcre.c:441
441 name_idx = 0xff * name_table[0] +
name_table[1];
(gdb) bt
#0 0x40225563 in php_pcre_match (ht=2, return_value=0x406f4aec,
this_ptr=0x0, return_value_used=0, global=0)
at /root/php5-200307091330/ext/pcre/php_pcre.c:441
#1 0x40225d45 in zif_preg_match (ht=2, return_value=0x406f4aec,
this_ptr=0x0, return_value_used=0)
at /root/php5-200307091330/ext/pcre/php_pcre.c:599
#2 0x4030858d in zend_do_fcall_common_helper (execute_data=0xbfffd320,
op_array=0x406f49ec)
at /root/php5-200307091330/Zend/zend_execute.c:2625
#3 0x403086c0 in zend_do_fcall_handler (execute_data=0xbfffd320,
op_array=0x406f49ec)
at /root/php5-200307091330/Zend/zend_execute.c:2756
#4 0x4030479c in execute (op_array=0x406f49ec) at
/root/php5-200307091330/Zend/zend_execute.c:1194
#5 0x402f0635 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /root/php5-200307091330/Zend/zend.c:1017
#6 0x402c450f in php_execute_script (primary_file=0xbffff5d0) at
/root/php5-200307091330/main/main.c:1695
#7 0x4030e24c in php_handler (r=0x81c90d0) at
/root/php5-200307091330/sapi/apache2handler/sapi_apache2.c:520
#8 0x0807b66a in ap_run_handler (r=0x81c90d0) at config.c:195
#9 0x0807bb82 in ap_invoke_handler (r=0x81c90d0) at config.c:401
#10 0x0806ba97 in ap_process_request (r=0x81c90d0) at http_request.c:288
#11 0x08067cd5 in ap_process_http_connection (c=0x81c4c98) at
http_core.c:293
#12 0x08084462 in ap_run_process_connection (c=0x81c4c98) at
connection.c:85
#13 0x0807a220 in child_main (child_num_arg=1) at prefork.c:696
#14 0x0807a3ca in make_child (s=0x80b6178, slot=0) at prefork.c:736
#15 0x0807a423 in startup_children (number_to_start=5) at prefork.c:808
#16 0x0807ab15 in ap_mpm_run (_pconf=0x8079afc, plog=0x80ebb50,
s=0x80b6178) at prefork.c:1024
#17 0x0807f82e in main (argc=2, argv=0xbffff894) at main.c:660
#18 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) frame 4
#4 0x4030479c in execute (op_array=0x406f49ec) at
/root/php5-200307091330/Zend/zend_execute.c:1194
1194 if (EX(opline)->handler(&execute_data, op_array
TSRMLS_CC)) {
(gdb) print (char
*)(executor_globals.function_state_ptr->function)->common.function_name
$1 = 0x40314432 "preg_match"
--
Edit bug report at http://bugs.php.net/?id=24563&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24563&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24563&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=24563&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24563&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24563&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24563&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24563&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24563&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24563&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24563&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24563&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24563&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24563&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24563&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24563&r=gnused