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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

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

version 2.3.0 rc1 - VirtualPage website error


Go to End


2 Posts   3858 Views

Avatar
martimiz

Forum Moderator, 1391 Posts

27 November 2008 at 5:22am

Edited: 27/11/2008 5:26am

Navigating to a virtual page on the website I get the following error:

[Notice] Trying to get property of non-object
GET /about-us-v/?stage=Stage
Line 151 in xxx/www/sapphire/core/model/VirtualPage.php

Possible solution:
In core/model/VirtualPage.php - method init():

if($this->record->ID){ ...

$this->record is as far as I see not a property of class VirtualPage. Possible replacement (I'm not sure, but this seems to do the job):

if($this->dataRecord->ID){ ...

Also in the init() method:

$this->VersionID = $this->failover->CopyContentFrom()->VersionID;

It looks like VersionID is not part of the properties returned by $this->failover->CopyContentFrom(). Possible replacement (seems to be working as well):

$this->VersionID = $this->failover->CopyContentFrom()->Version;

(question: it looks like $this->failover in this case refers to $this->dataRecord as well. Or am I mistaken - still trying to figure out the stucture of the code here)

Avatar
chrschn

Community Member, 7 Posts

16 December 2008 at 5:37am

I get the same error in 2.3.0 rc2:

[Notice] Trying to get property of non-object
GET /forschung-31/
Line 150 in /srv/www/ss_sec/silverstripe-v2.3.0-rc2/sapphire/core/model/VirtualPage.php
Source
141     }
142     
143     /**
144      * When the virtualpage is loaded, check to see if the versions are the same
145      * if not, reload the content.
146      * NOTE: Virtual page must have a container object of subclass of sitetree.
147      * We can't load the content without an ID or record to copy it from.
148      */
149     function init(){
150             if($this->record->ID){
151                     if($this->record->VersionID != $this->failover->CopyContentFrom()->Version){
152                             $this->reloadContent();
153                             $this->VersionID = $this->failover->CopyContentFrom()->VersionID;
154                     }
155             }
156             parent::init();

Trace
VirtualPage_Controller->init() 
 Line 113 of Controller.php
Controller->handleRequest(HTTPRequest) 
 Line 19 of ModelAsController.php
ModelAsController->handleRequest(HTTPRequest) 
 Line 257 of Director.php
Director::handleRequest(HTTPRequest,Session) 
 Line 106 of Director.php
Director::direct(forschung-31/) 
 Line 111 of main.php