CRITICAL~Fatal error: Call to a member function getFileSetID() on null ~ MAJOR PROBLEM

Permalink
Hi

I was working on some file sets on one of my sites pages. I deleted a file set which has created the page to have fatal error and all content on side does not load. I had been working all day on page & had not run a backup of the website on server.
I have attempted ( versions ) restore with no luck.
The errors are extensive. For the purpose of readability I have created the KDE-PASTE BIN FILES displaying the errors as best as possible.
If anyone can basically tell me , if this is a fixable issue, or the data is gone.
Any help would be greatly !!! appreciated. I currently have to page not made public also, if that
KDE PASTES
http://goo.gl/X1Qa9T

http://goo.gl/tmkcK8


Thanks anyone that can review this and advise

Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

1 Attachment

melange
 
ramonleenders replied on at Permalink Reply
ramonleenders
You probably need to fix this file:

­packages/­documents/­blocks/­documents/­controller.php

Line 74 in specific I guess. Can you post these contents?
melange replied on at Permalink Reply 1 Attachment
melange
Hello,

Thanks for having a look. I made the page public, with the thinking you could see it for yourself.
However when I did that most of the errors/messages etc are not showing now. I then made it non-public, but it is the same, [ missing much of the errors shown in my first post ].
So I just made it public again, so basically what even you see, it what I can see.
I am not sure of that is of any help.

So basically now on the left spilt of the screen is showing
[0.
…/­src/­File/­FileList.php155]

On the right hand side of page;

/home/melangec/public_html/updates/concrete5.7.5.13_remote_updater/concrete/src/File/FileList.php

[$expr = $this->query->expr();
$this->query->andWhere(call_user_func_array(array($expr, 'orX'), $expressions));
$this->query->setParameter('keywords', '%' . $keywords . '%');
}

public function filterBySet($fs)
{
$table = 'fsf' . $fs->getFileSetID();
$this->query->leftJoin('f', 'FileSetFiles', $table, 'f.fID = ' . $table . '.fID');
$this->query->andWhere($table . '.fsID = :fsID' . $fs->getFileSetID());]

Starting at line 148 to 157

Any feedback is appreciated. Thanks
http://www.melangecounselling.com

Thanks
ramonleenders replied on at Permalink Reply
ramonleenders
If you update to version 8.x of concrete5, you can use the newer versions of PHP 7. Since you are on 5.7.5.13 - it should be fairly straightforward to go to the latest version without complications. Do take a look at the Add-Ons you have installed though, if they work with the latest versions too.

Make backups though before doing so. Once updated to 8.4.0, let them set it to PHP 7.2 (or 7.1) again. Then let us know if your issues are still the same.
melange replied on at Permalink Reply
melange
Hi,

Yes an upgrade would potentially be a fix. But there is a major issue with upgrading , to 8+
I have tried an upgrade in the past and it breaks the entire site. I have made posts a long time ago regarding this & have had some DEVS ( paid ) work on this upgrade issue, which resulted to time consuming with no solution. So I left it as is.
The page that got lost, I would be able to rebuild within a week but I really want to avoid all the work involved.
There is also an issue with some add-ons that wont work in v8+ which are ones that I do not want to not have.
I will need to have this upgrade issue fixed at some point.
melange replied on at Permalink Reply
melange
I do not understand it well enough, but what stands out to me at the moment is

Registered Handlers
0. Concrete\Core\Error\Handler\ErrorHandler
1. Concrete\Core\Error\Handler\JsonErrorHandler
2. Whoops\Handler\PlainTextHandler

/­src/­File/­FileList.php155

line 155 $table = 'fsf' . $fs->getFileSetID();
melange replied on at Permalink Reply
melange
I think I know why the code has changed from my first post. I also made a support request to the support team that host my site. This is what they said

[....Upon our investigation, we noticed that you are using Concrete 5 and PHP 7.1.


Please note that Concrete 5 and PHP 7.1 are not completely compatible with each other.


Additionally, we have changed your current PHP version to 5.6. We kindly ask you to check if the issue has been resolved. In case it persists, please update us on how to recreate it on our end, so that we may troubleshoot more accordingly. ]
mnakalay replied on at Permalink Reply
mnakalay
As @ramonleenders pointed out it seems the problem originates in ­packages/­documents/­blocks/­documents/­controller.php line 74.

In my experience, this kind of problem happens because a block or package uses file sets and then wants to filter by sets as this one does but never checks that the fileset actually exists.

Because the set was selected by the user, the dev gets sloppy and acts as if the sets will be available. But the set might have been deleted or maybe some permissions were set that make it unavailable in that context.

So then the package grabs the fileset, doesn't check that it actually got a fileset and then tries to do stuff with it and breaks.

What you should do is check if whatever fileset was selected for that package usage still exists and doesn't have permissions that prevent it from being used.

And checking that a fileset with the same name is there is not enough. If I create a fileset with a name, select that fileset in my package, then delete the fileset and create a new one with the same name, it will still break because it is not the same fileset.
liz2000 replied on at Permalink Reply
@mnakalay
Hi,

