Forum

Thread tagged as: Problem, Error

Error on saving gallery item in : PerchAPI_Form.class.php on line 425

I'm using Perch with the gallery app, and have just come across an error that only appears to happen when saving text to be used as a caption within the gallery. As soon as I hit save, it re-directs to a blank white screen and the amend is not saved.

The error that's being thrown up the minute I click save is as follows:

[05-Feb-2016 16:47:09 UTC] PHP Fatal error: Call to a member function return_instance() on boolean in /Users/alexbennett/Desktop/Job Folder/xkengineering/test-website/test-site/admin/core/lib/api/PerchAPI_Form.class.php on line 425

The function it's referring to is this one:

public function receive_from_template_fields($Template, $previous_values, $Factory=false, $Item=false, $clear_post=true, $strip_static=true)
    {
        $tags   = $Template->find_all_tags_and_repeaters();

        if (is_object($Item)) {
            $Item->squirrel('itemID', '');
            $Item->squirrel('itemRowID', '');
        }else{
            $Item = $Factory->return_instance(array(
                    'itemID' => '',
                    'itemRowID' => '',
                ));
            $Item->set_null_id();
        }

Line 425 is where it says:

$Item = $Factory->return_instance(array(

Could this be an issue then with my template files? It's strange because this site has been up for 2-3 years, but my client just noticed this issue today, and I've found the same on my local copy (which is basically a copy of the live one).

Any help would be greatly appreciated!!

This is the diagnostic summary (I'm currently working on it locally with MAMP):

SUMMARY INFORMATION

Perch: 2.8.24, PHP: 5.6.10, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.24), assets (2.8.24), categories (2.8.24), perch_gallery (2.6), perch_sales (2.6), perch_news (3.6), perch_backup (1.2)
App runtimes: <?php include(PERCH_PATH.'/core/apps/content/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_gallery/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_sales/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_news/runtime.php'); ?>
PERCH_LOGINPATH: /admin
PERCH_PATH: /Users/alexbennett/Desktop/Job Folder/xkengineering/test-website/test-site/admin
PERCH_CORE: /Users/alexbennett/Desktop/Job Folder/xkengineering/test-website/test-site/admin/core
PERCH_RESFILEPATH: /Users/alexbennett/Desktop/Job Folder/xkengineering/test-website/test-site/admin/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: dc1fef2ad0fcd9f943c02ebb43d85dbc
Resource folder writeable: Yes
HTTP_HOST: xkengineering:8888
DOCUMENT_ROOT: /Users/alexbennett/Desktop/Job Folder/xkengineering/test-website/test-site
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
Alex Bennett

Alex Bennett 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like you're running an old version of Gallery. That's the first place to start.

My apologies - I've just downloaded and installed the latest version of the gallery app and this problem has been fixed! Will always make sure I have the latest version from now on! Thanks Drew