Forum

Thread tagged as: Error, Blog

Blog Error

Hi there,

I'm having issues with the perch blog. I've had a project been sitting unfinished for over a year and have finally got back to work on it. I noticed the blog app was giving a server error once I tried to post something.

PHP Fatal error:  Call to a member function return_instance() on boolean in /Users/alex/Sites/visible-leaders/webroot/admin/core/lib/api/PerchAPI_Form.class.php on line 423

I realised I was running old versions of things:

Installed apps: content (2.8.8), assets (2.8.8), categories (2.8.8), perch_blog (4.5.2), perch_forms (1.8.3)

So I updated perch as well as the forms app. This didn't fix the issue and has now made it worse. Now the blog app doesn't open at all, and I get this error:

PHP Fatal error:  Call to a member function setSlug() on boolean in /Users/alex/Sites/visible-leaders/webroot/admin/addons/apps/perch_blog/modes/list.pre.php on line 37

Any ideas? Diagnostic report below.

Perch: 2.8.18
Production mode: Production (100)
Installed apps: content (2.8.18), assets (2.8.18), categories (2.8.18), perch_blog (5.0), perch_forms (1.8.3)
DB driver: PDO
DB tables: perch2_blog_authors, perch2_blog_comments, perch2_blog_index, perch2_blog_posts, perch2_blog_posts_to_tags, perch2_blog_sections, perch2_blog_tags, perch2_categories, perch2_category_counts, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_forms, perch2_forms_responses, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users
Users: 3
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_blog',
        'perch_forms'
    );
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: ckeditor, markitup
H1: a93b402cf3a86c96deb8dd71c37cc46d
L1: 4939173d03bc47e8a4fd16be30143a53
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.6.6: done
on_sale_version: 2.8.18
perch_blog_update: 5.0.1
perch_blog_post_url: /blog/post.php?s={postSlug}
headerScheme: light
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
perch_blog_comment_notify: 0
logoPath: /admin/resources/logo.png
update_2.7.2: done
update_2.8.8: done
latest_version: 2.8.15
update_2.8.18: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: visibleleaders_local
PERCH_DB_PREFIX: perch2_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: linda@blackdiamond.co.uk
PERCH_EMAIL_FROM_NAME: Linda Chan
PERCH_LOGINPATH: /admin
PERCH_PATH: /Users/alex/Sites/visible-leaders/webroot/admin
PERCH_CORE: /Users/alex/Sites/visible-leaders/webroot/admin/core
PERCH_RESFILEPATH: /Users/alex/Sites/visible-leaders/webroot/admin/resources
PERCH_RESPATH: /admin/resources
PERCH_HTML5: 1
PERCH_DEBUG:
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/alex/Sites/visible-leaders/webroot/admin/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
HOSTING SETTINGS

PHP: 5.6.2
Zend: 2.6.0
OS: Darwin
SAPI: apache2handler
Safe mode: not detected
MySQL client: 5.5.38
MySQL server: 5.5.38
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, mysql, mysqli, session, PDO, pdo_sqlite, standard, posix, Reflection, Phar, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, apache2handler, imap, gettext, mcrypt, yaz, pgsql, pdo_pgsql, pdo_mysql
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 2048M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
HTTP_HOST: localhost:5757
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_VIA: localhost:5757
HTTP_CONNECTION: keep-alive
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_COOKIE: _ga=GA1.1.276782021.1431284423; cmsa=1; PHPSESSID=19c9db2cae09082c0b7d3348b4a2655c
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36
HTTP_CACHE_CONTROL: max-age=0, no-cache, no-store, must-revalidate
HTTP_REFERER: https://localhost:5757/admin/core/settings/diagnostics/
PATH: /usr/bin:/bin:/usr/sbin:/sbin
SERVER_SOFTWARE: Apache
SERVER_NAME: visibleleaders
SERVER_ADDR: 127.0.0.1
SERVER_PORT: 8
REMOTE_ADDR: 127.0.0.1
DOCUMENT_ROOT: /Users/alex/Sites/visible-leaders/webroot
SERVER_ADMIN: you@example.com
SCRIPT_FILENAME: /Users/alex/Sites/visible-leaders/webroot/admin/core/settings/diagnostics/index.php
REMOTE_PORT: 52533
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /admin/core/settings/diagnostics/?extended
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
PHP_SELF: /admin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1449665367.46
REQUEST_TIME: 1449665367
argc: 1
Digital Team

Digital Team 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ddi the blog update run?

I didn't get any sort of notification like I often see with the core update, no...

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you try going to:

/admin/addons/apps/perch_blog/update

Unfortunately that still results in a server error:

PHP Fatal error:  Call to a member function setSlug() on boolean in /Users/alex/Sites/visible-leaders/webroot/admin/addons/apps/perch_blog/modes/list.pre.php on line 37
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you get redirected? You shouldn't be hitting list.pre.php at that point.

Yep, redirected back to /perch_blog with the same error. Just placed a fresh version of the blog app folder in there and it made no difference.

Drew McLellan

Drew McLellan 2638 points
Perch Support

How many blog posts do you have?

If I can pitch in here, I'm getting the same error after updating tot the latest version of blog. I had an earlier version but my client never created any posts, so there are still 0 posts.

I've added a categorie to check if that was an issue, but it wasn't. Am looking at the code right now, and this line seems to be the issue for now (line 34 in list.pre.php):

$Blog = $Blogs->find(1);

$Blog returns as false, on which can obviously not run setSlug();

$Blogs contains the proper object, but $Blogs->all(); also returns false;

Although the version number returned from $Settings->get('perch_blog_update')->val() was 5.0.1 I also tried running update, but that redirected me back to /perch/addons/apps/perch_blog/

I've narrowed it down the query getting the first blog post returning false. I've seen that activate.php should have created a table __PREFIX__blogs (in my case: perch2_blogs), which doesn't exist.

I currently have these blog related tables:

perch2_blog_authors perch2_blog_categories perch2_blog_comments perch2_blog_posts perch2_blog_posts_to_categories perch2_blog_posts_to_tags perch2_blog_sections perch2_blog_tags

According to activate.php I'm missing:

perch2_blog_index perch2_blogs

And the following tables would not have been created:

perch2_blog_categories perch2_blog_posts_to_categories

... which I'm assuming are replaced by the categories app from the Perch core?

I've tried creating the perch2_blogs by hand, although I expected this to present some new issues. First was the fact that although I did created the first post as it would have by activate.php. Even though the error mentioned by OP was solved, I couldn't manually create a new post in admin. I also noticed some menu items (like categories) missing in the admin when visiting /perch/addons/apps/perch_blog/, which I expected to see based on the installation video posted on the perch website.

It would seem activate() hasn't run because of the fact a previous blog app was installed?

That's it for now, hope this helps.Gonna stop digging for now...

I currently have no blog posts. I had a couple of tests ones in there from a while ago but removed them. Perhaps that is what started the issues...

Thanks for your input Martijn, I was thinking it would be something to do with missing tables. Glad to know I'm not on my own here! :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you have no posts, just drop the perch2_blog tables and let the app reinstall itself.

That fixed it! Thanks Drew.

Just so you know: When I add a post it was giving me a dropdown to choose the post template, between default and README.txt. Easily fixed by removing the README.txt file from the posts folder, but thought I should mention it.

Had the same problem after moving the site to a different directory (I'm new to Perch and my development environment at home needed some restructuring). Dropping every blog related table worked for me as well.