cvs: pear /Net_SmartIRC SmartIRC.php

From: Date: Mon, 09 Jun 2003 00:32:02 +0000
Subject: cvs: pear /Net_SmartIRC SmartIRC.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-10783@lists.php.net to get a copy of this message
meebey Sun Jun 8 20:32:02 2003 EDT Modified files: /pear/Net_SmartIRC SmartIRC.php Log: - fixed bug in _checktimer(). Index: pear/Net_SmartIRC/SmartIRC.php diff -u pear/Net_SmartIRC/SmartIRC.php:1.37 pear/Net_SmartIRC/SmartIRC.php:1.38 --- pear/Net_SmartIRC/SmartIRC.php:1.37 Sun Jun 8 19:12:33 2003 +++ pear/Net_SmartIRC/SmartIRC.php Sun Jun 8 20:32:02 2003 @@ -1,9 +1,9 @@ <?php /** - * $Id: SmartIRC.php,v 1.37 2003/06/08 23:12:33 meebey Exp $ - * $Revision: 1.37 $ + * $Id: SmartIRC.php,v 1.38 2003/06/09 00:32:02 meebey Exp $ + * $Revision: 1.38 $ * $Author: meebey $ - * $Date: 2003/06/08 23:12:33 $ + * $Date: 2003/06/09 00:32:02 $ * * Net_SmartIRC * Communication for PHP with IRC networks @@ -800,7 +800,7 @@ function log($level, $entry, $file = null, $line = null) { // prechecks - if (!(is_number($level)) || + if (!(is_integer($level)) || !($level > SMARTIRC_DEBUG_NONE && $level < SMARTIRC_DEBUG_ALL)) { $this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING!: invalid log level passed to log() ('.$level.')', __FILE__, __LINE__); @@ -982,6 +982,7 @@ if ($this->_logdestination == SMARTIRC_FILE) { fclose($this->_logfilefp); + $this->_logfilefp = null; } else if ($this->_logdestination == SMARTIRC_SYSLOG) { closelog(); } @@ -1745,7 +1746,7 @@ $handlercount = count($handler); for ($i = 0; $i < $handlercount; $i++) { $handlerobject = &$handler[$i]; - + if ($handlerobject->id == $id) { if (isset($this->_timehandler[$i])) { unset($this->_timehandler[$i]); @@ -1949,19 +1950,20 @@ if (!$this->_loggedin) { return; } - $timehandlercount = count($this->_timehandler); - for ($i = 0; $i < $timehandlercount; $i++) { + + // has to be count() because the array may change during the loop! + for ($i = 0; $i < count($this->_timehandler); $i++) { $handlerobject = &$this->_timehandler[$i]; - if ($this->_microint() >= ($handlerobject->lastmicrotimestamp+($handlerobject->interval/1000))) { + $microtimestamp = $this->_microint(); + if ($microtimestamp >= ($handlerobject->lastmicrotimestamp+($handlerobject->interval/1000))) { $methodobject = &$handlerobject->object; $method = $handlerobject->method; - + $handlerobject->lastmicrotimestamp = $microtimestamp; + if (@method_exists($methodobject, $method)) { $this->log(SMARTIRC_DEBUG_TIMEHANDLER, 'DEBUG_TIMEHANDLER: calling method "'.get_class($methodobject).'->'.$method.'"', __FILE__, __LINE__); $methodobject->$method($this); } - - $handlerobject->lastmicrotimestamp = $this->_microint(); } } }

« previous php.pear.cvs (#10783) next »