Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.1

Bug #4492 Undefined index for each new word
Submitted: 2005-05-31 20:07 UTC
From: mjohnson at pitsco dot com Assigned: cweiske
Status: Closed Package: Text_Statistics
PHP Version: Irrelevant OS: NA
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 23 + 10 = ?

 
 [2005-05-31 20:07 UTC] mjohnson at pitsco dot com
Description: ------------ If error_reporting is set to E_ALL, a notice is issued for each new word, as well as the first access to the $_uniques property. The easiest solution is to add $_uniques as a variable in the class and using the @ operator on the increment. See reproduce code for a patch. Due to the 20 line restriction, I didn't document $_uniques. Reproduce code: --------------- --- Statistics.orig.php 2005-05-31 13:02:31.710024025 -0500 +++ Statistics.x.php 2005-05-31 15:04:37.508227929 -0500 @@ -111,6 +111,8 @@ '/Dr\./i' => 'Doctor', ); + var $_uniques = array(); + /* * Constructor. * @@ -156,7 +158,7 @@ $w_obj = new Text_Word($word); $this->numSyllables += $w_obj->numSyllables(); $this->numWords++; - if($this->_uniques[strtolower($word)]++ == 0) { + if(@$this->_uniques[strtolower($word)]++ == 0) { $this->uniqWords++; } }

Comments

 [2005-09-19 09:43 UTC] demianturner
it would be great to have this patch committed, any takers?
 [2007-03-27 12:39 UTC] cweiske (Christian Weiske)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.