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.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

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

Upgrade problem : I can't handle sub-URLs of a xxxx object


Go to End


16 Posts   9611 Views

Avatar
Fuzz10

Community Member, 791 Posts

19 March 2009 at 12:02am

I'm trying to upgrade quite a large site from 2.2 to 2.3 , but it seems some changes have been made to the way Silverstripe handles URLS.

For SEO purposes , we fake URL nesting by putting keywords and categories in the URL for specific pages , e.g. ;

www.blabla.com/details/category1/category2/category3/category4?actual_id=92932

Silverstripe 2.2. just ignored the category1/category2/category3/category4 bit , and called the page with URL segment /details .. I could then take the "actual_id" value from the $_REQUEST array and fill the template with data accordingly.

This worked pretty well for us , but Silverstripe 2.3 refuses to play nice. It throws a :

" I can't handle sub-URLs of a xxxx object" error.

I cannot figure out how to get the site going while keeping the same URL layout.

Help ! ;-)

Avatar
Fuzz10

Community Member, 791 Posts

19 March 2009 at 1:16am

Update :

Did some diggin' , and the new

RequestHandler is the culprit...

More specific , the function handleRequest($request) , throws the error.....

Seems like it needs a little core-hack ....

Avatar
Fuzz10

Community Member, 791 Posts

19 March 2009 at 9:48pm

Okay...

To Force Silverstripe to ignore the rest of the URL, I ended up hacking the core.

in /sapphire/core/control/requesthandler.php

In the function HandleRequest() , I changed

// But if we have more content on the URL and we don't know what to do with it, return an error.
					} else {
						return $this->httpError(400, "I can't handle sub-URLs of a $this->class object.");
					}

in to

// But if we have more content on the URL and we don't know what to do with it, return an error.
					} else {
						return $result;
					}

Avatar
biapar

Forum Moderator, 435 Posts

8 July 2009 at 9:26pm

I've the same error.

"I can't handle sub-URLs of a CMSMain object."

Is your hack ss safe?

Avatar
Fuzz10

Community Member, 791 Posts

8 July 2009 at 9:33pm

Works for me .... It still discards the rest of the URL , but instead of throwing an error , it returns the needed result ...
I can't think of a serious security problem that might arise because of the change ...

Avatar
biapar

Forum Moderator, 435 Posts

8 July 2009 at 9:48pm

I've the problem with this:

$imagetable = new ComplexTableField(
$this,
'ImageAttachments', // relation name
'ImageAttachment', // object class
ImageAttachment::$field_names, // fields to show in table
ImageAttachment::getCMSFields_forPopup(), // form that pops up for edit
"ProductID = {$this->ID}", // a filter to only display item associated with this page
"Name ASC" // Sort by name
);

When I click on "Add Image" ( see this old post: http://www.silverstripe.org/archive/show/212710#post212710 )

I don't know to resolve.

Thanks

Avatar
Fuzz10

Community Member, 791 Posts

8 July 2009 at 9:54pm

That is a totally different situation than mine ..... I tried to manually add stuff to the URL and needed to prevent Silverstripe from throwing an error....

The error you are getting seems like a real one .... ;) When handling "many" relationships , I advise using UncleCheeses DOM module.

Avatar
biapar

Forum Moderator, 435 Posts

8 July 2009 at 9:59pm

How?

Go to Top