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

Request #5792 Package needs to provide more meaningful errors
Submitted: 2005-10-27 06:04 UTC Modified: 2008-06-04 14:12 UTC
From: doconnor Assigned: cbrunet
Status: Closed Package: File_Archive
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2005-10-27 06:04 UTC] doconnor
Description: ------------ After some time of fooling about with File_Archive, I've found it extremely difficult to achieve what I want in a consistent fashion. What works on a local machine breaks on a remote machine, and error messages are often obscure and non intuitive. I'd like to see a lot more checking within the internal code, and errors being thrown *before* a PHP level error occurs. For instance: Warning: fclose(): supplied argument is not a valid stream resource in /bookfeed/classes/File/Archive/Writer/Files.php on line 224 Despite a long time following the flow of the code in the package, I am still clueless as to why this occurs - I am of the thought that if I am doing something wrong, I should never be able to get *this* far. Also, documentation on the PEAR site would be good, as for the most part your external site has been down infrequently. Test script: --------------- <?php require_once 'File/Archive.php'; class BF_BookParser { public static function extract($in, $out) { //Clean if ($handle = opendir($out)) { while (false !== ($file = readdir($handle))) { if (($file <> ".") && ($file <> "..")) { unlink($out . $file); } } } closedir($handle); //Extract File_Archive::extract($in, $out); if ($handle = opendir($out)) { while (false !== ($file = readdir($handle))) { $info = pathinfo($file); if ($info["extension"] == "opf") { return $file; } } } return false; } } ?> <?php require_once 'xn_private/config.php'; require_once 'BF_BookParser.php'; $uploadDir = 'xn_private/uploaded/'; $in = $uploadDir . $_GET["file"] . '/'; $out = $uploadDir . 'extracted/'; $result = BF_BookParser::extract($in, $out); if ((PEAR::isError($result) == false) && ($result <> false)) { header ("Location: stitch.php?file=" . $result); } else { var_dump($result); } ?> Expected result: ---------------- Archive extracts or fails *gracefully* and informs me as to why. Actual result: -------------- Warning: fclose(): supplied argument is not a valid stream resource in /bookfeed/classes/File/Archive/Writer/Files.php on line 224 bool(false) No files are extracted

Comments

 [2008-06-04 09:03 UTC] cbrunet (Charles Brunet)
Thank you for taking the time to report a problem with the package. Unfortunately you are not using a current version of the package -- the problem might already be fixed. Please download a new version from http://pear.php.net/packages.php If you are able to reproduce the bug with one of the latest versions, please change the package version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PEAR. 1- In what File_Archive version was it? It seems that actually, Archive/Writer/Files.php checks for handle validity before closing the file. 2- You also should check if extract returns a PEAR::Error object.
 [2008-06-04 09:14 UTC] doconnor (Daniel O'Connor)
I can't remember at the moment, I'm happy to close this for now
 [2008-06-04 14:12 UTC] cbrunet (Charles Brunet)
Well... I realized that some PEAR::Error weren't returned up to the caller in Tar code. I fixed some of them.