Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Error while adding new page

zmastezzmastez New
edited December 2013 in Vanilla 2.0 - 2.8

This is what i got. Please help.

**Fatal Error in PagesSettingsController.NewPage();**
Trying to get property of non-object
The error occurred on or near: /opt/lampp/htdocs/thanglong/applications/basicpages/controllers/class.pagessettingscontroller.php
204:          // Check if editing and if slug is same as one currently set in PageID.
205:          $ValidPageID = $SQL
206:             ->Select('p.UrlCode')
207:             ->From('Page p')
208:             ->Where('p.PageID', $Page->PageID)
209:             ->Get()->FirstRow();
210:          // Make sure that the UrlCode is unique among pages.
211:          $InvalidUrlCode = $SQL
212:             ->Select('p.PageID')

**Backtrace:**
[/opt/lampp/htdocs/thanglong/applications/basicpages/controllers/class.pagessettingscontroller.php:208] PHP::Gdn_ErrorHandler();
[/opt/lampp/htdocs/thanglong/applications/basicpages/controllers/class.pagessettingscontroller.php:208] PagesSettingsController->NewPage();
[/opt/lampp/htdocs/thanglong/library/core/class.dispatcher.php:322] PHP::call_user_func_array();
[/opt/lampp/htdocs/thanglong/index.php:53] Gdn_Dispatcher->Dispatch();

Variables in local scope:
[Page] NULL
[FormValues] array (
  'TransientKey' => 'RPSXX0NUPW5P',
  'hpt' => '',
  'UrlCodeIsDefined' => '0',
  'Name' => 'aaa',
  'UrlCode' => 'aaa',
  'Body' => 'aaaa',
  'Format' => 'Html',
  'SiteMenuLink' => '1',
  'HidePageFromURL' => '1',
  'Save' => 'Lưu',
  'RawBody' => false,
)

[SQL] array (
  'CaptureModifications' => false,
  'ClassName' => 'Gdn_MySQLDriver',
  'Database' => 'SECURITY',
  '_Order' => false,
)

**Additional information for support personnel:**

    Application: Vanilla
    Application Version: 2.0.18.9
    PHP Version: 5.3.8
    Operating System: Linux
    Server Software: Apache
    Referer: http://xxxxxxxxxxxx/thanglong/pagessettings/newpage
    User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
    Request Uri: /thanglong/pagessettings/newpage
    Controller: PagesSettingsController
    Method: NewPage

