1

Topic: Fatal error!

Hi,
I'm getting a Fatal error when cron tries to run and I really don't have a clue how to fix it. The error is:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 263132 bytes) in  .../records/sites/all/modules/iform/client_helpers/data_entry_helper.php on line 3312

This is followed by an error that says: Cron has been running for more than an hour and is most likely stuck.

I actually seem to be getting quite a few errors in the log entries and am not sure how to deal with most of them - all to do with arrays e.g. array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #1 is not an array in .../records/sites/all/modules/iform/client_helpers/report_helper.php on line 2242.

I'm working with the download from the Indicia.org.uk download page.

Any help will be really appreciated.

Thanks,
Fiona

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar

2

Re: Fatal error!

Hi Fiona

I haven't seen anything like this myself. What version of the iForm module are you using?
To confirm we look at the same code as you it might be helpful if you could copy in the two lines of code where the errors are being recorded.

Jim.

3

Re: Fatal error!

Hi Jim,

I'm using the latest download from http://www.indicia.org.uk/downloads (0.9.0) which I downloaded in mid-March(ish).

The code around the first error on data-entry-helper.php line 3312 (annotated in code) is:

/**
   * Implode the rows we are putting into the species checklist, with application of classes to image rows.
   */
  private static function species_checklist_implode_rows($rows, $imageRowIdxs) {
    $r = '';
    foreach ($rows as $idx => $row) {
      $class = in_array($idx, $imageRowIdxs) ? ' class="supplementary-row"' : '';
LINE 3312      $r .= "<tr$class>$row</tr>\n";
    }
    return $r;
  }

The second error I referred to was line 2242 (annotated in code) on report_helper.php along with a third error (
Invalid argument supplied for foreach() in .../records/sites/all/modules/iform/client_helpers/report_helper.php on line 2255.) and the code around these errors is:

// Are there any parameters embedded in the request data, e.g. after submitting the params form?
    $providedParams = $_REQUEST;
    // Is there a saved cookie containing previously used report parameters?
    if (isset($_COOKIE['providedParams']) && !empty($options['rememberParamsReportGroup'])) {
      $cookieData = json_decode($_COOKIE['providedParams'], true);
      // guard against a corrupt cookie
      if (!is_array($cookieData))
        $cookieData=array();
      if (!empty($cookieData[$options['rememberParamsReportGroup']]))
        $cookieParams = $cookieData[$options['rememberParamsReportGroup']];
        // We shouldn't use the cookie values to overwrite any parameters that are hidden in the form as this is confusing.
        $ignoreParamNames = array();
        foreach($options['paramsToExclude'] as $param)
          $ignoreParamNames[$options['reportGroup']."-$param"] = '';
        $cookieParams = array_diff_key($cookieParams, $ignoreParamNames);       
        $providedParams = array_merge(
          $cookieParams,
          $providedParams
LINE  2242      );
    }
    if (!empty($options['rememberParamsReportGroup'])) {
      // need to store the current set of saved params. These need to be merged into an array to go in
      // the single stored cookie with the array key being the rememberParamsReportGroup and the value being
      // an associative array of params.
      if (!isset($cookieData))
        $cookieData = array();
      $cookieData[$options['rememberParamsReportGroup']]=$providedParams;
      setcookie('providedParams', json_encode($cookieData));
    }
// Get the report group prefix required for each relevant parameter
    $paramKey = (isset($options['reportGroup']) ? $options['reportGroup'] : '').'-';
LINE 2255    foreach ($providedParams as $key=>$value) {
      if (substr($key, 0, strlen($paramKey))==$paramKey) {
        // We have found a parameter, so put it in the request to the report service
        $param = substr($key, strlen($paramKey));
        $params[$param]=$value;
      }
    }
    return $params;
  }


Many thanks,
Fiona

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar