php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70649 Array_sum when array content are nuls
Submitted: 2015-10-06 11:50 UTC Modified: 2015-10-06 19:56 UTC
From: marc dot lazzaro at st dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.4.45 OS: Windows XP
Private report: No CVE-ID: None
 [2015-10-06 11:50 UTC] marc dot lazzaro at st dot com
Description:
------------
---
From manual page: http://www.php.net/function.array-sum
---
$arr = array(null,null,null);
$sum = array_sum($arr);

expected value = null
returned value = 0

Test script:
---------------
$arr = array(null,null,null);
$sum = array_sum($arr);
echo $sum;

Expected result:
----------------
NULL

Actual result:
--------------
0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-06 19:56 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2015-10-06 19:56 UTC] requinix@php.net
null+null+null=0
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 08:01:35 2024 UTC