ID:               27721
 Comment by:       aaron dot hawley at uvm dot edu
 Reported By:      madams at morcor dot com
 Status:           Bogus
 Bug Type:         Arrays related
 Operating System: windows 2000/2003 server
 PHP Version:      4.3.4
 New Comment:

I'd guess it has to do with FreeBSD == 'Good'.

Fortunately, there is a solution.  One just needs to create your own
array_walk function (yes, PHP allows you to write functions!):


    function array_walk_r(&$array, $function, $data = null)
    {
        foreach ($array as $key => $value)
        {
            call_user_func_array($function,
                                 array($value, $key, $data));
            $array[$key] = $value;
        }
    } // end func array_walk_r

It's too bad the PHP folks can't support us more functional-minded
folks.


Previous Comments:
------------------------------------------------------------------------

[2004-03-26 14:05:24] madams at morcor dot com

Interestingly enough this code works fine with PHP running in FreeBSD. 
Why is that?  Any ideas?

------------------------------------------------------------------------

[2004-03-26 13:43:53] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Recursive functions will overflow the stack, this is a 
known and unsupported functionality. 

------------------------------------------------------------------------

[2004-03-26 12:57:54] madams at morcor dot com

Description:
------------
array_walk causes PHP to crash on Windows 2000/2003 server when called
recursively.

Reproduce code:
---------------
Please see
http://staff.morcor.com/~madams/tmp/bugs.php.net/2004-03-26.array_walk_bug.phps
for the source that causes PHP on Windows 2000/2003 server crash.  The
script also attempts to load an xml file.  An example XML file is
located at
http://staff.morcor.com/~madams/tmp/bugs.php/net/2004-03-26.configuration.xml
Script depends on PEAR.php and PEAR Config.php

Expected result:
----------------
This code should parse the array created by PEAR::Config and define a
constant for every value in the array that is not a) an array itself,
b) an array with a key of '@' or c) an array that does not have an
attribute (sub-array '@') constant marked 'FALSE'.

Actual result:
--------------
Script runs partially, stops and fails to terminate properly.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27721&edit=1

Reply via email to