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 : 39 - 25 = ?

 
 [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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2007-03-27 12:39 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!