Unable to upgrade C5

Permalink 2 users found helpful
I have been trying to upgrade C5 to latest release for several months now. Unfortunately, every time I upgrade, all my web pages results in "white screen of death". The C5 console works fine after the update, but all web pages seem to produce nothing but white screen. I posted this issue to the C5 Forums (http://www.concrete5.org/community/forums/installation/white-screen-of-death-after-upgrade-to-5.6/#397476), but got no response. Since the C5 console is working, I am wondering if it is theme related. Your help to resolve would be much appreciated.

Error logs show the following...

PHP Fatal error: Call to a member function getBlockTypeHandle() on a non-object in /home2/marcusb1/public_html/updates/concrete5.6.0.2/concrete/core/libraries/block_view_template.php on line 41

jagdecht
 
bourbonn replied on at Permalink Reply
bourbonn
Do you know if the theme includes hardcoded blocks?

the code would look like:
$navBT = BlockType::getByHandle('autonav');

followed by a bunch of parameters and then:
$navBT->render('view');


or

$b = Block::getByName('my_survey_block');
$b->display();


Also, did you make sure all the blocks in use on your site are compatible with version 5.6? If you linked the site to the community, you can go in the dashboard and find the "Update Add-Ons" page. Or if there's not many of them, you could try uninstalling them before updating Concrete5
jagdecht replied on at Permalink Reply
jagdecht
Where would I search for this code snippet?

I am using Silence Theme which does come package with a few blocks, but I don't believe they are hard-coded (could be wrong).

I have many packages installed and my site is linked to the C5 community. All packages have been updated to the latest and greatest.

I am inclined to think it is theme related, but I am not getting any response from the developer of the theme. Many of my pages simply have a core content block. Even these simple pages will not function after upgrading the site to version 5.6. The common denominator between all the pages is the theme. The C5 Dashboard appears to work fine. You may also have noticed that the php error above actually existed before and after the C5 upgrade. However, the error message seems to refer to core C5 code and not theme code.

As you may already be able to tell, I am a novice with PHP. Your help is appreciated.
bourbonn replied on at Permalink Reply
bourbonn
There's one quick way to rule out your theme as the source of the problem without looking at the code, you could just change the theme to PlainYogurt in the dashboard.

If the site starts displaying, go back to the theme dashboard and try to apply it again.
mhawke replied on at Permalink Reply
mhawke
You made reference to 'Clipboard issues' in your other post. Somewhere else in the forums, someone mentioned that clearing the clipboard before upgrading helped them with that exact error messgae. I'm not sure if you tried that.
jagdecht replied on at Permalink Reply
jagdecht
I have ruled out clipboard, theme, and even the upgrade itself I believe. I have been able to duplicate the error by simply clearing the cache through C5 console. Attempting to access the website produces the error below.

[19-Nov-2012 22:08:10 America/Denver] PHP Fatal error: Call to a member function getBlockTypeHandle() on a non-object in /home2/marcusb1/public_html/updates/concrete5.5.2.1/concrete/libraries/block_view_template.php on line 41

I am certainly willing to pay for support on this issue. I am beginning to believe it is a core C5 issue or conflict with some add-on that I am missing.
webnut replied on at Permalink Reply
webnut
I realize I'm a n00b here, and I'm a little over my head but a quick thought.

if you have an XML declaration in the template in HTML change it to output using php.

ie.
print ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");


This fixed it for me.

I knew something was up when I looked at the source code and it was all there but rendering blank. So I started removing things.
mhawke replied on at Permalink Reply
mhawke
Try adding a line at line 41 in [root]/concrete/core/libraries/block_view_template.php

Right below 'public function __construct($obj) {' , add this line:

echo "** " . $obj->getBlockTypeHandle() . " **<br/>";


When you render a page the block's name will be rendered it might give you a clue as to what block is crashing the site.
jagdecht replied on at Permalink Reply
jagdecht
Followed your suggestion, but I'm not seeing anything different. Here are the steps I followed.

1) updated code as suggested
public function __construct($obj) {
      echo "** " . $obj->getBlockTypeHandle() . " **<br/>";
      $this->btHandle = $obj->getBlockTypeHandle();
      $this->obj = $obj;
      if ($obj instanceof Block) {
         $this->bFilename = $obj->getBlockFilename();
      }
      $this->computeView();
   }


