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

Bug #7769 writePackageFile()/debugPackageFile() return false
Submitted: 2006-05-31 13:16 UTC
From: lsmith Assigned: cellog
Status: Closed Package: PEAR_PackageFileManager (version 1.5.2)
PHP Version: 4.4.1 OS: windows xp sp2
Roadmaps: (Not assigned)    
Subscription  


 [2006-05-31 13:16 UTC] lsmith (Lukas Smith)
Description: ------------ When running any of my package.php for my packages (MDB2_Schema, LiveUser ..) writePackageFile()/debugPackageFile() return false. According to the API docs this should not even be possible. There seems to be some validation error somewher. However I do not understand why there would be a validation error. Either way its kind of hard to figure out what PFM thinks does not validate without a PEAR_Error object. Using 1.6.0b1 seems to produce the same problems.

Comments

 [2006-05-31 13:23 UTC] lsmith (Lukas Smith)
I know why it does not validate now .. the version name 'XXX' is bogus, however that does not change the fact that it should return a PEAR_Error
 [2006-06-01 19:33 UTC] farell (Laurent Laville)
Hi lukas, I've a good and a bad new. Even if i've verified the bug with PFM 1.5.2 and even PFM 1.6.0b1 (with v1 of PFM only), to fix it we need a new release of PEAR due to share code. I'll try to explains now for Greg (that should be assigned for this in PEAR core). Lukas to do my tests, i've used your LiveUser package script generator. And with a clone of it converted to PFM2 i get the expected results : PEAR_PackageFileManager2 Error: Package validation failed: Error: Version type <api> is not a valid version (XXX) Error: Version type <release> is not a valid version (XXX) Bug came from line 991 of http://cvs.php.net/viewcvs.cgi/pear/PEAR_PackageFileManager/PackageFileManager.php?annotate=1.52 This line (into writePackageFile method) $packagexml = $common->xmlFromInfo($this->_packageXml); may returns FALSE under some conditions , rather than xml string infos. Now how to fix it : 1. into PEAR_PackageFileManager::writePackageFile() after line 991 i'll add if (PEAR::isError($packagexml)) { $errs = $packagexml->getUserinfo(); if (is_array($errs)) { foreach ($errs as $error) { if ($error['level'] == 'error') { $errors[] = $error['message']; } else { $warnings[] = $error['message']; } } } } else { $common->validatePackageInfo($packagexml, $warnings, $errors, $this->_options['packagedirectory']); } 2. into PEAR/PackageFile/Generator/v1.php line 198 rather than return FALSE, we should return a PEAR_Error like this: return PEAR::raiseError('PEAR_Packagefile_v1::toXml: invalid package.xml', null, null, null, $this->_packagefile->getValidationWarnings()); Results expected and got : PEAR_PackageFileManager Error: Package validation failed: Channel validator error: field "version" - Invalid version number "XXX" Hope it will help Laurent
 [2006-06-02 01:45 UTC] cellog (Greg Beaver)
Thank you for taking the time to report a problem with the package. This problem may have been already fixed by a previous change that is in the CVS of the package. Please log into CVS with: cvs -d :pserver:cvsread@cvs.php.net:/repository login and check out the CVS repository of this package and upgrade cvs -d :pserver:cvsread@cvs.php.net:/repository co pear/PEAR_PackageFileManager pear upgrade pear/PEAR_PackageFileManager/package2.xml or pear upgrade pear/PEAR_PackageFileManager/package.xml If you are able to reproduce the bug with the latest CVS, please change the status back to "Open". Again, thank you for your continued support of PEAR. this does not require any changes to PEAR in order to fix, and in fact the same problem plagues simpleoutput => true. Instead, we simply need to add a fix similar to what was added for simpleoutput, and apply the same fix to both. I just committed this fix, so please try it out to see if the fix works as well for you as it does for me. # P.S. Laurent, it looks like your web frontend doesn't escape changelog notes, see the package.xml commit for example.
 [2006-06-02 06:25 UTC] farell (Laurent Laville)
Greg, even if you've almost fixed the bug with ComplexGenerator class, there is one more case forgotten. I know it's perharps stupid to use it (old fashion) but if you set into options: "pearcommonclass" => "PEAR_Common" 1. With simpleoutput = true, you get : - no error message, - no xml and - debugPackageFile() return 1 (true) 2. With simpleoutput = false, you get : - error message Channel validator error: field "version" - Invalid version number "XXX" - xml string and - debugPackageFile() return 1 (true) Laurent
 [2006-06-02 19:59 UTC] cellog (Greg Beaver)
I think it is reasonable to assume that nobody will be doing that edge case. If they do, the solution is simple (change the pear common class) so I am not willing to re-write this. Breaking BC inside PEAR is not an option, this is a significant API change, and would affect internal PEAR code as well (we do use PEAR_PackageFile_v1 inside PEAR occasionally). So, the original question: Lukas, does the current CVS fix the issue on your end?
 [2006-06-03 07:09 UTC] lsmith (Lukas Smith)
Looks good to me. Running package.php without a parameter from the MDB2 directory returns: PEAR_PackageFileManager Error: Package validation failed: Channel validator error: field "version" - Invalid version number "XXX"
 [2006-06-05 22:10 UTC] farell (Laurent Laville)
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. Fixed in incoming release 1.5.3 and 1.6.0b2 that will be publish on June 6, 2006 Laurent