Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

450 Posts in 122 Topics by 162 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » From 2.3.1 to 2.3.2 error on URLSegment

Ask questions about upgrading SilverStripe to the latest version.

Page: 1
Go to End
Author Topic: From 2.3.1 to 2.3.2 error on URLSegment 485 Views
  • biapar
    avatar
    Community Member
    137 posts

    From 2.3.1 to 2.3.2 error on URLSegment Link to this post

    After Upgrade from 2.3.1 to 2.3.2 I've error caused by this function in page.php of mysite:

    function GetLinkFromID($id = 1) {
    $do = DataObject::get_one('Page', '`SiteTree_Live`.ID = '.$id, true);
    return ($do->URLSegment); <-- here

    Error:
    [Notice] Trying to get property of non-object

  • Hamish
    avatar
    Community Member
    602 posts

    Re: From 2.3.1 to 2.3.2 error on URLSegment Link to this post

    Are you sure the upgrade caused it?

    The error means that there is no page record with the id. You should make the function safer by changing it to:

    function GetLinkFromID($id = 1) {
       $do = DataObject::get_one('Page', '`SiteTree_Live`.ID = '.$id, true);
       return $do ? $do->URLSegment : false;

    This way, if there is not page with that id, it will return false instead of trying to access a member of the nonexistent object.

  • biapar
    avatar
    Community Member
    137 posts

    Re: From 2.3.1 to 2.3.2 error on URLSegment Link to this post

    I've update SS production installation and there is page with ID = 1.
    Before updating, it work.

    Best Regards

  • Hamish
    avatar
    Community Member
    602 posts

    Re: From 2.3.1 to 2.3.2 error on URLSegment Link to this post

    Well this: "'`SiteTree_Live`.ID = '.$id" is not returning anything.

    Maybe the field SiteTree_Live changed?

  • ajshort
    avatar
    Community Member
    170 posts

    Re: From 2.3.1 to 2.3.2 error on URLSegment Link to this post

    You shouldn't be querying form the Live table - instead you should just do "`SiteTree`.`ID` = $ID" and your query will automatically be rewritten if you are getting data from the Live table.

    485 Views
Page: 1
Go to Top

Currently Online: Cristian, Achilles Interactive

Welcome to our latest member: J2-Paul

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

Comments on this website? Please give feedback.