From:             [EMAIL PROTECTED]
Operating system: Linux 2.4.21 (debian sid)
PHP version:      5.0.0b1 (beta1)
PHP Bug Type:     Reproducible crash
Bug description:  php CLI gets a segmentation fault in interactive mode with a simple 
foreach

Description:
------------
Just call php with -a option to enter in interactive mode. Then open php
tags <? (short or long: <?php), write 'foreach' loop and php dies.
The list of modules is long:
./configure \
        --prefix=/usr/local/stow/php \
        --with-apxs=/usr/bin/apxs \
        --with-regex=php \
        --with-config-file-path=/usr/loca/stow/php/etc/php \
        --disable-rpath \
        --disable-debug \
        --enable-memory-limit \
        --with-layout=GNU \
        --enable-calendar \
        --enable-sysvmsg \
        --enable-sysvsem \
        --enable-sysvshm \
        --enable-wddx \
        --enable-track-vars \
        --enable-trans-sid \
        --enable-bcmath \
        --with-bz2 \
        --with-crack \
        --enable-ctype \
        --with-iconv \
        --enable-exif \
        --enable-filepro \
        --enable-ftp \
        --with-gettext \
        --enable-mbstring \
        --with-pcre-regex=/usr \
        --enable-shmop \
        --enable-sockets \
        --enable-wddx \
        --disable-xml \
        --with-expat-dir=/usr \
        --enable-yp \
        --with-zlib \
        --with-pgsql=shared,/usr \
        --with-kerberos=/usr \
        --with-openssl=/usr \
        --with-exec-dir=/usr/lib/php4/libexec \
        --disable-static \
        --enable-dba \
        --with-db4 \
        --with-gdbm \
        --with-inifile \
        --with-flatfile \
        --enable-dbase \
        --with-curl=shared,/usr \
        --with-dom=shared,/usr \
        --with-dom-xslt=shared,/usr \
        --with-dom-exslt=shared,/usr \
        --with-zlib-dir=/usr \
        --with-gd=shared \
        --with-jpeg-dir=shared,/usr \
        --with-xpm-dir=shared,/usr/X11R6 \
        --with-png-dir=shared,/usr \
        --with-imap=shared,/usr \
        --with-imap-ssl \
        --with-mcal=shared,/usr \
        --with-mcrypt=shared,/usr \
        --with-mhash=shared,/usr \
        --with-sqlite=shared,/usr \
        --with-mysql=shared,/usr \
        --with-unixODBC=shared,/usr \
        --with-recode=shared,/usr \
        --enable-xslt \
        --with-xsl=shared,/usr \
        --with-xslt-sablot=shared,/usr \
        --with-snmp=shared \
        --enable-ucd-snmp-hack \
        --with-ttf=shared,/usr \
        --with-mime-magic=/etc/mime-magic \
        --with-mysql=shared,/usr \
        --with-ncurses=shared,/usr \
        --with-readline=shared,/usr \
        --with-iodbc=shared,/usr \
        --enable-pcntl \
        --with-simplexml \
        --with-libxml-dir=/usr \
        --with-freetype-dir=shared,/usr


php.ini diff (compared to php.ini-recomended):
# diff -u php.ini-recommended php.ini 
--- src/php-5.0.0b1/php.ini-recommended 2003-06-18 12:19:16.000000000
-0300
+++ /usr/local/stow/php/etc/php/php.ini 2003-08-03 03:20:22.000000000
-0300
@@ -127,7 +127,7 @@
 ;       also. 
 ; Note: output_handler must be empty if this is set 'On' !!!!
 ;       Instead you must use zlib.output_handler.
-zlib.output_compression = Off
+zlib.output_compression = On
 
 ; You cannot specify additional output handlers if
zlib.output_compression
 ; is activated here. This setting does the same as output_handler but in
@@ -289,7 +289,7 @@
 ; instead (see below).  Keeping display_errors enabled on a production
web site
 ; may reveal security information to end users, such as file paths on
your Web
 ; server, your database schema or other information.
-display_errors = Off
+display_errors = On
 
 ; Even when display_errors is on, errors that occur during PHP's startup
 ; sequence are not displayed.  It's strongly recommended to keep
@@ -307,7 +307,7 @@
 
 ; Do not log repeated messages. Repeated errors must occur in same file
on same
 ; line until ignore_repeated_source is set true.
-ignore_repeated_errors = Off
+ignore_repeated_errors = On
 
 ; Ignore source of message when ignoring repeated messages. When this
setting 
 ; is On you will not log errors with repeated messages from different
files or
@@ -320,7 +320,7 @@
 report_memleaks = On
 
 ; Store the last error/warning message in $php_errormsg (boolean).
-track_errors = Off
+track_errors = On
 


Reproduce code:
---------------
homero:/home/luca# /usr/local/stow/php/bin/php -a
Interactive mode enabled

<? foreach(range(1,2) as $i);
Segmentation Fault



homero:/home/luca# /usr/local/stow/php/bin/php -a
Interactive mode enabled

<?
$a = array(1,2,3,4);
foreach ($a as $i);
Segmentation Fault

Expected result:
----------------
The foreach loop.

Actual result:
--------------
(gdb) run -a
Starting program: /usr/local/stow/php/bin/php -a
[New Thread 16384 (LWP 16009)]
Interactive mode enabled

<? foreach (range(1,2) as $i);

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 16009)]
0x0816a666 in execute (op_array=0x824d0d4) at
/home/luca/src/php-5.0.0b1/Zend/zend_execute.c:1254
1254                    if (EX(opline)->handler(&execute_data, op_array
TSRMLS_CC)) {
(gdb) bt
#0  0x0816a666 in execute (op_array=0x824d0d4) at
/home/luca/src/php-5.0.0b1/Zend/zend_execute.c:1254
#1  0x0815449f in execute_new_code () at
/home/luca/src/php-5.0.0b1/Zend/zend_execute_API.c:841
#2  0x08141520 in zendparse () at Zend/zend_language_parser.c:2174
#3  0x08144ffb in compile_file (file_handle=0xbffff990, type=2) at
Zend/zend_language_scanner.c:3067
#4  0x0815b5d1 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /home/luca/src/php-5.0.0b1/Zend/zend.c:1013
#5  0x0812e246 in php_execute_script (primary_file=0xbffff990) at
/home/luca/src/php-5.0.0b1/main/main.c:1695
#6  0x081757dc in main (argc=2, argv=0xbffffa24) at
/home/luca/src/php-5.0.0b1/sapi/cli/php_cli.c:910
(gdb) 


-- 
Edit bug report at http://bugs.php.net/?id=24922&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24922&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24922&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24922&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24922&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24922&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24922&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24922&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24922&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24922&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24922&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24922&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24922&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24922&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24922&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24922&r=gnused

Reply via email to