Comments

  • UnderDogUnderDog MVP
    edited December 2013

    @zmastez said:


    That means that in this code block :


    The $Page object does not exist. You need to open that file, go to line 208. Above that line the $Page object is created. Show us 5 lines above and under that line where the page object is created

    There was an error rendering this rich post.

  • ShadowdareShadowdare r_j MVP
    edited December 2013

    Welcome to the community.

    I just created a new page with Basic Pages 1.9 on a new, clean install of Vanilla 2.0.18.9 and the page was created successfully with no problems at all, but after looking at the code the way it is now, it's trying to retrieve an attribute from the $Page object, but it doesn't check if $Page was instantiated before query ($ValidPageID) is run at those lines of code. This query only needs to be run if a page is being edited.

    This wasn't a known issue before because others and I have not run into this error during our testing, but one possible reason for the error is that your PHP could be configured to run code in a strict manner, so instead of the minor error getting ignored, it just shows the error right away.

    I just uploaded Basic Pages 1.9.1 here: http://vanillaforums.org/addon/basicpages-application

    Please let me know if you can create a new page with 1.9.1.

    Add Pages to Vanilla with the Basic Pages app

  • This is how i solve the initial error:
    error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);

    But after that i got another eror when trying to edit or delete an existing page:

    Fatal Error in PagesSettingsController.AddSideMenu();
    Missing argument 1 for PagesSettingsController::AddSideMenu(), called in /opt/lampp/htdocs/thanglong/applications/basicpages/controllers/class.pagessettingscontroller.php on line 272 and defined
    The error occurred on or near: /opt/lampp/htdocs/thanglong/applications/basicpages/controllers/class.pagessettingscontroller.php
    28 * Configures navigation sidebar in Dashboard.
    29: *
    30: * @param $CurrentUrl; Path to current location in dashboard.
    31: */

    32: private function AddSideMenu($CurrentUrl) {
    33: // Only add to the assets if this is not a view-only request
    34: if($this->_DeliveryType == DELIVERY_TYPE_ALL) {
    35: $SideMenu = new SideMenuModule($this);
    36: $SideMenu->HtmlId = '';

    Backtrace:
    [/opt/lampp/htdocs/thanglong/applications/basicpages/controllers/class.pagessettingscontroller.php:32] PHP::Gdn_ErrorHandler();
    [/opt/lampp/htdocs/thanglong/applications/basicpages/controllers/class.pagessettingscontroller.php:272] PagesSettingsController->AddSideMenu();
    [/opt/lampp/htdocs/thanglong/applications/basicpages/controllers/class.pagessettingscontroller.php:294] PagesSettingsController->NewPage();
    [/opt/lampp/htdocs/thanglong/applications/basicpages/controllers/class.pagessettingscontroller.php:294] PagesSettingsController->EditPage();
    [/opt/lampp/htdocs/thanglong/library/core/class.dispatcher.php:322] PHP::call_user_func_array();
    [/opt/lampp/htdocs/thanglong/index.php:53] Gdn_Dispatcher->Dispatch();
    Variables in local scope:

    [this] array (
    'Uses' =>
    array (
    0 => 'PageModel',
    1 => 'Form',
    ),
    'Application' => 'BasicPages',
    'ApplicationFolder' => 'basicpages',
    'Assets' =>
    array (
    ),
    'ControllerFolder' => '',
    'ControllerName' => 'pagessettingscontroller',
    'CssClass' => '',
    'Data' =>
    array (
    'Title' => 'Edit Page',
    ),
    'Head' =>
    array (
    'AssetName' => '',
    'EventArguments' =>
    array (
    ),
    'Returns' =>
    array (
    ),
    'HandlerType' => 'NORMAL',
    ),
    'MasterView' => 'admin',
    'Menu' =>
    array (
    'Items' =>
    array (
    ),
    'HtmlId' => 'Menu',
    'CssClass' => NULL,
    'Sort' =>
    array (
    0 => 'Dashboard',
    1 => 'Discussions',
    2 => 'Questions',
    3 => 'Activity',
    4 => 'Applicants',
    5 => 'Conversations',
    6 => 'User',
    ),
    'AssetName' => '',
    'EventArguments' =>
    array (
    ),
    'Returns' =>
    array (
    ),
    'HandlerType' => 'NORMAL',
    ),
    'ModuleSortContainer' => '',
    'OriginalRequestMethod' => 'editpage',
    'RedirectUrl' => '',
    'RequestArgs' =>
    array (
    0 => '5',
    ),
    'RequestMethod' => 'editpage',
    'Request' =>
    array (
    ),
    'SelfUrl' => 'pagessettings/editpage/5',
    'StatusMessage' => '',
    'SyndicationMethod' => 'NONE',
    'Theme' => 'KhiCong',
    'ThemeOptions' =>
    array (
    ),
    'View' => 'newpage',
    'EventArguments' =>
    array (
    ),
    'Returns' =>
    array (
    ),
    'HandlerType' => 'NORMAL',
    'PageModel' =>
    array (
    'RouteExpressionSuffix' => '(.*)',
    'RouteTargetSuffix' => '$1',
    'Data' => NULL,
    'Database' => 'SECURITY',
    'DateInserted' => 'DateInserted',
    'DateUpdated' => 'DateUpdated',
    'InsertUserID' => 'InsertUserID',
    'Name' => 'Page',
    'PrimaryKey' => 'id',
    'Schema' => NULL,
    'SQL' =>
    array (
    'CaptureModifications' => false,
    'ClassName' => 'Gdn_MySQLDriver',
    'Database' => 'SECURITY',
    '_Order' => false,
    ),
    'UpdateUserID' => 'UpdateUserID',
    'Validation' =>
    array (
    ),
    'EventArguments' =>
    array (
    ),
    'Returns' =>
    array (
    ),
    'HandlerType' => 'NORMAL',
    ),
    'Form' =>
    array (
    'Action' => '',
    'ErrorClass' => 'Error',
    'HiddenInputs' =>
    array (
    'UrlCodeIsDefined' => '1',
    ),
    'IDPrefix' => 'Form_',
    'InputPrefix' => 'Page',
    'Method' => 'post',
    'EventArguments' =>
    array (
    ),
    'Returns' =>
    array (
    ),
    'HandlerType' => 'NORMAL',
    ),
    'EnabledApplications' =>
    array (
    0 => 'dashboard',
    1 => 'vanilla',
    2 => 'basicpages',
    ),
    )

    Need Help?

    If you are a user of this website, you can report this message to a website administrator.

    If you are an administrator of this website, you can get help at the Vanilla Community Forums.
    Additional information for support personnel:

    Application: Vanilla
    Application Version: **2.0.18.10**
    PHP Version: 5.3.8
    Operating System: Linux
    Server Software: Apache
    Referer: http://xxxxxxxxxxxxxxxxx/thanglong/pagessettings/allpages
    User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
    Request Uri: /thanglong/pagessettings/editpage/5
    Controller: PagesSettingsController
    Method: AddSideMenu
    
  • This is on Basic Pages 1.9.1 and Vanilla 2.0.18.10

  • ShadowdareShadowdare r_j MVP
    edited March 2014

    I uploaded Basic Pages 1.9.2 with the fix for the error you posted. Thanks for reporting the bug, @zmastez!

    Add Pages to Vanilla with the Basic Pages app

  • Confirm that this solve the issue. Thank you so much.

Sign In or Register to comment.