No announcement yet.

Works in Development, but shows Parse error in Production

  • Filter
  • Time
  • Show
Clear All
new posts

  • Works in Development, but shows Parse error in Production

    I am absolutely baffled.
    I have some code that works perfectly in Development. The moment I posted it to Production I get an error

    Parse error: syntax error, unexpected '[' in /usr/local/apache/vhosts/ on line 2812

    I have checked line 2812 and nothing seems to be out of the norm.
    I thought maybe it has to do with my libraries so when I posted to production I made sure I included these, and updated.
    But still no joy.

    Below is the code. It's task is to convert TimeZones with an Error Routine. I have made the where the line of code 2812 points to BOLD. (strange though that it works in Development)

    $dt={updated_timestamp}; // '2014-11-25 18:32:19';
    $df1='Y-m-d H:i:s';
    $tz2=$timezone; // 'Africa/Johannesburg';
    $df2='d/m/Y H:i:s';

    //function date_convert($dt, $tz1, $df1, $tz2, $df2) {
    $res = '';
    if(!in_array($tz1, timezone_identifiers_list())) { // check source timezone
    trigger_error(__FUNCTION__ . ': Invalid source timezone ' . $tz1, E_USER_ERROR);
    } elseif(!in_array($tz2, timezone_identifiers_list())) { // check destination timezone
    trigger_error(__FUNCTION__ . ': Invalid destination timezone ' . $tz2, E_USER_ERROR);
    } else {
    // create DateTime object
    $d = DateTime::createFromFormat($df1, $dt, new DateTimeZone($tz1));
    // check source datetime
    if($d && DateTime::getLastErrors()["warning_count"] == 0 && DateTime::getLastErrors()["error_count"] == 0) {
    // convert timezone
    $d->setTimeZone(new DateTimeZone($tz2));
    // convert dateformat
    $res = $d->format($df2);
    } else {
    trigger_error(__FUNCTION__ . ': Invalid source datetime ' . $dt . ', ' . $df1, E_USER_ERROR);

  • #2
    Removed the condition, thus assumed it would work. Again it works perfectly in Development but not in Production
    When I run it in Production I get the following error.
    Fatal error: Call to undefined method Event_Manager_grid::NM_label_updated_timestamp() in /usr/local/apache/vhosts/ on line 1632

    I have highlighted in BOLD line 1632

    foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['Event_Manager']['field_order'] as $Cada_label)
    $NM_func_lab = "NM_label_" . $Cada_label;


    • #3
      Well it isnt line 1532 but the foreach ($..... line where the error occurs. ['Event_Manager'] seems to be wrong. Often you need to check the line before that has some code in it.