From: arne dot binder at blue-com dot de
Operating system: Windows NT4
PHP version: 5.0.4
PHP Bug Type: Reproducible crash
Bug description: problem with array_walk()
Description:
------------
The problem is the location of the declaration of the used
callback-function in array_walk(). If this declaration is inside a
switch-block (but if-blocks work!), array_walk() crashes php.
The following sample-code illustrates the problem. If the function
declaration is moved out of the switch-block, everything works fine.
Reproduce code:
---------------
<?
$cond = 1;
switch ($cond) {
case 1:
$arr = array('Line' => ' 1');
print_r($arr);
function trim_it(&$item, $key) { $item=trim($item); }
array_walk($arr, 'trim_it');
print_r($arr);
break;
}
?>
Expected result:
----------------
Array
(
[Line] => 1
)
Array
(
[Line] => 1
)
Actual result:
--------------
Ask Dr. Watson for NT4 ;-)
--
Edit bug report at http://bugs.php.net/?id=32984&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32984&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32984&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32984&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32984&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32984&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32984&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32984&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32984&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32984&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32984&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32984&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32984&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32984&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32984&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32984&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32984&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32984&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32984&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32984&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32984&r=mysqlcfg