2) Cleared cache through C5 console.
3) Attempted to access home page and returned only a white screen. Below is the error log (same as before).
[20-Nov-2012 09:26:40 America/Denver] PHP Fatal error: Call to a member function getBlockTypeHandle() on a non-object in /home2/marcusb1/public_html/updates/concrete5.5.2.1/concrete/libraries/block_view_template.php on line 41
mhawke replied on at Permalink Reply
mhawke
After it crashes, try right-click->View Source to see if it has spit out the name of the block it was looking for. Look for '** block name **' somewhere in the html source code. It should be very close to the beginning of the error message at the bottom of your source code.

Even if it spits out "** **" without a name in between , then that's helpful too. Let me know what you see.
jagdecht replied on at Permalink Reply
jagdecht
When I view source in IE, I only get page source info for error page.

http://marcusbaseball.com/

When I view source in Firefox, it is literally blank. Only a single line with no text at all.
mhawke replied on at Permalink Reply
mhawke
I might have mentioned this already but could you go to "Dashboard->System and Settings->Debug Level" (in the Environment section) and make sure it's set to 'Show errors on page'.
jagdecht replied on at Permalink Reply
jagdecht
Done. Now shows the same error I was including above.
mhawke replied on at Permalink Reply
mhawke
Yes I see that now. Thanks.

You say you've ruled out the clipboard. How did you rule that out?

The reason I'm asking is that the block_view_template function that's crashing is only called in 3 places. The first place is when it's looking at the concrete5 clipboard contents. Have you removed all items from your concrete5 clipboard (not your local computer's clipboard).
jagdecht replied on at Permalink Reply
jagdecht
Yes I had removed all items from the clipboard previously before upgrading or clearing cache. For posterity, I went ahead and did the following.

1) Restored web files from backup and confirmed site was functioning normally.
2) Put Home page in edit mode and confirmed that there are no items in the clipboard by attempting to "Add from Clipboard" to a new block.
3) Exited edit mode. Selected Clear Cache from C5 Console.
4) Attempted to return to site, but white page is only result again.
mhawke replied on at Permalink Reply
mhawke
Thanks. I don't mean to patronize when I ask silly questions about the clipboard. Just making sure we're all on the same page.

I'm now even more confused because the latest error message says you're on 5.5.2.1 not 5.6. Have a look in the middle of this error message and you'll see it's using the update called 5.5.2.1:

Fatal error: Call to a member function getBlockTypeHandle() on a non-object in /home2/marcusb1/public_html/updates/concrete5.5.2.1/concrete/libraries/block_view_template.php on line 41



In your last post, you mentioned that you 'restored web files from backup' but did you replace the database as well or do we have a hybrid system now.
jagdecht replied on at Permalink Reply
jagdecht
Through my research of this issue, I have found that the error actually exists prior to upgrade. However, the only way I have found to duplicate the error is to clear cache in 5.5.2.1. Otherwise the error doesn't present. When I attempt to upgrade, I get the same error with the only difference being the C5 version. I have been keeping the site active on version 5.5.2.1 for several months while I attempt to resolve this issue. You may notice in one of my follow-up posts in this thread, that I no longer believe this is related to upgrade or theme specifically. The problem is just more pervasive after upgrade and I cannot get past it.

What confuses me is why restoring web files only resolves the problem.
mhawke replied on at Permalink Reply
mhawke
I'm wondering if it's possibly an obsolete block that is on an old page version. I would run the "Delete old pages' job a bunch of times to see if you can get rid of old pages or go to 'Edit -> Versions' and delete all but the last few page versions.
jagdecht replied on at Permalink Reply
jagdecht
I thought of that too awhile back. I actually run this job frequently (at least once per week). I ran it this morning as well. A few weeks ago I actually deleted all but the current version of the Home page in attempt to resolve this issue.
adajad replied on at Permalink Reply
adajad
This sounds like a missing block or a poorly named block to me. Have you deleted a block manually (deleting the block/package folder) without deleting it through the dashboard? Do you have any custom blocks you have made yourself?
jagdecht replied on at Permalink Reply
jagdecht
I agree this sounds like a missing component. However, I have not deleted anything manually nor have I added any custom blocks.
adajad replied on at Permalink Reply
adajad
Could you supply your Environment Information from the dashboard (use intelligent search)?
jagdecht replied on at Permalink Reply
jagdecht
# concrete5 Version
5.5.2.1

