Attempting to Preview Deleted pages causes 403 Error #1014

stephenmcm opened this Issue May 7, 2014 · 2 comments

2 participants


This appears to be triggered by the preview pane attempting to load /new-page/?archiveDate=2014-05-07+13%3A02%3A07 which is causing a 403 error.

To reproduce:
Create a new page and 'Save Draft' or 'Save & Publish'
Delete the page
Click another page and 'Change View Mode' to 'Split Mode' or 'Preview Mode'
Click back to the deleted page

What happens:
The 'Split Mode' or 'Preview Mode' will display momentarily with the Previewed page rendering to a Log In prompt page with text similar to:

You must log in with your CMS password in order to view the draft or archived content. Click here to go back to the published site.

This then re-directs to /admin/pages/edit/show/-3211377 (the number changes, I haven't investigated why yet) which will render the Site tree side, the main blank and the 'Content', 'Settings' and 'History' tab. 'Content' and 'Settings' tabs display nothing but clicking 'History' will trigger a 'Internal Server Error' pop up.

What Should happen:
The 'Split Mode' or 'Preview Mode' displays the archived version requested.

SilverStripe 3.1.4 tested, reported on 3.1.x
Database: both MySQL and SQLite

Stack Trace
This is emitted when the 'History' tab is clicked after the above steps are taken.

PHP Fatal error:  Call to a member function isLatestVersion() on a non-object in /silverstripe/cms/code/controllers/CMSPageHistoryController.php on line 148
PHP Stack trace:
PHP   1. {main}() /silverstripe/framework/main.php:0
PHP   2. Director::direct() /silverstripe/framework/main.php:189
PHP   3. Director::handleRequest() /silverstripe/framework/control/Director.php:152
PHP   4. AdminRootController->handleRequest() /silverstripe/framework/control/Director.php:366
PHP   5. LeftAndMain->handleRequest() /silverstripe/framework/admin/code/AdminRootController.php:93
PHP   6. Controller->handleRequest() /silverstripe/framework/admin/code/LeftAndMain.php:441
PHP   7. RequestHandler->handleRequest() /silverstripe/framework/control/Controller.php:153
PHP   8. Controller->handleAction() /silverstripe/framework/control/RequestHandler.php:200
PHP   9. RequestHandler->handleAction() /silverstripe/framework/control/Controller.php:194
PHP  10. CMSPageHistoryController->show() /silverstripe/framework/control/RequestHandler.php:288
PHP  11. PjaxResponseNegotiator->respond() /silverstripe/cms/code/controllers/CMSPageHistoryController.php:57
PHP  12. call_user_func:{/silverstripe/framework/control/PjaxResponseNegotiator.php:89}() /silverstripe/framework/control/PjaxResponseNegotiator.php:89
PHP  13. LeftAndMain->{closure:/silverstripe/framework/admin/code/LeftAndMain.php:581-583}() /silverstripe/framework/control/PjaxResponseNegotiator.php:89
PHP  14. ViewableData->renderWith() /silverstripe/framework/admin/code/LeftAndMain.php:582
PHP  15. SSViewer->process() /silverstripe/framework/view/ViewableData.php:336
PHP  16. SSViewer->includeGeneratedTemplate() /silverstripe/framework/view/SSViewer.php:1064
PHP  17. include() /silverstripe/framework/view/SSViewer.php:997
PHP  18. SSViewer_DataPresenter->XML_val() /tmp/silverstripe-cache-home-stephen-Sites-cleanss/stephen/
PHP  19. SSViewer_DataPresenter->__call() /tmp/silverstripe-cache-home-stephen-Sites-cleanss/stephen/
PHP  20. SSViewer_Scope->__call() /silverstripe/framework/view/SSViewer.php:535
PHP  21. call_user_func_array:{/silverstripe/framework/view/SSViewer.php:179}() /silverstripe/framework/view/SSViewer.php:179
PHP  22. ViewableData->XML_val() /silverstripe/framework/view/SSViewer.php:179
PHP  23. ViewableData->obj() /silverstripe/framework/view/ViewableData.php:438
PHP  24. LeftAndMain->EditForm() /silverstripe/framework/view/ViewableData.php:363
PHP  25. CMSPageHistoryController->getEditForm() /silverstripe/framework/admin/code/LeftAndMain.php:1144
@tractorcow tractorcow added the 3.1 label May 7, 2014
@tractorcow tractorcow added this to the 3.1.6 milestone May 7, 2014

#1023 Fixes this 'crash' in this report but the preview page still displays the 'You must log in' content


I also considered that the canViewStage method should be changed, or another method added, to support archive (since this only supports stage, and it forces archived pages to substitute 'Stage' into this method instead), since this method fails if there is no stage record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment