Jump to:

1156 Posts in 2568 Topics by 408 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » Upgrade problem : I can't handle sub-URLs of a xxxx object

Ask questions about upgrading SilverStripe to the latest version.

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

Page: 1 2
Go to End
Author Topic: 5323 Views
  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Upgrade problem : I can't handle sub-URLs of a xxxx object Link to this post

    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 ! ;-)

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Upgrade problem : I can't handle sub-URLs of a xxxx object Link to this post

    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 ....

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Upgrade problem : I can't handle sub-URLs of a xxxx object Link to this post

    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;
                   }

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: Upgrade problem : I can't handle sub-URLs of a xxxx object Link to this post

    I've the same error.

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

    Is your hack ss safe?

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Upgrade problem : I can't handle sub-URLs of a xxxx object Link to this post

    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 ...

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: Upgrade problem : I can't handle sub-URLs of a xxxx object Link to this post

    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

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Upgrade problem : I can't handle sub-URLs of a xxxx object Link to this post

    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.

  • biapar
    Avatar
    Forum Moderator
    435 Posts
    5323 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.