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

Bug #3231 duplicate else in generateETag()
Submitted: 2005-01-18 17:16 UTC
From: tomni Assigned: mike
Status: Closed Package: HTTP_Download
PHP Version: 5.0.1 OS: Suse Linux 9.1
Roadmaps: (Not assigned)    
Subscription  


 [2005-01-18 17:16 UTC] tomni
Description: ------------ Their is a critical bug in the function. You cant use two else statements. I guess you wanted to use "elseif" for the first "else" statement. I'd like to submit a patch but dont know good engough what the function is doing. Reproduce code: --------------- // {{{ protected methods /** * Generate ETag * * @access protected * @return string */ function generateETag() { if (!$this->etag) { if ($this->data) { $md5 = md5($this->data); } else { $fst = is_resource($this->handle) ? fstat($this->handle) : stat($this->file); $md5 = md5($fst['mtime'] .'='. $fst['ino'] .'='. $fst['size']); } else { return 'W/"'. time() .'"'; } $this->etag = '"' . $md5 . '-' . crc32($md5) . '"'; } return $this->etag; } // end func Expected result: ---------------- if (...){ } elseif (...) { } else { } Actual result: -------------- Parse error: parse error, unexpected T_ELSE in /usr/local/apache-2.0.52/share/php/HTTP/Download.php on line 796

Comments

 [2005-01-19 10:25 UTC] mike
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/HTTP_Download Thanks a lot.