ID: 42566 Updated by: [EMAIL PROTECTED] Reported By: lindsay at marshall dot name -Status: No Feedback +Status: Bogus Bug Type: Arrays related Operating System: Fedora PHP Version: 5.2.4 New Comment:
The prototype for the function clearly indicates an integer for the initial value, the enforcement was added prior to PHP 4.3.10 to fix bug #29954 Previous Comments: ------------------------------------------------------------------------ [2007-10-23 21:41:37] a at b dot c dot de A short but complete example (copied from the cited user notes on the array_reduce page): <?php function arc ($reduced, $item) { $reduced = $item.$reduced; return $reduced; } array_reduce( array(a,b,c), "arc", "" ); ?> Expected result: cba Actual result: cba0 ------------------------------------------------------------------------ [2007-09-14 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-09-06 10:41:03] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2007-09-05 14:59:16] lindsay at marshall dot name Description: ------------ If you want to use array_reduce to produce a string rather than a number you cannot set the initial string to be '' as it is converted to 0. You can work round this but it is not elegant. There seems to be no reason why array_reduce should not work with strings (it did in 4.x) Reproduce code: --------------- see comment on array_reduce page Expected result: ---------------- see comment on array_reduce page ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42566&edit=1