From:             rvk at au dot ru
Operating system: Windows 2000
PHP version:      5.0.4
PHP Bug Type:     Reproducible crash
Bug description:  PHP crush when I use recursive function

Description:
------------
When i use function ati_add for array of class, it reproduce crash...

When i use this function for list of class only, it working correctly. 
Code
      $data[3] = ati_add($data[0], $data[1], $data[2]);
working perfectly.

Using PHP for Apache2 isapi module

Reproduce code:
---------------
<?php

class ati {
        var $data, $flag;
        function ati($data = null, $flag = null) {
                $this->data = $data;
                $this->flag = $flag;
        }
}

function ati_add() {
        $c = new ati();
        foreach(func_get_args() as $a) {
                if(is_a($a, 'ati')) {
                        $c->data += $a->data;
                        $c->flag &= $a->flag;
                } else {
                        $c = ati_add($a);
                }
        }
        return $c;
}

$data[] = new ati(1,0);
$data[] = new ati(2,0);
$data[] = new ati(3,0);

$data[3] = ati_add($data);

echo $data[3]->data;

?>

Expected result:
----------------
I should see
6

Actual result:
--------------
Crash Apache with PHP (PHP working as isapi module)

-- 
Edit bug report at http://bugs.php.net/?id=33479&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33479&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33479&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33479&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33479&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33479&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33479&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33479&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33479&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33479&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33479&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33479&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33479&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33479&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33479&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33479&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33479&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33479&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33479&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33479&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33479&r=mysqlcfg

Reply via email to