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 Status CMS error

Go to End



Forum Moderator, 1391 Posts

27 November 2008 at 6:03am

Edited: 27/11/2008 6:03am

In the CMS, when clicking on a page that has a VirtualPage pointing to it, I get the following (popup) error:

ERROR [Notice]: Trying to get property of non-object
IN POST /admin/getitem?ID=11&ajax=1
Line 1117 in /undisclosedRoot/sapphire/core/model/SiteTree.php

  1108:		// Status / message
  1109:		// Create a status message for multiple parents
  1110:		if($this->ID && is_numeric($this->ID)) {
  1111:			$linkedPages = DataObject::get("VirtualPage", "CopyContentFromID = $this->ID");
  1112:		}
  1114:		if(isset($linkedPages)) {
  1115:			foreach($linkedPages as $linkedPage) {
  1116:				$parentPage = $linkedPage->Parent; 
 * 1117:				$parentPageTitle = $parentPage->Title;
  1119:				if($parentPage->ID) {
  1120:					$parentPageLinks[] = "<a class=\"cmsEditlink\"
  1121:				} else {
  1122:					$parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/$linkedPage->ID\">" .
  1123:						_t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') .

line 375 of CMSMain.php

line 740 of LeftAndMain.php

line 245 of LeftAndMain.php

line 164 of Controller.php

line 107 of RequestHandler.php

line 124 of Controller.php

line 246 of Director.php

line 106 of Director.php

line 88 of main.php


This will not happen when Page and its VirtualPage share the same parent, but in real life this will probably never be the case

Possible solution:
It seems that in line 1117 $parentPage->Title is not an object because in line 1116 the $linkedPage->Parent property does not exist. $linkedPage has access to a Parent() method however, that will return a proper parentobject. Possible replacement in SiteTree.php line 1116:

$parentPage = $linkedPage->Parent;

becomes (seems to be working):

$parentPage = $linkedPage->Parent();

Addition: status message
As far as I understand this code is meant to extend the status message, to tell the user that a page has VirtualPages pointing to it, and where they might be found. This statusmessage, that also holds information about the published state of a page, is never shown. This is not a bug, the code is commented, but gives an error when uncommented:

line 1273:
//new NamedLabelField("Status", $message, "pageStatusMessage", true)

I wanted to see what the message was all about so to show it in the reports section of the page I did the following. It works and didn't result in any errors as yet, but just as a temporary thing:

line 1253:

$tabReports = new TabSet('Reports',
	$tabBacklinks =new Tab('Backlinks',
		new LiteralField("Backlinks", $backlinks)


$tabReports = new TabSet('Reports',
	$tabBacklinks =new Tab('Backlinks',
		new LiteralField("Backlinks", $backlinks),
		new LiteralField("Status", $message)