# concrete5 Packages
Add Multiple Pages (2.1), Advanced Charts (1.0.3), Advanced Forms (1.8.1), Advanced Slider (1.2), Advertisement (1.7.7), Ajax Form (1.3), Automatic Email Obfuscator (1.2.3), Backgrounds Extended (1.1), Backstretch (1.2.1), coreCommerce - FedEx Shipping (1.5.6), Data Display (2.5.2), Document Library (1.6.3), Easy Accordion (1.1), Easy tabs (1.6.9), eCommerce (2.8.6), eCommerce - Local Pickup (1.1.1), eCommerce - UPS Shipping (1.5.3), eCommerce - USPS Shipping (1.4.2), Enhanced User List (1.5.4.1), Expand / Collapse (1.2.1), Iframe (1.0), Inline Login (1.2.2), Interactive Black (1.1), List files from set (1.0.2), Maintenance Editor (1.2), Mobile Theme Switcher (1.2), Popup Pro (1.6.1), Print my page (1.0.3), Pro Image (1.2), Pro News (3.0.5), Registrant Group (1.1), Silence Theme (1.3.6), SimpleFaq (2.0.0.2), Simple Image Gallery (1.1.3), Sliding Login Panel (1.1), Social Feed (1.3), Superfish (1.1.5), Theme Editor (2.0), The Void theme (1.0), tnSpacer (1.3).

# concrete5 Overrides
themes/silence, themes/simplicity, themes/terminal_velocity

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.3.18

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, ionCube Loader, json, ldap, libxml, mbstring, mcrypt, mhash, mysql, mysqli, odbc, openssl, pcntl, pcre, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, recode, Reflection, session, shmop, SimpleXML, soap, sockets, SourceGuardian, SPL, SQLite, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend Guard Loader, zip, zlib.

# PHP Settings
log_errors_max_len - 1024
max_execution_time - 5
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 10M
safe_mode - Off
safe_mode_exec_dir - <i>no value</i>
safe_mode_gid - Off
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 10M
ldap.max_links - Unlimited
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
odbc.max_links - Unlimited
odbc.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH
adajad replied on at Permalink Reply
adajad
You have two theme overrides not having corresponding packages. Are those your own? Are those installed still? If not, you can try to delete those overrides.

You should also, as mentioned before, restore both db and files when recovering from backup.

Have you checked if all your add-ons are 5.6 compatible?
jagdecht replied on at Permalink Reply
jagdecht
I did restore the database as well as web files when rolling back from 5.6 to 5.5.

The Simplicity and Terminal Velocity themes are no longer in use and have been un-installed. Is removing the overrides as simple as deleting the corresponding directories under {base}/themes through a file manager utility? I dont see any options in C5 Console. I expected these overrides would have been removed when I uninstalled the themes.
jagdecht replied on at Permalink Reply
jagdecht
I tried deleting the directories as mentioned in previous post, but after clearing cache, I am still getting the same error and white page.
adajad replied on at Permalink Reply
adajad
I took the liberty to check up on your add-ons and 'Advertisement' doesn't even exist in the marketplace any more. That one could have compatibility issues with 5.5.

Many of your add-ons have updates for 5.6 and some are soon to be end-of-life.
jagdecht replied on at Permalink Reply
jagdecht
"Advertisement" is actually listed in the Marketplace as Ad Server. I have all the latest updates for my add-ons installed.
jasteele12 replied on at Permalink Reply
jasteele12
At this point I would start looking at the database as suspect, since the error appears after clearing the cache.

Sometimes a quick look through a mysqldump can show some problems.

Here's a handy tool script that might help [ also here: http://pastebin.com/V5XbXGSG ] if you are logged in as super:
<?php /* tools/check-tables.php */
defined('C5_EXECUTE') or die(_('Access Denied'));
$u = new User();
if(!$u->isSuperUser()) { die(_('Access Denied.')); }   // cheap security
$db = Loader::db();      // load helper for database
$outp = '<h3>Optimize</h3>';
$tables = array();
$r = $db->query('SHOW TABLES FROM '. DB_DATABASE);
while ($row = $r->fetchRow()) {
   $tables[] = $row['Tables_in_'. DB_DATABASE];
}
sort($tables);
foreach($tables as $table) {
   $r = $db->query('CHECK TABLE '. $table);
   $row = $r->fetchRow();

Of course, I'd recommend you run this against a copy of the database, probably on a clean install if needed.

[ Sure would be nice if the code block respected blank lines... ]

John
mhawke replied on at Permalink Reply
mhawke
Thanks for this script John. What specifically should it show if there's a problem.
jasteele12 replied on at Permalink Reply
jasteele12
If it doesn't return OK for every table, there's a problem. Here's a good explanation of some of the MySQL command line tools (and how some use internal commands like CHECK TABLE, ANALYZE TABLE, etc.):

How to Check and Repair MySQL Tables Using Mysqlcheck
http://www.thegeekstuff.com/2011/12/mysqlcheck/...
jagdecht replied on at Permalink Reply
jagdecht
Ok, I am going to show my ignorance here. How do I use this code?
mhawke replied on at Permalink Reply 1 Attachment
mhawke
I added it as a 'single page' Here's how you do that.

1) Download the attached file.

