Forum

Thread tagged as: Error, Blog, Redactor

Upgraded perch locally to 2.6.5 + blog app then added redactor editor, and creat...

Hi there Drew & Rachel,

Working on upgrading a site for a friend, and trying to both upgrade and add in the blog module, using a copy of perch and the database on OS X/MAMP locally.

I've Upgraded perch to 2.6.5 + added blog app, quill feather, and created a single post. (seemed to be fine). I then decided to try out the redactor editor (adding it per the install instructions), and now while the editor shows up OK, creating a blog post throws an error (blank screen).

blog post template changes are:

<perch:blog id="postDescHTML" type="textarea" label="Post" order="2" editor="redactor" html=“true” size="xxl autowidth" required="true" />

and

<perch:blog id="excerpt" type="textarea" label="Excerpt" editor="redactor" html=“true” order="3" suppress="true" size="s" />

PHP logs show:

[16-Sep-2014 23:01:31 UTC] PHP Fatal error:  Call to a member function index() on a non-object in /Users/alpower/Sites/fresh-direction-coaching/perch/addons/apps/perch_blog/modes/edit.pre.php on line 146

Any idea what else I can try to figure out what I've done wrong?

Many thanks! Al

P.S. my diagnostic output is as follows:

Diagnostics report
PERCH INFORMATION

Perch: 2.6.5
Production mode: Production (100)
Installed apps: content (2.6.5), assets (2.6.5), categories (2.6.5), perch_blog (4.5.1), perch_forms (1.5.1)
DB driver: PDO
DB tables: perch2_blog_authors, perch2_blog_categories, perch2_blog_comments, perch2_blog_index, perch2_blog_posts, perch2_blog_posts_to_categories, 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: 2
App runtimes:
<?php
    $apps_list = array(
        'content',
        'categories',
    'perch_forms',
    'perch_blog'
    );
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: markitup, redactor
H1: 421aa90e079fa326b6494f812ad13e79
L1: 70ad8350a997bdc2f0560c094217c769
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.2.11: done
latest_version: 2.5.3
headerScheme: light
dashboard: 1
content_hideNonEditableRegions: 0
update_2.6.5: done
on_sale_version: 2.6.5
perch_blog_post_url: /blog/post.php?s={postSlug}
perch_blog_update: 5.0
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: freshdirectionco
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: freshdirectionco
PERCH_DB_PREFIX: perch2_
PERCH_TZ: Europe/London
PERCH_EMAIL_FROM: redacted@redacted.co.uk
PERCH_EMAIL_FROM_NAME: redacted
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/alpower/Sites/fresh-direction-coaching/perch
PERCH_CORE: /Users/alpower/Sites/fresh-direction-coaching/perch/core
PERCH_RESFILEPATH: /Users/alpower/Sites/fresh-direction-coaching/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
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_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/alpower/Sites/fresh-direction-coaching/perch/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
HOSTING SETTINGS

PHP: 5.4.4
Zend: 2.4.0
OS: Darwin
SAPI: apache2handler
Safe mode: not detected
MySQL client: 5.5.25
MySQL server: 5.5.25
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, json, ldap, mbstring, mysql, mysqli, session, PDO, pdo_sqlite, standard, posix, Reflection, Phar, SimpleXML, soap, sockets, exif, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, apache2handler, imap, yaz, mcrypt, gettext, pgsql, pdo_pgsql, pdo_mysql, XCache
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 32M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
HTTP_HOST: localhost
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_COOKIE: cmsa=1; MintAcceptsCookies=1; PHPSESSID=765fe693331234e4351a8e88a04a37d1; SQLiteManager_currentLangue=2
HTTP_CONNECTION: keep-alive
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/7.0.6 Safari/537.78.2
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_REFERER: https://localhost/perch/core/settings/diagnostics/
HTTP_DNT: 1
PATH: /usr/bin:/bin:/usr/sbin:/sbin
SERVER_SOFTWARE: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8y DAV/2 PHP/5.4.4
SERVER_NAME: localhost
SERVER_ADDR: ::1
SERVER_PORT: 80
REMOTE_ADDR: ::1
DOCUMENT_ROOT: /Users/alpower/Sites/fresh-direction-coaching
SERVER_ADMIN: you@example.com
SCRIPT_FILENAME: /Users/alpower/Sites/fresh-direction-coaching/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 65382
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1410908972.14
REQUEST_TIME: 1410908972
argc: 1
Al Power

Al Power 0 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Those curly quotes around html="true" aren't in your actual template are they?

They were! not quite sure how they got there - some late night copying and pasting no doubt.

Having removed them, the problem still persists - is there some kind of template cache or similar I can clear?

I think I've solved the issue - was possibly a bug, as hunting down the error

[19-Sep-2014 19:51:11 UTC] PHP Fatal error:  Call to a member function index() on a non-object in /Users/alpower/Sites/fresh-direction-coaching/perch/addons/apps/perch_blog/modes/edit.pre.php on line 146

let me to line 146, and changing line 146 from

$Post->index($Template);

to

$NewPost->index($Template);

seemed to solve the issue, as we are in the else part of

 if (is_object($Post)) {...}
else {...}

so surely $Post is not an object, and thus cannot have the index method called on it?

I'm not a PHP programmer by trade, so this may well be incorrect - please do let me know I'm wrong!

Many thanks for your great support as always, Al

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you try with Perch 2.6.6?

just upgraded to 2.6.6, and I can confirm this was an issue with the 4.5.1 blog add on

addons/apps/perch_blog/modes/edit.pre.php on line 146

[19-Sep-2014 20:09:34 UTC] PHP Fatal error:  Call to a member function index() on a non-object in /Users/alpower/Sites/fresh-direction-coaching/perch/addons/apps/perch_blog/modes/edit.pre.php on line 146

however comparing the code of 4.5.2 and it looks like you fixed the offending line as I had suggested above, as dropping in the 4.5.2 version of the blog add-on does indeed fix the issue.

Thanks - you guys are one step ahead :) case closed! Al