Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Selecting Image Folder gives "Error getting files"?


Go to End


19 Posts   7556 Views

Avatar
RichardMortimer

Community Member, 15 Posts

30 September 2009 at 2:18pm

Hi,

We have had SS2.3.3 installed for some time now, and the lady who edits the content called me this morning with this error. Whenever she selects to insert an image, and then selects the folder she has the image in, the CMS gives an error "Error getting files" directly underneath the editing pane; in red, with an exclamation mark. She cannot see any images and can't insert anything.

I can reproduce this error, but can't see any reason why it is happening, there are no errors in the apache log files (either the normal log or the error log).

I've checked file permissions (we're running WAMP), and all users on this machine have access to this folder.

I've tried removing the _resampled directory as was suggested elsewhere on this forum, but this didn't solve the issue.

A couple of days ago, this was working fine, there have been no changes external to the CMS that I am aware of (eg no JS/Template/CSS changes), and I'm at a loss to explain or even diagnose this problem.

Anyone have any suggestions/ideas?

Thanks

Richard

Avatar
dalesaurus

Community Member, 283 Posts

30 September 2009 at 4:21pm

DEFINITELY get yourself Firebug (you are using firefox, right?) and turn on all panels. Then replicate the error and watch the Net > XHR tab. This will dump the content/headers from the AJAX request for your debugging pleasure.

http://getfirebug.com/

Avatar
RichardMortimer

Community Member, 15 Posts

1 October 2009 at 1:02pm

Thanks for that - I get this error:

GET ImageForm?action_callfieldmethod=1&fieldName=Image&ajax=1&methodName=getimages&folderID=150&searchText=undefined&cacheKillerDate=1254355002072&cacheKillerRand=2865
http://XXX.XXX.XXX.XXX/admin/EditorToolbar/ImageForm?action_callfieldmethod=1&fieldName=Image&ajax=1&methodName=getimages&folderID=150&searchText=undefined&cacheKillerDate=1254355002072&cacheKillerRand=2865
  
500 Warning: "Parameter 1 to Hierarchy::loadDescendantIDListInto() expected to be a reference, value given" at line 525 of C:\wamp\www\sapphire\core\Object.php

I changed our IP address to XXX, etc. I'm going to start having a poke around, but if anyone has any other clues, they would be appreciated.

Cheers

Richard

Avatar
dalesaurus

Community Member, 283 Posts

2 October 2009 at 5:12am

Ah hah! This is PHP 5.3's stricter handling of objects-by-reference. The offending code is below, your options are:

1. This is a bug for 5.3 compatibility, you should log it in http://open.silverstripe.com

2a. You may be able to bypass it by reducing your Error Reporting to E_ERROR
-or-
2b. Downgrade to 5.2.9, the folks over at Joomla have written up a nice WAMP instruction guide:
http://forum.joomla.org/viewtopic.php?p=1871648#p1871648

The following is called by the ThumbnailStripField used in the CMS for Image Insertion.

/sapphire/core/model/Hierarchy.php Line 340

	public function getDescendantIDList() {
		$idList = array();
		$this->loadDescendantIDListInto($idList);
		return $idList;
	}
	
	/**
	 * Get a list of this DataObject's and all it's descendants ID, and put it in $idList.
	 * @var array $idList Array to put results in.
	 */
	public function loadDescendantIDListInto(&$idList) {
		if($children = $this->AllChildren()) {
			foreach($children as $child) {
				if(in_array($child->ID, $idList)) {
					continue;
				}
				$idList[] = $child->ID;
				$child->loadDescendantIDListInto($idList);
			}
		}
	}

Avatar
RichardMortimer

Community Member, 15 Posts

2 October 2009 at 3:00pm


Thanks for that - it sounds like it is a 'known' bug?

I found late yesterday that these lines were causing the problem, located in the mysite/_config.php file:

Director::set_environment_type("dev");
if(Director::isLive()) Debug::send_errors_to("EMAIL_ADDRESS@LOCATION");

(note: email address was changed to stop spam!)

I believe somewhere a while ago, someone suggested turning this on for debugging, and, ironically, it caused this bug.

Cheers

Richard

Avatar
vancouverWill

Community Member, 121 Posts

4 October 2009 at 12:37am

Thanks. That was exactly the problem I was having, caused a headache for a while trying to figure it out then went to the forums and the answer was right there. Shouldn't this be a bug? The only line I had was

Director::set_environment_type("dev");

and this caused the "file and images" section and the image insert feature to basically be useless.

Anyway much thanks to you guys and good old firebug.

Avatar
RichardMortimer

Community Member, 15 Posts

5 October 2009 at 10:10am

Whilst it makes the default preview fairly useless, I found the search preview still worked, so I did a search on the letter 'g', which found everything with Gif, jpG or pnG in the name - that covered most image files (and if you could remember the name of the file, that was even better!!) :)

Cheers

Richard

Avatar
Sunnybex

Community Member, 39 Posts

13 November 2009 at 2:47am

jep, downgrading to 5.2.9 definetely works, after changing the php- version via the wamp-server-icon...
Nevertheles, this bug should be fixed.
b.r.
Bex

Go to Top