2) Rename it check_tables.php

3) Upload it to your server at '[root]/single_pages'

4) Visit "Dashboard -> Single Pages"

5) Type 'check_table' into the box at the top and click 'Add'.

This will add a single page to your main menu so you might want to move it somewhere less conspicuous.
jasteele12 replied on at Permalink Reply
jasteele12
A lot less work than making it a single page (it is already a tools script), and you don't have to worry about your sitemap, navs or pagelists (although you could make it single_pages/dashboard/check_tables.php):

1. Copy the code to tools/check-tables.php (not! concrete/tools/...)

2. Go to your URL [ http://yoursite.com/tools/check-tables... ]

Notice there is no .php on the end of the URL
------

Again, this is just a quick test script. I still recommend doing a full mysqldump and taking a look at it visually...
jagdecht replied on at Permalink Reply
jagdecht
Used last method (no single page). Results returned "OK" for all tables.
http://marcusbaseball.com/tools/check_tables...
jasteele12 replied on at Permalink Reply
jasteele12
That's good, means the tables themselves are not damaged. Doesn't necessarily mean the data is complete. Try this now:

Add a line at line 41 in [root]/concrete/core/libraries/block_view_template.php

Right below 'public function __construct($obj) {' , add this line:
echo '<pre>$obj'. print_r($obj, 1). '</pre>';
// echo $obj->getBlockTypeHandle() will not work if $obj is not an object...


Let's find out what's actually getting passed in there.
mhawke replied on at Permalink Reply
mhawke
I tried doing that a couple of days ago on my site to see what I got and it killed my server. I had to get my host to kill the run-away processes.

UPDATE: And I just killed it again.
jagdecht replied on at Permalink Reply
jagdecht
Completed. Error messages doesn't appear to contain any additional information.
mhawke replied on at Permalink Reply
mhawke
What is displayed? I wasn't able to get mine to output anything cuz it locked my site up. I have a ton of packages installed and I'm sure the page output is huge, hence the lockup.
jagdecht replied on at Permalink Reply
jagdecht
Fatal error: Call to a member function getBlockTypeHandle() on a non-object in /home2/marcusb1/public_html/updates/concrete5.5.2.1/concrete/libraries/block_view_template.php on line 41

http://marcusbaseball.com/
mhawke replied on at Permalink Reply
mhawke
You weren't kidding. No additional help. Is your caching turned off because you should have gotten something out before it crashed.
jagdecht replied on at Permalink Reply
jagdecht
Basic Cache - enabled
Full Page - disabled
Cache Rebuild - automatic
mhawke replied on at Permalink Reply
mhawke
If you turn basic cache off, will your site run at all.
jagdecht replied on at Permalink Reply
jagdecht
Same error with Basic Cache disabled
mhawke replied on at Permalink Reply
mhawke
@John... you are far more advanced in this then I am so school me a bit here (I've been on the ASP side for 20 years). Don't you have to assign the output of the print_r function to a variable if you use 'print_r($obj, 1)' rather than just 'print_($obj)'

like so: '$output = print_r($obj, 1)'

and then echo $output?
jagdecht replied on at Permalink Reply
jagdecht
I found the problem finally after much trial and error...

I had pasted three content blocks from the clipboard in the default settings for the footer on three page types (Home, Full, and Left-Sidebar). These are the only page types I use on this website. When I removed these blocks from the footer, I was able to clear cache and upgrade C5 successfully.

Now I find that the Silence theme doesn't appear to be completely compatible with version 5.6 despite the suggestion of the developer.

I really appreciate the initial attention to this issue each of you were willing to give.

Happy Holidays
bourbonn replied on at Permalink Reply
bourbonn
Good to know.
Thanks for posting your findings here!
proverbed replied on at Permalink Reply
proverbed
Thanks for you findings