In my previous post I noted how my server team changed the php version. Well when they did this , this now changed the error messages and lines show etc on the fatal error page.
I have now made that page public,
https://www.melangecounselling.com/resources...
It now reads as

$expr = $this->query->expr();
$this->query->andWhere(call_user_func_array(array($expr, 'orX'), $expressions));
$this->query->setParameter('keywords', '%' . $keywords . '%');
}

public function filterBySet($fs)
{
$table = 'fsf' . $fs->getFileSetID();
$this->query->leftJoin('f', 'FileSetFiles', $table, 'f.fID = ' . $table . '.fID');
$this->query->andWhere($table . '.fsID = :fsID' . $fs->getFileSetID());


With 0.
…/­src/­File/­FileList.php155

On the left page of the screen.

I currently have the server team, running a back up, probably in hast
?
mnakalay replied on at Permalink Best Answer Reply
mnakalay
I just checked the package and I can confirm, it grabs the fileset and doesn't check it exists so most likely my theory is correct, your fileset was deleted or made unavailable.

Here's how to fix it:
in packages/documents/blocks/documents/controller.php, lines 72 to 76 you have the following code
$list = new FileList();
$set = FileSet::getByID($this->file_set);
$list->filterBySet($set);
$list->sortByFileSetDisplayOrder();
$this->set('files', $list->get());


Replace it all with this one
$set = FileSet::getByID($this->file_set);
if ($set && is_object($set)) {
    $list = new FileList();
    $list->filterBySet($set);
    $list->sortByFileSetDisplayOrder();
    $this->set('files', $list->get());
} else {
    $this->set('files', false);
}

What this will do is that it will stop it from throwing an error and make the block act as if there are no files selected if the fileset is nowhere to be found.

That will allow you to put the block in edit mode and select a different fileset that actually exists
liz2000 replied on at Permalink Reply
mnakalay

Thanks to very !!!! much . That code change has restored the page. There is one small glitch down the bottom of page a black bar that should not be there. But I had troubles with that prior to the file-sets being removed. I think I will have to be more caution and read up a little more about how the file-sets work. From memory the reason I removed the file-set was because, I could not see an obvious way to remove the current files ( PDF's ) that already existed, or replace etc. Thus I removed the whole set to start over, which hopefully is not what needs to happen.
Once again thanks for this, saved me a nightmare. !!!!!!!!!!!!!!!!!!!
liz2000 replied on at Permalink Reply
P.s

I just seen that I am commenting on as two users, I am both melange and Liz. I manage a site for a girl named , Liz , must have auto logged onto her account.

Thanks
Melange/AKA Liz
ramonleenders replied on at Permalink Reply
ramonleenders
The first reply you got (from me) asked for the contents of this file on that specific line. You posted stuff from other files haha. But glad mnakalay got it fixed for you!
mnakalay replied on at Permalink Reply
mnakalay
@ramonleenders I even quoted you on my first message but for some reason, I referred to you as @mesuva... ;-) Old age I guess

Anyway, we're out of the world cup and you're not so let me have this one. Oh and charm, of course, lots of it...
melange replied on at Permalink Reply 1 Attachment
melange
Hi again guys,

I have a follow up problem, I am guessing some how related / caused by the first problem, which was fixed by changing the code you provided.
The problem I touched on , in my last post. There has been created a black bar of colour that is now going across a section of the page. This black bar is on a part of the page outside of edit modes reach. e.g not in a block nor did I create it.
I had another one of these bars, before and it was in a block, I deleted that block and the bar went away.
But now another black bar is stretching across the page, and I have no idea firstly how to remove it, moreover this is twice these mystery bars have appeared on the page.
Can anyone shed some light on what's going on here.
?
Thanks a million !
https://www.melangecounselling.com/resources...
mnakalay replied on at Permalink Reply
mnakalay
I've never seen anything like that, so far it's totally eluded me
mnakalay replied on at Permalink Reply
mnakalay
OK I finally figured it out.
It seems you have applied some custom styling to the documents block on the page (the same one with the previous problem)

You have applied a shadow to it, that's that black bar. That's a shadow applied through the editing mode of the page so you can remove it directly when editing the page.

I noticed you are using my packages Buttons Factory Pro. How do you like it so far?
melange replied on at Permalink Reply
melange
Hi again,

Yes I see what your talking about with the shadow, I would have never worked that out, thanks once again ! Yes I have a couple of your add-on's . The buttons once I purchased a while back it's only now I have got around to using it. My job is not a web-developer & I have built this site myself minus the bit of help with things like this. But as someone who likes things to be nice and simple. Plus I like things to look neat and stylish. I can say I am totally impressed by the Factory Button's add-on, I totally love it. That's one of the reasons I was really annoyed when I lost the page with fatal error, as it took me a while getting so buttons so far the way I have them. I have not had any feedback yet, as I have not asked nor had the page public. But I really like how easy the add-on is to use. I think the effects look great. The ability to custom colour is good. I could not flaw it, so thanks.
melange replied on at Permalink Reply
melange
Sorry ramonleenders

It has been a wild ride !
Thank you both from saving me a weeks work of rebuild and teaching me a few things along the way. !!!

:)