Login | Forgot password | Register
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.
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 |
-
From 2.3.1 to 2.3.2 error on URLSegment

24 June 2009 at 1:31am
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); <-- hereError:
[Notice] Trying to get property of non-object -
Re: From 2.3.1 to 2.3.2 error on URLSegment

24 June 2009 at 9:01am
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.
-
Re: From 2.3.1 to 2.3.2 error on URLSegment

24 June 2009 at 8:55pm
I've update SS production installation and there is page with ID = 1.
Before updating, it work.Best Regards
-
Re: From 2.3.1 to 2.3.2 error on URLSegment

25 June 2009 at 9:20am
Well this: "'`SiteTree_Live`.ID = '.$id" is not returning anything.
Maybe the field SiteTree_Live changed?
-
Re: From 2.3.1 to 2.3.2 error on URLSegment

25 June 2009 at 9:22am
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


