PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Math » Math_Stats » Bug #6252

Calculus of frequency give a E_NOTICE

Details

Request #6252Calculus of frequency give a E_NOTICE
Submitted2005-12-15 17:50 UTC
FromSebastien dot Boisvert at USherbrooke dot CA
Assignedjmcastagnetto
StatusClosed
PackageMath_Stats
PHP Version4.4.0
OSlinux 2.6.14.3 on Gentoo
Roadmaps(Not assigned)

Comments

[2005-12-15 17:50 UTC] Sebastien dot Boisvert at USherbrooke dot CA

Description:
------------
The E_NOTICE says that the code itself try to increment an element of an array, but this element has no value.

File : PEAR/Math/Stats.php
Version : Math_Stats-0.9.0beta3
Line : 1216

It does $freq["$val"]++;

I added the following just before :

if (!isset ($freq["$val"]))
{
$freq["$val"] = 0 ;
}

$ diff Stats.php Stats_modified.php
1215a1216,1218
> if (!isset ($freq["$val"])) {
> $freq["$val"] = 0 ;
> }