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

Bug #17781 invalid argument warning on foreach due to an empty optional dependencies
Submitted: 2010-08-21 21:53 UTC
From: glen Assigned: dufuz
Status: Closed Package: PEAR (version 1.9.1)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2010-08-21 21:53 UTC] glen (Elan Ruusamäe)
Description: ------------ PHP_UML-1.5.2 includes package.xml whose dependency optional empty tag: <dependencies> ... <optional /> </dependencies> which results some warning when invoking commands, like make rpm spec: $ pear download PHP_UML-1.5.2 $ pear make-rpm-spec PHP_UML-1.5.2.tgz Warning: Invalid argument supplied for foreach() in PEAR/Downloader.php on line 591 PHP Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Downloader.php on line 591 Wrote RPM spec file php-pear-PHP_UML.spec i've debugged so much that $deps['optional'] is empty string on that warning line: 590 if (isset($deps['optional'])) { 591 foreach ($deps['optional'] as $type => $dep) { 592 if (!isset($dep[0])) { --- var_dump($deps['optional']); string(0) "" --- simply adding && is_array() check, or chaning isset to !empty() (or maybe even both!) should fix the warning, yet i'm not sure is such xml even valid according to PEAR if (isset($deps['optional']) && is_array($deps['optional'])) { if (!empty($deps['optional'])) { if (!empty($deps['optional']) && is_array($deps['optional'])) { PS: same problem appears with PEAR-1.7.2 as well, if that's relevant.

Comments

 [2010-09-14 01:50 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Summary: invalid argument warning for empty optional dependencies +Summary: invalid argument warning on foreach due to an empty optional dependencies -Status: Open +Status: Closed -Assigned To: +Assigned To: dufuz
This bug has been fixed in SVN. 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.