Cannot redeclare ....

For programming and general questions on Zend Framework

Cannot redeclare ....

Postby tmclssns on Tue Mar 23, 2010 9:20 am

The error message

[23-Mar-2010 08:36:16] PHP Fatal error: Cannot redeclare humanize() (previously declared in /Users/tmclssns/Sites/nadar/nadar/trunk/webapp/application/filer/models/Filer/Aggregate.php:133) in /Users/tmclssns/Sites/nadar/nadar/trunk/webapp/application/filer/models/Filer/Aggregate.php on line 133

I have a "Filer" model which contains several methods to generate graphs. Each method in there related to generating graphs has the suffix "Graph" in the method name. As we have some performance issues, I try to render the graphs in advance (using cron) instead of rendering them on each request. The code below is what I came up with:

Code: Select all
public function generategraphsAction()
    {
        $this->_helper->viewRenderer->setNoRender();
        $config = Zend_Registry::get('config');
        $id = $this->_getParam('filerid');

        $filer = new Filer($id);
        $filer_methods = get_class_methods($filer);

        foreach ($filer_methods as $filer_method) {
            if (preg_match('/^(.*)Graph$/i', $filer_method, $matches)) {
                $path = $config->imaging_caching_dir . "/$id/{$matches[1]}.png";
                $filer->$matches[0]($path);
            }
        }

        // var_dump(get_class_methods($filer)); die;
    }


The result from the var_dump() is the following:

Code: Select all
array
  0 => string '__construct' (length=11)
  1 => string 'find_by_name' (length=12)
  2 => string 'getPartner' (length=10)
  3 => string 'getSlots' (length=8)
  4 => string 'getGroups' (length=9)
  5 => string 'grouplist' (length=9)
  6 => string 'getAggregates' (length=13)
  7 => string 'getVolumes' (length=10)
  8 => string 'getAggregateVolumes' (length=19)
  9 => string 'getShelves' (length=10)
  10 => string 'getAutoSupportHistory' (length=21)
  11 => string 'getAutoSupportMail' (length=18)
  12 => string 'getOrphans' (length=10)
  13 => string 'getAll' (length=6)
  14 => string 'getDiskRevOverview' (length=18)
  15 => string 'getDiskTypeOverview' (length=19)
  16 => string 'getDiskTypeSizeFunctionOverview' (length=31)
  17 => string 'getLicenses' (length=11)
  18 => string 'removeGroup' (length=11)
  19 => string 'addGroup' (length=8)
  20 => string 'hasGroup' (length=8)
  21 => string 'aggdefaultGraph' (length=15)
  22 => string 'aggbarGraph' (length=11)
  23 => string 'voldefaultGraph' (length=15)
  24 => string 'volbarGraph' (length=11)
  25 => string 'replicationGraph' (length=16)
  26 => string 'getReplicationData' (length=18)
  27 => string 'humanize' (length=8)
  28 => string 'getFiler' (length=8)
  29 => string 'getOptions' (length=10)
  30 => string 'getCifsInfo' (length=11)
  31 => string 'getCifsStats' (length=12)
  32 => string '__get' (length=5)
  33 => string 'tr' (length=2)
  34 => string 'trs' (length=3)
  35 => string 'fieldList' (length=9)


The method finds the methods correctly:

Code: Select all
array
  0 => string 'aggdefaultGraph' (length=15)
  1 => string 'aggdefault' (length=10)

array
  0 => string 'aggbarGraph' (length=11)
  1 => string 'aggbar' (length=6)

array
  0 => string 'voldefaultGraph' (length=15)
  1 => string 'voldefault' (length=10)

array
  0 => string 'volbarGraph' (length=11)
  1 => string 'volbar' (length=6)

array
  0 => string 'replicationGraph' (length=16)
  1 => string 'replication' (length=11)


However when the first graph is generated, it generates the above listed PHP fatal error. Anyone can come up with a solution to this? I tried to pass by reference or switch a few things around (like re declare the Filer model, $current_filer = new Filer($id); and unset() it again after the request, but resulted in the same error) without much success.

The referenced method "humanize" isn't used for anything I'm doing at the moment, but belongs to the Model because it's used in several other places.

