Forum

Thread tagged as: Problem, Error, Events

Events App admin - Fatal PHP error

I have the Events App installed. When I click on an individual event under 'Listing Events', I get a fatal PHP error.

PHP error:

Fatal error: Uncaught TypeError: Argument 2 passed to PerchFieldType::__construct() must be an instance of PerchXMLTag, instance of PerchRepeater given, called in /Users/matthewsanchez/Dropbox/narf-local/perch/core/lib/PerchFieldTypes.class.php on line 66 and defined in /Users/matthewsanchez/Dropbox/narf-local/perch/core/lib/PerchFieldType.class.php:71 Stack trace: #0 /Users/matthewsanchez/Dropbox/narf-local/perch/core/lib/PerchFieldTypes.class.php(66): PerchFieldType->__construct(Object(PerchAPI_Form), Object(PerchRepeater), 'content') #1 /Users/matthewsanchez/Dropbox/narf-local/perch/addons/apps/perch_events/modes/edit.pre.php(35): PerchFieldTypes::get('PerchRepeater', Object(PerchAPI_Form), Object(PerchRepeater), Array) #2 /Users/matthewsanchez/Dropbox/narf-local/perch/addons/apps/perch_events/edit/index.php(20): include('/Users/matthews...') #3 {main} thrown in /Users/matthewsanchez/Dropbox/narf-local/perch/core/lib/PerchFieldType.class.php on line 71

I think this started happening after I updated from Perch 2.8.24 to 2.8.28. The Events App was working fine before the update.

Diagnostics

HEALTH CHECK

Perch is up to date
PHP 7.0.0 is up to date
MySQL 5.5.42 is up to date
Image processing available
SUMMARY INFORMATION

Perch: 2.8.29, PHP: 7.0.0, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 7e72f9690b1498a1bead7a637c33a831c0d2f655 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_events (1.9.2), perch_forms (1.8.3), perch_gallery (2.8.6)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_events', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/matthewsanchez/Dropbox/narf-local/perch
PERCH_CORE: /Users/matthewsanchez/Dropbox/narf-local/perch/core
PERCH_RESFILEPATH: /Users/matthewsanchez/Dropbox/narf-local/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: localhost:8888
DOCUMENT_ROOT: /Users/matthewsanchez/Dropbox/narf-local
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Thanks, Matt

Matt Sanchez

Matt Sanchez 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Hi Matt

please post your page and template code for the event.

event.php:

<?php include('../perch/runtime.php'); ?>
<!DOCTYPE html>
<html lang="en">
  <head>
  <?php
   perch_layout('global.head', array(
      'title'=>'Events - NARF'
    ));
  ?>
  </head>
  <body>

    <?php perch_layout('global.header'); ?>

    <?php       
      perch_events_custom(array(
        'filter'   => 'eventSlug',
        'match'    => 'eq',
        'value'    => perch_get('s'),
        'template' => 'event_detail.html'
      ));
    ?>

  <?php perch_layout('global.footer'); ?>       

  <?php perch_layout('global.jsdefaults'); ?> 
</body>
</html>

event_detail.html

<!-- HERO -->
<section class="w-hero-event-detail" style="background-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(112,68,115,1)), url('<perch:events id="hero" type="hero" />');">
  <div class="l-hero-title">
    <h1 class="l-fair-title"><perch:events id="eventTitle" type="text" /></h1>
    <div class="l-fair-subtitle"><perch:events id="hero-subtitle" type="text" /></div>
  </div><!-- l-hero-title -->
</section><!-- w-hero-dog-fair -->

<!-- EVENT META -->
<section class="w-event-meta">
  <div class="l-event-meta">
    <div class="event-meta-date">Date: <perch:events id="eventDateTime" format="l, jS F Y" /></div>
    <div class="event-meta-time">Time: <perch:events id="eventDateTime" format="%l:%M %p" /> to <perch:events id="end-time" /></div>
    <div class="event-meta-location">Where: <a href="#directions"><perch:events id="general-location" type="text" /></a></div>
    <perch:if exists="frequency">
      <div class="event-meta-frequency">Frequency: <perch:events id="frequency" type="text" /></div>
    </perch:if>
  </div><!-- l-event-meta -->
</section><!-- w-event-meta -->

<!-- HIGHLIGHTS -->
<perch:if exists="highlights">
  <section class="w-event-highlights">
    <div class="l-text">
      <ul class="event-highlight-ul">
        <perch:repeater id="highlights">
          <li class="event-highlight-li">
            <perch:events id="highlight" />
          </li><!-- event-highlight-li -->
        </perch:repeater>
      </ul><!-- event-highlight-ul -->
    </div><!-- l-text -->
  </section><!-- w-event-highlights -->
