Modify ↓
Ticket #264 (closed defect: fixed)
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
Note: See
TracTickets for help on using
tickets.

This bug has been fixed in the SVN tree, revision r385.
Thank you for the report, and for helping us make Phing better!