Code: Select all
public function humanize ($kbytes, $unit = null) {
       // KiloByte, Megabyte, GigaByte, TeraByte, PetaByte, ExaByte, ZettaByte, YottaByte
       $units = array('KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
       if (null !== $units) {
           $i = array_search(substr($unit, -2), $units);
           if (! $i) {
               $i = floor((strlen($kbytes) - 1) / 3);
           }
       } else {
           $i = floor((strlen($kbytes) - 1) / 3);
       }
       $newSize = round($kbytes / pow(1024, $i), 2);
       return $newSize . $units[$i];
   }


For reference, the full Filer.php model class.

Code: Select all
class Filer extends Filer_Db_Class {

    /**
     * The prefix for every field in the associated table
     *
     * @var string
     */
    protected $_fieldPrefix       = 'flr_';

    /**
     * The domain of a filer.
     * This is the domain part of the flr_asup_from field.
     *
     * @var string
     */
    public $domain;
    public $slots                 = array();
    public $aggregates            = array();
    public $volumes               = array();
    public $aggregateVolumes      = array();
    public $groups                = array();
    public $autoSupportHistory    = array();
    public $shelves               = array();
    public $diskrevs              = array();
    public $disktypes             = array();
    public $diskfunctions         = array();
    public $licenses              = array();
    public $cifs_info             = array();
    public $cifs_stats            = array();
    public $name;

    /**
     * Constructor function with mandatory $id or table row.
     * Filers are added by another application, we just fetch and use them.
     *
     * @param int|Filer_Row $id Database id or row of the filer we want to fetch.
     */
    public function __construct($filer) {
        parent::__construct($filer);
        $this->domain = preg_replace('/.*@/', '', $this->asup_from);
      $this->name = $this->hostname;
    }

   public function find_by_name ($type, $name) {
      $types = array (
         'vol' => array ('table' => 'volume', 'prefix' => 'vol', 'class' => 'Filer_Aggregate_Volume'),
         'tvol' => array ('table' => 'volume', 'prefix' => 'vol', 'class' => 'Filer_Volume'),
         'agg' => array ('table' => 'aggregate', 'prefix' => 'agg', 'class' => 'Filer_Aggregate'),
         'lun' => array ('table' => 'lun', 'prefix' => 'lun', 'class' => 'Filer_Volume_Lun')
      );
      $db = Vanne_Db::init('netapp');
      $select = $db->select()
            ->from(array('t'=>$types[$type]['table']), array('id'=>$types[$type]['prefix'].'_key'))
            ->where($db->quoteInto("t.{$types[$type]['prefix']}_system_id = {$this->system_id} AND t.{$types[$type]['prefix']}_name = ?", $name))
            ->limit(1);
        $row = $select->query()->fetch();
      $class = $types[$type]['class'];
        return new $class ($row['id']);
   }

    public function getPartner() {
        if ($this->partner_id == -1) {
            return null;
        } else {
            return new Filer ($this->partner_id);
        }
    }

    public function getSlots () {
        $this->slots = Filer_Device::getByFiler($this->system_id);
      return $this;
    }

    public function getGroups () {
        $rows = $this->_row->findManyToManyRowset('Filer_Group_Table', 'Filer_Group_Members_Table');
        foreach ($rows as $row) {
            $this->groups[] = new Filer_Group ($row);
        }
        return $this;
    }

   public function grouplist() {
      if (count($this->groups) == 0 ) {
         $this->getGroups();
      }
      $names = array();
      foreach ($this->groups as $group) {
         $names[] = $group->name;
      }
      return join(', ', $names);
   }

    public function getAggregates ($volumes_as_well = false) {
        $this->aggregates = Filer_Aggregate::getByFiler($this->system_id);
      if ($volumes_as_well) {
         foreach ($this->aggregates as $aggregate) {
            $aggregate->getVolumes();
         }
      }
      return $this;
    }

    public function getVolumes () {
        $this->volumes = Filer_Volume::getByFiler($this->system_id);
      return $this;
    }

    public function getAggregateVolumes () {
        $this->aggregateVolumes = Filer_Aggregate_Volume::getByFiler($this->system_id);
      return $this;
    }

    public function getShelves ($getDisks = false) {
        $this->shelves = Filer_Shelf::getByFiler($this->system_id);
        if ($getDisks) {
            foreach ($this->shelves as $ha) {
               foreach ($ha as $shelf) {
                   $shelf->getDisks();
               }
            }
        }
        return $this;
    }

    public function getAutoSupportHistory () {
        $this->autoSupportHistory = Filer_Event_AutoSupport::getHistory($this->system_id);
        return $this;
    }

        /**
     * Sets the mail property to a ready to use Filer_AutoSupportMail
     *
     * @return Filer Itself
     */
    public function getAutoSupportMail() {
        $this->mail = new Filer_AutoSupportMail ($this->asup_mail);
        return $this;
    }

    /**
     * Will return an array with Filer objects that are not in any group.
     */
    public static function getOrphans () {
        $table = new Filer_Table ();
        $where = 'flr_system_ID NOT IN (SELECT DISTINCT grs_system_id FROM groups_systems)';
        $rows = $table->fetchAll($where);
        $orphans = array();
        foreach ($rows as $row) {
            $orphans[] = new Filer ($row);
        }
        return $orphans;
    }

   /**
    * Will return an array of ALL filers
    */
   public static function getAll () {
      $table = new Filer_Table ();
        $rows = $table->fetchAll(null, array('flr_ontap_version DESC', 'flr_firmware_version DESC', 'flr_rlm_firmware_version DESC'));
        $filers = array();
        foreach ($rows as $row) {
            $filers[] = new Filer ($row);
        }
        return $filers;
   }

    /**
     * Finds all disk revs for this filer
     */
    public function getDiskRevOverview () {
        $this->diskrevs = Filer_Shelf_Disk::getFilerRevOverview($this->system_id);
        return $this;
    }

    /**
     * Finds all disk types for this filer
     */
    public function getDiskTypeOverview() {
        $this->disktypes = Filer_Shelf_Disk::getFilerTypeOverview($this->system_id);
   return $this;
    }

    /**
     * Finds all disk types, sizes, functions for this filer
     */
    public function getDiskTypeSizeFunctionOverview() {
        $this->diskfunctions = Filer_Shelf_Disk::getFilerTypeSizeFunctionOverview($this->system_id);
   return $this;
    }

   /**
     * Finds all licenses for this filer
     */
    public function getLicenses () {
        $this->licenses = Filer_License::getByFiler($this->system_id);
        return $this;
    }

    public function removeGroup ($group) {
        if (!$group instanceof Filer_Group) {
            $group = new Filer_Group ($group);
        }
        if (!$this->hasGroup()) {
            throw new Filer_Exception ("This filer is not in group {$group->name}!!");
        }
        $table = new Filer_Group_Members_Table ();
        $where = $table->getAdapter()->quoteInto('grs_grp_key = ? AND grs_system_id = ?',
            $group->id, $this->system_id);
        $table->delete($where);
        foreach ($this->groups as $key => $checkGrp) {
            if ($checkGrp->id == $group->id) {
                unset($this->groups[$key]);
                break;
            }
        }
        return $this;
    }

    public function addGroup ($group) {
        if (!$group instanceof Filer_Group) {
            $group = new Filer_Group ($group);
        }
        if ($this->hasGroup()) {
            throw new Filer_Exception ("This filer is already in group {$group->name}!!");
        }
        $data = array ('grs_grp_key'   => $group->id,
                       'grs_system_id' => $this->system_id);
        $table = new Filer_Group_Members_Table ();
        $table->insert($data);
        $this->groups[] = $group;
        return $this;
    }

    public function hasGroup ($group) {
        if (!$group instanceof Filer_Group) {
            $group = new Filer_Group ($group);
        }
        $this->getGroups();
        foreach ($this->groups as $checkGrp) {
            if ($checkGrp->id == $group->id) {
                return true;
            }
        }
        return false;
    }


    /**
     * This method will generate the volumes graph for this filer. If $filename
     * is not null, then the graph should be saved in that file instead of
     * output!
     *
     * @param string $fileName filename and path to save the graph too.
    public function volumesGraph ($fileName = null) {
        if (count($this->volumes) == 0) {
            $this->getVolumes();
        }
        foreach ($this->volumes as $volume) {
            echo $volume->id;
        }
    }
     */

   public function aggdefaultGraph ($path = null) {
       $this->getAggregates();
       list($sums, $sumsH) = Filer_Aggregate::sums($this->aggregates);
       $trans = new Filer_Db_Translation('aggregate');
       $title = "Aggregates summary for {$this->hostname}";
        $data = array (
            // dataset 1
            array(
                array($trans->getString('agg_size_snapshot_reserve').': ' .
                    $sumsH['size_snapshot_reserve'],
                    $sums['size_snapshot_reserve'], 'sreserve', 'yellow', 'white'),
                array($trans->getString('agg_size_active_fs_reserved').': ' .
                    $sumsH['size_active_fs_reserved'],
                    $sums['size_active_fs_reserved'], 'areserved', 'purple', 'white'),
                array('Usable space: '.$sumsH['size_usable'],
                    $sums['size_usable'], 'usable', 'dimgray', 'white'),
            ),
            // dataset 2
            array(
                array($trans->getString('agg_size_snapshot_used').': '.
                    $sumsH['size_snapshot_used'],
                    $sums['size_snapshot_used'], 'sused', 'white', 'red'),
                array($trans->getString('agg_size_snapshot_free').': '.
                    $sumsH['size_snapshot_free'],
                    $sums['size_snapshot_free'], 'sfree', 'white', 'blue'),
                array($trans->getString('agg_size_active_fs_used').': '.
                    $sumsH['size_active_fs_used'],
                    $sums['size_active_fs_used'], 'aused', 'white', 'orange'),
                array($trans->getString('agg_size_active_fs_free').': '.
                    $sumsH['size_active_fs_free'],
                    $sums['size_active_fs_free'], 'afree', 'white', 'green'),
            )
        );
        $graph = new Graph_Pie ($title, $data, $sumsH['size_total']);
        $graph->dump($path);
   }

    public function aggbarGraph ($path = null) {
       $this->getAggregates();
       list($sums, $sumsH) = Filer_Aggregate::sums($this->aggregates);
       $trans = new Filer_Db_Translation('aggregate');

        $title = "Aggregates summary for {$this->hostname} ({$sumsH['size_total']})";
        $data = array (
            // dataset 1
            array(
               $trans->getString('agg_size_snapshot_reserve')." ({$sumsH['size_snapshot_reserve']})",
               'yellow',
                array('reservation', $sums['size_snapshot_reserve'], 'sreserve'),
               array('actual', 0, 'dummy0'),
            ),
            // dataset 2
            array(
               $trans->getString('agg_size_active_fs_reserved')." ({$sumsH['size_active_fs_reserved']})",
               'purple',
                array('reservation', $sums['size_active_fs_reserved'], 'areserved'),
               array('actual', 0, 'dummy1'),
            ),
            // dataset 3
            array(
               'Usable space'." ({$sumsH['size_usable']})",
               'dimgray',
                array('reservation', $sums['size_usable'], 'usable'),
               array('actual', 0, 'dummy2'),
            ),
            // dataset 4
            array(
               $trans->getString('agg_size_snapshot_used')." ({$sumsH['size_snapshot_used']})",
               'red',
               array('reservation', 0, 'dummy3'),
                array('actual', $sums['size_snapshot_used'], 'sused'),
            ),
            // dataset 5
            array(
               $trans->getString('agg_size_snapshot_free')." ({$sumsH['size_snapshot_free']})",
               'blue',
               array('reservation', 0, 'dummy4'),
                array('actual', $sums['size_snapshot_free'], 'sfree'),
            ),
            // dataset 6
            array(
               $trans->getString('agg_size_active_fs_used')." ({$sumsH['size_active_fs_used']})",
               'orange',
               array('reservation', 0, 'dummy5'),
                array('actual', $sums['size_active_fs_used'], 'aused'),
            ),
            // dataset 7
            array(
               $trans->getString('agg_size_active_fs_free')." ({$sumsH['size_active_fs_free']})",
               'green',
               array('reservation', 0, 'dummy6'),
                array('actual', $sums['size_active_fs_free'], 'afree'),
            )
        );
        $graph = new Graph_Bar ($title, $data, $sumsH['size_total']);
        $graph->dump($path);
    }

   public function voldefaultGraph ($path = null) {
       $this->getVolumes();
       $this->getAggregateVolumes();
       list($sums, $sumsH) = Filer_Aggregate::sums(array_merge($this->volumes,
            $this->aggregateVolumes));
       $trans = new Filer_Db_Translation('volume');
       $title = "Volumes summary for {$this->hostname}";
        $data = array (
            // dataset 1
            array(
                array($trans->getString('vol_size_snapshot_reserve').': ' .
                    $sumsH['size_snapshot_reserve'],
                    $sums['size_snapshot_reserve'], 'sreserve', 'yellow', 'white'),
                array($trans->getString('vol_size_active_fs_reserved').': ' .
                    $sumsH['size_active_fs_reserved'],
                    $sums['size_active_fs_reserved'], 'areserved', 'purple', 'white'),
                array('Usable space: '.$sumsH['size_usable'],
                    $sums['size_usable'], 'usable', 'dimgray', 'white'),
            ),
            // dataset 2
            array(
                array($trans->getString('vol_size_snapshot_used').': '.
                    $sumsH['size_snapshot_used'],
                    $sums['size_snapshot_used'], 'sused', 'white', 'red'),
                array($trans->getString('vol_size_snapshot_free').': '.
                    $sumsH['size_snapshot_free'],
                    $sums['size_snapshot_free'], 'sfree', 'white', 'blue'),
                array($trans->getString('vol_size_active_fs_used').': '.
                    $sumsH['size_active_fs_used'],
                    $sums['size_active_fs_used'], 'aused', 'white', 'orange'),
                array($trans->getString('vol_size_active_fs_free').': '.
                    $sumsH['size_active_fs_free'],
                    $sums['size_active_fs_free'], 'afree', 'white', 'green'),
            )
        );
        $graph = new Graph_Pie ($title, $data, $sumsH['size_total']);
        $graph->dump($path);
   }

    public function volbarGraph ($path = null) {
       $this->getVolumes()->getAggregateVolumes();
       list($sums, $sumsH) = Filer_Volume::sums(array_merge($this->volumes, $this->aggregateVolumes));
       $trans = new Filer_Db_Translation('volume');

        $title = "Volumes summary for {$this->hostname} ({$sumsH['size_total']})";
        $data = array (
            // dataset 1
            array(
               $trans->getString('vol_size_snapshot_reserve')." ({$sumsH['size_snapshot_reserve']})",
               'yellow',
                array('reservation', $sums['size_snapshot_reserve'], 'sreserve'),
               array('actual', 0, 'dummy0'),
            ),
            // dataset 2
            array(
               $trans->getString('vol_size_active_fs_reserved')." ({$sumsH['size_active_fs_reserved']})",
               'purple',
                array('reservation', $sums['size_active_fs_reserved'], 'areserved'),
               array('actual', 0, 'dummy1'),
            ),
            // dataset 3
            array(
               'Usable space'." ({$sumsH['size_usable']})",
               'dimgray',
                array('reservation', $sums['size_usable'], 'usable'),
               array('actual', 0, 'dummy2'),
            ),
            // dataset 4
            array(
               $trans->getString('vol_size_snapshot_used')." ({$sumsH['size_snapshot_used']})",
               'red',
               array('reservation', 0, 'dummy3'),
                array('actual', $sums['size_snapshot_used'], 'sused'),
            ),
            // dataset 5
            array(
               $trans->getString('vol_size_snapshot_free')." ({$sumsH['size_snapshot_free']})",
               'blue',
               array('reservation', 0, 'dummy4'),
                array('actual', $sums['size_snapshot_free'], 'sfree'),
            ),
            // dataset 6
            array(
               $trans->getString('vol_size_active_fs_used')." ({$sumsH['size_active_fs_used']})",
               'orange',
               array('reservation', 0, 'dummy5'),
                array('actual', $sums['size_active_fs_used'], 'aused'),
            ),
            // dataset 7
            array(
               $trans->getString('vol_size_active_fs_free')." ({$sumsH['size_active_fs_free']})",
               'green',
               array('reservation', 0, 'dummy6'),
                array('actual', $sums['size_active_fs_free'], 'afree'),
            )
        );
        $graph = new Graph_Bar ($title, $data, $sumsH['size_total']);
        $graph->dump($path);
    }

    public function replicationGraph ($path = null) {
       $data = $this->getReplicationData();
       $graph = new Graph_Replication (array('Source',$this->hostname,'destination'), $data);
       $graph->dump($path);
    }

    public function getReplicationData () {
       $reps1 = Filer_Volume_Snap_Mirror::getDstByFiler($this);
       $reps2 = Filer_Volume_Snap_Vault::getDstByFiler($this);
       $data['destination'] = array_merge($reps1, $reps2);

       $reps1 = Filer_Volume_Snap_Mirror::getSrcByFiler($this);
       $reps2 = Filer_Volume_Snap_Vault::getSrcByFiler($this);
       $data['source'] = array_merge($reps1, $reps2);
       $reps1 = Filer_Volume_Snap_Mirror::getInternalByFiler($this);
       $reps2 = Filer_Volume_Snap_Vault::getInternalByFiler($this);
       $data['internal'] = array_merge($reps1, $reps2);
       return $data;
    }

   /*
    * Now follow some uility functions for the Filer module
    */

    /**
   * Turns a KiloByte value (integer) into a human readable format.
   *
   * @param int $kbytes
   * @param string $unit If last 2 chars are valif unit, that unit will be used.
   */
   public static function humanize ($kbytes, $unit = null) {
       // KiloByte, Megabyte, GigaByte, TeraByte, PetaByte, ExaByte, ZettaByte, YottaByte
       $units = array('KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
       if (null !== $units) {
           $i = array_search(substr($unit, -2), $units);
           if (! $i) {
               $i = floor((strlen($kbytes) - 1) / 3);
           }
       } else {
           $i = floor((strlen($kbytes) - 1) / 3);
       }
       $newSize = round($kbytes / pow(1024, $i), 2);
       return $newSize . $units[$i];
   }

   public function getFiler () {
      return $this;
   }

   public function getOptions ($filter = null) {
      $this->options = Filer_Option::getByFiler($this->system_id, $filter);
      return $this;
   }

   /**
    * Ugly DB = ugly code :(
    */
   public function getCifsInfo () {
      $db = Vanne_Db::init('dummy');
      $db->setFetchMode(Zend_Db::FETCH_ASSOC);
      $info = $db->fetchRow('SELECT * FROM cifsinfo WHERE cfi_system_id = ' . $this->system_id);
      unset($info['cfi_key']);
      unset($info['cfi_system_id']);
      unset($info['cfi_evt_id']);
      $this->cifs_info = $info;
      return $this;
   }

   public function getCifsStats () {
      $this->cifs_stats = Filer_CifsStat::getByFiler($this->system_id);
      return $this;
   }

}
tmclssns
 
Posts: 10
Joined: Thu Feb 04, 2010 9:11 am

Re: Cannot redeclare ....

Postby tmclssns on Tue Mar 23, 2010 10:04 am

I found the cause of this error, although a possible solution / suggestion is still welcome.

Inside the first found "graph" method (aggdefaultGraph) I found the following line:

Code: Select all
list($sums, $sumsH) = Filer_Aggregate::sums($this->aggregates);


I found the following line in the Filer_Aggregate model

Code: Select all
$dataset[] = array('The rest: '.Filer::humanize($rest), $rest, 'rest', 'white', array_shift($colors));


This line references back to the Filer model, which I created an instance of in the first place and I assume that's where the redeclare fatal error comes from.
tmclssns
 
Posts: 10
Joined: Thu Feb 04, 2010 9:11 am

Re: Cannot redeclare ....

Postby tmclssns on Tue Mar 23, 2010 10:17 am

The actual cause is this method:

Code: Select all
public static function sums ($aggregates) {
        function humanize(&$item, $key) {
            $item = Filer::humanize($item);
        }

        $sums = array('size_total' => 0, 'size_usable' => 0, 'size_snapshot_reserve' => 0,
                      'size_snapshot_used' => 0, 'size_snapshot_free' => 0,
                      'size_active_fs_used' => 0, 'size_active_fs_free' => 0,
                 'size_active_fs_reserved' => 0);
        foreach ($aggregates as $aggregate) {
         if ($aggregate->state !== 'online') continue;
            $sums['size_total'] += $aggregate->size_total;
            $sums['size_usable'] += $aggregate->size_usable;
            $sums['size_snapshot_reserve'] += $aggregate->size_snapshot_reserve;
            $sums['size_snapshot_used'] += $aggregate->size_snapshot_used;
            $sums['size_snapshot_free'] += $aggregate->size_snapshot_free;
            $sums['size_active_fs_used'] += $aggregate->size_active_fs_used;
            $sums['size_active_fs_free'] += $aggregate->size_active_fs_free;
            $sums['size_active_fs_reserved'] += $aggregate->size_active_fs_reserved;
        }
        $humanSums = $sums;
        array_walk($humanSums, 'humanize');
        return array($sums, $humanSums);
    }
tmclssns
 
Posts: 10
Joined: Thu Feb 04, 2010 9:11 am

Re: Cannot redeclare ....

Postby tmclssns on Tue Mar 23, 2010 10:37 am

Problem fixed.
Adding
Code: Select all
if(!function_exists('humanize'))
block around the method declaration solved it.
tmclssns
 
Posts: 10
Joined: Thu Feb 04, 2010 9:11 am


Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 4 guests