Forum

Thread tagged as: Problem, Error, Addons

Blocks not loading with custom post types in blog

Hi Drew,

I think this is an older bug, but I have updated to v3.0.5 from a Perch 2 installation and it appears to still be affecting our clients. When using different post template with blocks you are unable to create new blocks until the post has been saved for the first time.

Following the add block link (?id=0&add-block=list_item) leads me to a PHP error:

Fatal error: Call to a member function to_array() on boolean in /Users/James/Repositories/Misha/Coli-Crocodile-Core-Site/build/admin/addons/apps/perch_blog/modes/edit.pre.php on line 23

I'm guessing that since the post hasn't been made yet, Perch cannot know to load the alternative post type and uses the default, blockless template and creates that error message. There are no console errors using Safari v10.1. Here a video of the non-action: Video

Diagnostics:

Perch: 3.0.5
Production mode: Development (10)
Installed apps: content (3.0.5), assets (3.0.5), categories (3.0.5), root_analytics (2.0.0), perch_blog (5.5.1), root_disqus (1.0.0), root_heartbeat (1.0.1)
DB driver: PDO
DB tables: perch2_blog_authors (2), perch2_blog_comments (0), perch2_blog_index (4471), perch2_blog_posts (146), perch2_blog_posts_to_tags (5), perch2_blog_sections (1), perch2_blog_tags (9), perch2_blogs (1), perch2_categories (7), perch2_category_counts (7), perch2_category_sets (1), perch2_content_index (748), perch2_content_items (66), perch2_content_regions (13), perch2_menu_items (12), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (4), perch2_pages (4), perch2_resource_log (1064), perch2_resource_tags (3058), perch2_resources (4258), perch2_resources_to_tags (65040), perch2_root_analytics_cache (4), perch2_scheduled_tasks (30), perch2_settings (34), perch2_user_passwords (2), perch2_user_privileges (40), perch2_user_role_privileges (25), perch2_user_roles (2), perch2_users (2)
Users: 2
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_blog',
        'root_analytics'
    );
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Scheduled tasks for root_analytics: root_analytics_fetch_comparisons (1440 mins)
Scheduled tasks for root_heartbeat: root_heartbeat_broadcast_status (1440 mins)
Editor plug-ins: markitup
H1: 9cd3756f4c13c8e2246771908bf99659
L1: 9806c53415b42db0c289fe14fc0a6986
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
headerColour: #0B6271
content_singlePageEdit: 1
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.34: done
latest_version:
headerScheme: dark
root_analytics_namespace: Root Analytics
root_analytics_credentials_json: xxx
root_analytics_time_period: 90
root_heartbeat_uid: xxx
root_heartbeat_signature: xxx
root_heartbeat_master_server: xxx
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
logoPath: /admin/resources/coli-avatar3x.png
perch_blog_update: 5.0.1
perch_blog_post_url: /krokoblog/post.php?s={postSlug}
helpURL: mailto:design@rootstudio.co.uk
perch_blog_site_name:
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_blog_comment_notify: 0
root_analytics_ua: UA-91095778-1
root_analytics_view_id: 139230720
root_disqus_site_name: rootstudio
on_sale_version:
update_3.0.5: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_TZ: Europe/Moscow
PERCH_LOGINPATH: /admin
PERCH_PATH: /Users/James/Repositories/Misha/Coli-Crocodile-Core-Site/build/admin
PERCH_CORE: /Users/James/Repositories/Misha/Coli-Crocodile-Core-Site/build/admin/core
PERCH_RESFILEPATH: /Users/James/Repositories/Misha/Coli-Crocodile-Core-Site/build/admin/resources
PERCH_RESPATH: /admin/resources
PERCH_HTML5: 1
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: colic_perch
PERCH_DB_PREFIX: perch2_
PERCH_EMAIL_FROM: james@rootstudio.co.uk
PERCH_EMAIL_FROM_NAME: Root Studio
PERCH_DEBUG: 1
PERCH_PRODUCTION_MODE: 10
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_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: 224e435c1fb02ad968ab
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/James/Repositories/Misha/Coli-Crocodile-Core-Site/build/admin/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_CUSTOM_EDITOR_CONFIGS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings

PHP: 5.6.28
Zend: 2.6.0
OS: Darwin
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
MySQL server: 5.6.34
Free disk space: 312.67 GB
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, session, standard, mysqlnd, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, mysql, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, cgi-fcgi, imap, gettext, mcrypt, pgsql, pdo_pgsql, imagick, igbinary, memcached, mhash, xdebug
GD: Yes
ImageMagick: Yes
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 128M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
PHP_FCGI_CHILDREN: 4
PWD: /Applications/MAMP/fcgi-bin
PHP_FCGI_MAX_REQUESTS: 200
__CF_USER_TEXT_ENCODING: 0x1F5:0x0:0x2
ORIG_SCRIPT_NAME: /fcgi-bin/php5.6.28.fcgi
ORIG_PATH_TRANSLATED: /Users/James/Repositories/Misha/Coli-Crocodile-Core-Site/build/admin/core/settings/diagnostics/index.php
ORIG_PATH_INFO: /admin/core/settings/diagnostics/index.php
ORIG_SCRIPT_FILENAME: /Applications/MAMP/fcgi-bin/php5.6.28.fcgi
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
REQUEST_URI: /admin/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.1
GATEWAY_INTERFACE: CGI/1.1
REDIRECT_URL: /admin/core/settings/diagnostics/index.php
REDIRECT_QUERY_STRING: extended
REMOTE_PORT: 55709
SCRIPT_FILENAME: /Users/James/Repositories/Misha/Coli-Crocodile-Core-Site/build/admin/core/settings/diagnostics/index.php
SERVER_ADMIN: you@example.com
DOCUMENT_ROOT: /Users/James/Repositories/Misha/Coli-Crocodile-Core-Site/build
REMOTE_ADDR: ::1
SERVER_PORT: 80
SERVER_ADDR: ::1
SERVER_NAME: colicrocodile.local
SERVER_SOFTWARE: Apache
PATH: /usr/bin:/bin:/usr/sbin:/sbin
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-gb
HTTP_REFERER: https://colicrocodile.local/admin/core/settings/diagnostics/
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: _ga=GA1.2.288956060.1481538580; _ym_uid=14857737041043745575; PHPSESSID=95a5a5abc1686c16073425443c5aebb7; cmsa=1; __insp_norec_sess=true; __insp_nv=false; __insp_slim=1492590457635; __insp_targlpt=U29jaWFsIENoYW5nZSBVSyA6OiBJbnNwaXJpbmcgY2hhbmdlIGluIHBlb3BsZSBhbmQgY29tbXVuaXRpZXM%3D; __insp_targlpu=aHR0cDovL3NvY2lhbC1jaGFuZ2UubG9jYWwv; __insp_wid=1206163498; __insp_uid=3505045805
HTTP_HOST: colicrocodile.local
REDIRECT_STATUS: 200
REDIRECT_HANDLER: php-fastcgi
FCGI_ROLE: RESPONDER
PHP_SELF: /admin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1496156297.84
REQUEST_TIME: 1496156297
argc: 1

The blog templates are split into a few partials which would be cumbersome to post here, I can send these privately in a ZIP if this would make debugging easier?

James Wigger

James Wigger 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

This isn't something we've looked at, so I wouldn't expect a change between 3.0.4 and 3.0.5.

Sorry, should have mentioned. This is a bug from 2.8.34.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Right, got it.