Ticket #264 (closed defect: fixed)

Opened 5 months ago

Last modified 5 months ago

Illeal use of max() with empty array

Reported by: Oz Solomon Assigned to: hans
Priority: trivial Milestone: 2.3.1
Component: phing-core Version: 2.3.1RC1
Keywords: Cc:

Description

In Phing.php around line 316 you will find the code:

$keys = array_keys($args); // Use keys and ...

for($i=0, $max = max(array_keys($args)); $i <= $max; $i++) {

The problem here is when $args is empty calling max(array_keys...) is invalid and will issue an error.

To fix, change the second line to:

for($i=0, $max = $keys? max($keys) : -1; $i <= $max; $i++) {

Attachments

Change History

08/19/08 18:09:43 changed by mrook

  • status changed from new to closed.
  • resolution set to fixed.

This bug has been fixed in the SVN tree, revision r385.

Thank you for the report, and for helping us make Phing better!


Add/Change #264 (Illeal use of max() with empty array)




Action