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

Bug #9307 Validator generates warning on empty <contents> tag
Submitted: 2006-11-11 15:51 UTC
From: farell Assigned: cellog
Status: Closed Package: PEAR (version 1.4.11)
PHP Version: 4.4.2 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2006-11-11 15:51 UTC] farell (Laurent Laville)
Description: ------------ Related to PEAR_PackageFileManager (P_PFM): If user forget to generate <contents> tag with P_PFM::generateContents() method in his pkg script generator, then PEAR_PackageFile_v2_Validator class raise a warning because PEAR_PackageFile_v2::getContents() return false. Same behavior with PEAR 1.5.0a1, and pear cvs Validator.php,v 1.94 2006/10/31 02:54:41 cellog Exp Test script: --------------- <?php require_once 'PEAR/PackageFileManager2.php'; PEAR::setErrorHandling(PEAR_ERROR_DIE); $packagefile = 'C:\php\pear\PEAR_PackageFileManager\package2.xml'; $options = array('filelistgenerator' => 'cvs', 'packagedirectory' => dirname($packagefile), 'baseinstalldir' => 'PEAR', // 'clearchangelog' => true ); $p2 = &PEAR_PackageFileManager2::importOptions($packagefile, $options); if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) { $p2->writePackageFile(); } else { $p2->debugPackageFile(); } ?> Expected result: ---------------- No warning raised Actual result: -------------- Warning: Invalid argument supplied for foreach() in [...]\PEAR\PackageFile\v2\Validator.php on line 1736

Comments

 [2006-11-12 17:00 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.
 [2006-11-12 18:47 UTC] farell (Laurent Laville)
Sorry but this fix, Validator.php,v 1.95 2006/11/12 16:59:52 cellog Exp does not solve the warning error message raised. line 1730 : $info = $this->_pf->getContents(); return boolean false Have a special look on lines 1734 to 1739 $info = $info['dir']['file']; if (isset($info['attribs'])) { $info = array($info); } $provides = array(); foreach ($info as $fa) { $info is not an array as expected, that is why we get a warning message . Warning: Invalid argument supplied for foreach() in [...]\PEAR\PackageFile\v2\Validator.php on line 1739