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

Bug #7579 cannot convert package 1.0 to 2.0 with PFM 1.6.0
Submitted: 2006-05-08 17:48 UTC
From: farell Assigned: cellog
Status: Closed Package: PEAR (version 1.4.9)
PHP Version: 4.4.2 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2006-05-08 17:48 UTC] farell (Laurent Laville)
Description: ------------ While i try to prepare some scripts to explains how to do some PFM steps, i found a new bug. I found it only because i set PEAR::setErrorHandling(PEAR_ERROR_DIE); Without previous line, we can't see the problem. As always, for last bugs found with PEAR_PackageFileManager (PFM) 1.6.0, this one result to share code with PEAR core. If you want to convert directly a package.xml 1.0 to 2.0, with PEAR_PackageFileManager2::importFromPackageFile1() [see script below], we got error message "Logger must be compatible with PEAR_Common::log". For example i took the DB-1.7.6 package v1.0 We need a fix on PFM into importOptions(). I'll apply patch later, but we also need a fix on PEAR core to avoid such situation. Into file [...]\PEAR\PackageFile\Generator\v1.php line 683 // something like ... if ($this->_packagefile->_logger)) { $ret->setLogger($this->_packagefile->_logger); } Laurent Test script: --------------- <?php class Audit { function log($level, $msg, $append_crlf = true) { print "$msg\n"; } } require_once 'PEAR/PackageFileManager2.php'; PEAR::setErrorHandling(PEAR_ERROR_DIE); error_reporting(E_ALL); // Configuration of PEAR::PackageFileManager $optionsUpdate = array( 'cleardependencies' => false, 'clearcontents' => false, 'baseinstalldir' => '/' ); // Location of your package.xml 1.0 version $packagefile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'package_DB-1.7.6.xml'; $packagefileExists = file_exists($packagefile); if ($packagefileExists) { $pkg = &PEAR_PackageFileManager2::importFromPackageFile1($packagefile, $optionsUpdate); /* // part of code from PEAR_PackageFileManager2::importFromPackageFile1() $z = &PEAR_Config::singleton(); $pkg = new PEAR_PackageFile($z); $pf = $pkg->fromPackageFile($packagefile, PEAR_VALIDATE_NORMAL); if ($pf->getPackagexmlVersion() == '1.0') { $packagefile = &$pf; // to fix temporary the bug: make sure we have an active "logger" $l =& new Audit(); $packagefile->setLogger($l); } $pkg = &PEAR_PackageFileManager2::importOptions($packagefile, $optionsUpdate); */ } else { die('Your package.xml 1.0 does not exists.'); } $pkg->generateContents(); $pkg->debugPackageFile(); ?> Expected result: ---------------- no error message even when errorhandler is set to PEAR_ERROR_DIE Actual result: -------------- when PEAR::setErrorHandling(PEAR_ERROR_DIE); we have message "Logger must be compatible with PEAR_Common::log"

Comments

 [2006-05-10 02:57 UTC] cellog (Greg Beaver)
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 both in HEAD and PEAR_1_4 branch