Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » version 2.3.0 rc1 - VirtualPage website error

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

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

Page: 1
Go to End
Author Topic: 3167 Views
  • martimiz
    Forum Moderator
    1088 Posts

    version 2.3.0 rc1 - VirtualPage website error Link to this post

    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)

  • chrschn
    Community Member
    7 Posts

    Re: version 2.3.0 rc1 - VirtualPage website error Link to this post

    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
    141 }
    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();

    Line 113 of Controller.php
    Line 19 of ModelAsController.php
    Line 257 of Director.php
    Line 106 of Director.php
    Line 111 of main.php

Page: 1
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.