Modify

Ticket #264 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Illeal use of max() with empty array

Reported by: Oz Solomon Owned by: hans
Priority: low 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

comment:1 Changed 3 years ago 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!

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.