Wellrad and CMSimple_XH 1.6

A place to report and discuss bugs - please mention CMSimple-version, server, platform and browser version
Post Reply
milkodb
Posts: 47
Joined: Sun Jun 23, 2013 11:00 pm
Location: Italy

Wellrad and CMSimple_XH 1.6

Post by milkodb » Sat Jan 11, 2014 12:32 pm

Hello all,

I'm testing some plugins to update from CMSimple_XH 1.5.7 to 1.6 (my PHP version is 5.4.23).

The first serious problem is that Wellrad 1.2 has again problems with the system of purchase: in 1.5.7 everything works correctly, but in the new version the button that links to the shopping cart returns a white window or sometimes the message "error 404 - resource not found ". At this point, any connection to the pages of the site back to the white screen until you erase the browser cache.

I think I understand, reading old posts, which could be an issue regarding the use of words or syntax not anymore allowed.

I hope someone has a solution.

Thanks in advance
Last edited by milkodb on Tue Feb 18, 2014 6:48 pm, edited 3 times in total.
Milko

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Wellrad and CMSimple_XH 1.6

Post by cmb » Sat Jan 11, 2014 1:29 pm

milkodb wrote:I hope someone has a solution.
Yes. That problem is caused by a bug in CMSimple_XH 1.6 that was introduced with r1139. The solution is to exchange the order of two statements in cmsimple/cms.php, line 605ff. Currently it's:

Code: Select all

/**
 * The CRSF protection object.
 *
 * @global object $_XH_csrfProtection
 */
$_XH_csrfProtection = new XH_CSRFProtection();

/*
 * Include required_classes of all plugins.
 */
foreach (XH_plugins() as $plugin) {
    pluginFiles($plugin);
    if (is_readable($pth['file']['plugin_classes'])) {
        include_once $pth['file']['plugin_classes'];
    }
}
but it should be:

Code: Select all

/*
 * Include required_classes of all plugins.
 */
foreach (XH_plugins() as $plugin) {
    pluginFiles($plugin);
    if (is_readable($pth['file']['plugin_classes'])) {
        include_once $pth['file']['plugin_classes'];
    }
}

/**
 * The CRSF protection object.
 *
 * @global object $_XH_csrfProtection
 */
$_XH_csrfProtection = new XH_CSRFProtection();
Maybe a few other plugins are affected by this bug as well.

PS: JFTR: The problem is caused by starting the session before the required_classes of plugins have been loaded.
Last edited by cmb on Sat Jan 11, 2014 1:35 pm, edited 2 times in total.
Reason: added PS
Christoph M. Becker – Plugins for CMSimple_XH

milkodb
Posts: 47
Joined: Sun Jun 23, 2013 11:00 pm
Location: Italy

Re: Wellrad and CMSimple_XH 1.6

Post by milkodb » Sat Jan 11, 2014 1:58 pm

Thanks a lot Cmb,

I was trying to find the bug inside Wellard code... and it would have been a long night

;)

Bye
Milko

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Wellrad and CMSimple_XH 1.6

Post by cmb » Sat Jan 11, 2014 2:29 pm

milkodb wrote:I was trying to find the bug inside Wellard code... and it would have been a long night
It is often helpful to activate debug mode. In this case it reported:
Fatal error: WRS_Frontend_Controller::collectCartItems(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "WRS_Order" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in C:\xampp\htdocs\xh1.6\plugins\wellrad\classes\app\wrs_frontend_controller.php on line 138
The mentioned line accessed an object in the $_SESSION variable, from what it could be concluded that the session handling was not correct. Then it was sufficient to output the state of the $_SESSION variable (var_dump($_SESSION)) in several places to track down the bug.
Christoph M. Becker – Plugins for CMSimple_XH

milkodb
Posts: 47
Joined: Sun Jun 23, 2013 11:00 pm
Location: Italy

Re: Wellrad and CMSimple_XH 1.6

Post by milkodb » Sat Jan 11, 2014 2:41 pm

...flawless...


and everything is doing well.
Milko

Post Reply