</perch:if>

<!-- DESCRIPTION -->
<section class="w-event-desc">
  <div class="l-event-desc">
    <perch:events id="eventDescHTML" type="textarea" encode="false" />
  </div><!-- l-event-desc -->
</section><!-- w-event-desc -->

<!-- SCHEDULE -->
<perch:if exists="schedule">
  <section class="w-schedule">
    <h2>Schedule</h2>
    <div class="schedule">
      <dl>
        <perch:repeater id="schedule">
          <dt class="schedule-time"><perch:events id="schedule-term" type="text" /></dt>
          <dd class="schedule-activity"><perch:events id="schedule-definition" type="text" /></dd>
        </perch:repeater>
      </dl>
    </div><!-- schedule -->
  </section><!-- w-schedule -->
</perch:if>


<!-- IMAGE GALLERY -->
<perch:if exists="gallery-imgs">
  <section class="w-event-gallery">
    <h2 class="gallery-header"><perch:events id="gallery-header" type="text" /></h2>
    <div class="gallery">

      <div class="my-gallery" itemscope itemtype="https://schema.org/ImageGallery">
        <perch:repeater id="gallery-imgs">
          <figure class="gallery-fig" itemprop="associatedMedia" itemscope itemtype="https://schema.org/ImageObject">
            <a href="<perch:events id="gallery-img-full" />" itemprop="contentUrl" data-size="<perch:events id="data-size" type="text" />">
              <div class="fish">
                <img class="gallery-img-tn" src="<perch:events id="gallery-img-tn" />" itemprop="thumbnail" alt="Image description" />
              </div>

            </a>
            <figcaption class="gallery-caption" itemprop="caption description"><perch:events id="caption" type="text" /></figcaption>
          </figure>
        </perch:repeater>
      </div><!-- gallery -->

    </div><!-- l-gallery -->
  </section><!-- w-event-gallery -->
</perch:if>

<!-- DIRECTIONS -->
<section id="directions" class="w-directions">
  <div class="directions">
    <h2>Directions</h2>
    <section class="directions-address">
      <span class="directions-address-loc"><perch:events id="general-location" type="text" /></span><br />
      <span class="directions-address-street"><perch:events id="street" type="text" /></span><br />
      <span class="directions-address-city"><perch:events id="city-state" type="text" /></span>
    </section><!-- directions-address -->
    <section class="directions-iframe">
      <perch:events id="google-map" type="text" encode="false" />
    </section><!-- directions-iframe -->
  </div><!-- directions -->
</section><!-- w-directions -->

<!-- SPONSORS -->
<perch:if exists="sponsor-list">
  <section class="w-sponsors">
    <div class="sponsors">
      <h2 class="sponsors-header"><perch:events id="sponsors-header" type="text" /></h2>
      <p class="l-text"><perch:events id="sponsors-text" type="textarea" /></p>
      <div class="sponsor-list">
        <ul>
          <perch:repeater id="sponsor-list">
            <li class="sponsor-li">
              <perch:events id="sponsor-li" type="text" />
            </li><!-- sponsor-li -->
          </perch:repeater>
        </ul>
      </div><!-- sponsor-list -->
      <div class="l-text">
        <perch:events id="sponsors-cta" type="text" />
      </div><!-- l-text -->
    </div><!-- sponsors -->
  </section><!-- w-sponsors -->
</perch:if>

Since Perch doesn't support repeating events, I've been updating the event dates by hand every weekend (there's about 6 events that take place once a week.) This might not be the most efficient thing to do but it was all I could think of when I first set up the site.

Drew McLellan

Drew McLellan 2638 points
Perch Support

We'll take a look!

Since the PHP error mentioned something about PerchRepeater I removed all the <perch:repeater> tags from event.html. This solved the problem and I was able to access the admin panel for individual events afterwards.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Hi Dylan

please start a new thread if you need help rather than jumping onto someone elses, we can't help two people at once so you are likely to get missed!

When posting don't forget to include your Diagnostics Report and template or other relevant code.

Rachel

Rachel Andrew

Rachel Andrew 394 points
Perch Support

We also can't support anyone who has edited Core Perch code, so we would rather this was not posted to the forum. Please remember that we can only offer support if you have not edited Perch Core as once you have done that we are not supporting our code any more, and you are leaving yourself with a copy up Perch that can't easily be upgraded.