- Posts: 17
COMMUNITY FORUM
K2 - White screen when saving item and php error
- D
- Topic Author
- Offline
- New Member
Less
More
11 years 11 months ago - 11 years 11 months ago #104758
by D
K2 - White screen when saving item and php error was created by D
I have a new, default, unmodified version of joomla 2.5 installed along with k2.
I'm using this as a demo site to teach myself k2.
Overall everything works great, but whenever I attempt to edit an item as a front end user, my screen goes white when I save the item and I get this php error:
Fatal error: Call to a member function getSearchValue() on a non-object in /homepages/7/d123968617/htdocs/public_html/clients/administrator/components/com_k2/models/item.php on line 721
FYI, I can edit and save an item as a back-end admin without any trouble.
I am developing locally using WAMP server on a windows vista machine.
I thought the problem might be with my local server setup so I uploaded everything to a hosting account at 1and1.com. I get the exact same error on the hosting server.
I've searched the forums and run google searches, but nothing I've found solves my problem.
Any help would really be appreciated.
I'm using this as a demo site to teach myself k2.
Overall everything works great, but whenever I attempt to edit an item as a front end user, my screen goes white when I save the item and I get this php error:
Fatal error: Call to a member function getSearchValue() on a non-object in /homepages/7/d123968617/htdocs/public_html/clients/administrator/components/com_k2/models/item.php on line 721
FYI, I can edit and save an item as a back-end admin without any trouble.
I am developing locally using WAMP server on a windows vista machine.
I thought the problem might be with my local server setup so I uploaded everything to a hosting account at 1and1.com. I get the exact same error on the hosting server.
I've searched the forums and run google searches, but nothing I've found solves my problem.
Any help would really be appreciated.
Please Log in or Create an account to join the conversation.
- D
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
11 years 11 months ago #104759
by D
Replied by D on topic Re: K2 - White screen when saving item and php error
I should also mention that I did a complete reinstall of both Joomla and K2 and that didn't solve the problem.
Please Log in or Create an account to join the conversation.
- D
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
11 years 11 months ago #104760
by D
Replied by D on topic Re: K2 - White screen when saving item and php error
Another note...this only happens if I attempt to edit then save an existing item.
I can create and save new items without a problem.
I can create and save new items without a problem.
Please Log in or Create an account to join the conversation.
- D
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
11 years 11 months ago #104761
by D
Replied by D on topic Re: K2 - White screen when saving item and php error
And more info...
I commented out the foreach block of code that begins on line 719 in
administrator > components > com_k2 > models > item.php
That solved my problem. But I don't know what the repercussions are for commenting out that code. It solved my immediate problem, but may create more.
Here's the code block as it is now, with my change:
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'JSON.php');
$json = new Services_JSON;
$row->extra_fields = $json->encode($objects);
$extraFieldModel = K2Model::getInstance('ExtraField', 'K2Model');
$row->extra_fields_search = '';
/* BEGIN MY EDIT HERE TO DISABLE THIS CODE
foreach ($objects as $object)
{
$row->extra_fields_search .= $extraFieldModel->getSearchValue($object->id, $object->value);
$row->extra_fields_search .= ' ';
}
*/ END MY EDIT HERE
//Tags
if ($use
I commented out the foreach block of code that begins on line 719 in
administrator > components > com_k2 > models > item.php
That solved my problem. But I don't know what the repercussions are for commenting out that code. It solved my immediate problem, but may create more.
Here's the code block as it is now, with my change:
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'JSON.php');
$json = new Services_JSON;
$row->extra_fields = $json->encode($objects);
$extraFieldModel = K2Model::getInstance('ExtraField', 'K2Model');
$row->extra_fields_search = '';
/* BEGIN MY EDIT HERE TO DISABLE THIS CODE
foreach ($objects as $object)
{
$row->extra_fields_search .= $extraFieldModel->getSearchValue($object->id, $object->value);
$row->extra_fields_search .= ' ';
}
*/ END MY EDIT HERE
//Tags
if ($use
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
11 years 11 months ago #104762
by william white
Replied by william white on topic Re: K2 - White screen when saving item and php error
You should not make changes to the file in the k2 core. All changes will be lost when you upgrade.
Try setting javascript in the k2 options layout tab at the top on your localhost version to load local copy and see if that may be the problem.
Try setting javascript in the k2 options layout tab at the top on your localhost version to load local copy and see if that may be the problem.
Please Log in or Create an account to join the conversation.
- D
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
11 years 11 months ago #104763
by D
Replied by D on topic Re: K2 - White screen when saving item and php error
Thanks William.
I am aware of the dangers of editing core files, but I need to put a band-aid on this so I could keep moving.
I tried your suggestion. In Parameters, I went to Layout & Views and change the jquery library handling from
"Load v1.8.x latest (remote copy)
To
"Load v1.8.2 (local copy)
I logged out a frontend user and logged back in.
No change. i still get the error.
I also tried changing "Backend jQuery & jWuery UI handling" to local, but that had no effect.
Any other ideas?
I am aware of the dangers of editing core files, but I need to put a band-aid on this so I could keep moving.
I tried your suggestion. In Parameters, I went to Layout & Views and change the jquery library handling from
"Load v1.8.x latest (remote copy)
To
"Load v1.8.2 (local copy)
I logged out a frontend user and logged back in.
No change. i still get the error.
I also tried changing "Backend jQuery & jWuery UI handling" to local, but that had no effect.
Any other ideas?
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
11 years 11 months ago #104764
by william white
Replied by william white on topic Re: K2 - White screen when saving item and php error
I tested and am getting the same error/s with both the menu item and the add item in this category link
The item is saved even though it throws the error
The item is saved even though it throws the error
Please Log in or Create an account to join the conversation.
- D
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
11 years 11 months ago #104765
by D
Replied by D on topic Re: K2 - White screen when saving item and php error
Yea, I've noticed the same thing. The data gets saved, even though the error occurs.
So are you saying that you just discovered this error or did you manipulate your set up in some way to duplicate the error?
Ultimately I'd like to get this resolved without the core hack that I did, but the system has to function, and appear to function properly, when I turn everything over to my client.
I guess the worst case scenario is to leave my core hack in place, make note of it, and hope the hack doesn't create other problems.
Do you think this is a bug? Should I report it as a bug?
So are you saying that you just discovered this error or did you manipulate your set up in some way to duplicate the error?
Ultimately I'd like to get this resolved without the core hack that I did, but the system has to function, and appear to function properly, when I turn everything over to my client.
I guess the worst case scenario is to leave my core hack in place, make note of it, and hope the hack doesn't create other problems.
Do you think this is a bug? Should I report it as a bug?
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
11 years 11 months ago #104766
by william white
Replied by william white on topic Re: K2 - White screen when saving item and php error
I tested in both 2.5 and 3.0 with k2 2.6.1
Got the same error
Applied the hack commenting out the foreach loop complely
and the error went away, but in j30 site the save and close button also went away requiring you to click the x to close the screen.
I think its a bug
Got the same error
Applied the hack commenting out the foreach loop complely
and the error went away, but in j30 site the save and close button also went away requiring you to click the x to close the screen.
I think its a bug
Please Log in or Create an account to join the conversation.
- Eduardo
- Offline
- Junior Member
Less
More
- Posts: 23
11 years 11 months ago #104767
by Eduardo
Replied by Eduardo on topic Re: K2 - White screen when saving item and php error
yep same here. I was talking about this in another topic:
getk2.org/community/New-to-K2-Ask-here-first/163350-260-update-Fatal-error--modelsitemphp
Can you please also check if your tags and extra fields are working? If they appear on the article you save... only new articles, not old ones.
Thanks
Can you please also check if your tags and extra fields are working? If they appear on the article you save... only new articles, not old ones.
Thanks
Please Log in or Create an account to join the conversation.