FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=17781&edit=1

ID: 17781
Updated by: helgith@gmail.com
Reported By: glen at delfi dot ee
-Summary: invalid argument warning for empty optional
dependencies
+Summary: invalid argument warning on foreach due to an empty
optional dependencies
-Status: Open
+Status: Closed
Type: Bug
Package: PEAR
Package Version: 1.9.1
PHP Version: Irrelevant
-Assigned To:
+Assigned To: dufuz
Roadmap Versions:
New Comment:

-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.




Previous Comments:
------------------------------------------------------------------------

[2010-08-21 17:53:17] glen

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.

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedSep 13, '10 at 9:50p
activeSep 13, '10 at 9:50p
posts1
users1
websitepear.php.net

1 user in discussion

Helgith: 1 post

People

Translate

site design / logo © 2021 Grokbase