php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14795 array_sum() modifies the specified array
Submitted: 2002-01-02 06:19 UTC Modified: 2002-04-24 11:24 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: jimw at apache dot org Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.1.0 OS: Debian unstable
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jimw at apache dot org
New email:
PHP Version: OS:

 

 [2002-01-02 06:19 UTC] jimw at apache dot org
the documentation claims this behavior was changed after 4.0.6, but it appears to behave the same in 4.1.0. (and i don't see a commit to ext/standard/array.c that indicates any such change to array_sum.)

$a = array(1, 2, "foo");
print_r($a);
echo array_sum($a);
print_r($a);

results in:

Array
(
    [0] => 1
    [1] => 2
    [2] => foo
)
3Array
(
    [0] => 1
    [1] => 2
    [2] => 0
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-24 11:24 UTC] andrei@php.net
This bug has been fixed in CVS.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 12:01:32 2025 UTC