kartik-v / yii2-tree-manager

An advanced tree management module using nested sets for Yii 2.
http://demos.krajee.com/tree-manager
Other
150 stars 107 forks source link

Syntax error on NodeController.php line 137 #154

Closed maz0717 closed 7 years ago

maz0717 commented 7 years ago

I just now updated to the latest version and get the following error when trying to view a node with the widget.

Exception 'ParseError' with message 'syntax error, unexpected quoted-string (T_CONSTANT_ENCAPSED_STRING)' 

in C:\Users\maz07\projects\gsys\vendor\kartik-v\yii2-tree-manager\controllers\NodeController.php:137

Stack trace:
#0 C:\Users\maz07\projects\gsys\vendor\composer\ClassLoader.php(301): Composer\Autoload\includeFile('C:\\Users\\maz07\\...')
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass('kartik\\tree\\con...')
#2 [internal function]: spl_autoload_call('kartik\\tree\\con...')
#3 C:\Users\maz07\projects\gsys\vendor\yiisoft\yii2\base\Module.php(564): class_exists('kartik\\tree\\con...')
#4 C:\Users\maz07\projects\gsys\vendor\yiisoft\yii2\base\Module.php(522): yii\base\Module->createControllerByID('node')
#5 C:\Users\maz07\projects\gsys\vendor\yiisoft\yii2\base\Module.php(514): yii\base\Module->createController('manage')
#6 C:\Users\maz07\projects\gsys\vendor\yiisoft\yii2\base\Module.php(448): yii\base\Module->createController('node/manage')
#7 C:\Users\maz07\projects\gsys\vendor\yiisoft\yii2\web\Application.php(100): yii\base\Module->runAction('treemanager/nod...', Array)
#8 C:\Users\maz07\projects\gsys\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#9 C:\Users\maz07\projects\gsys\backend\web\index.php(18): yii\base\Application->run()
#10 {main}
maz0717 commented 7 years ago

I removed the quotes on that line and it seems to work fine. Also actually does resolve issue #150.

maz0717 commented 7 years ago

One recommendation. My previous patch checked for the existence of session for the same purpose. Checking session would be a little more flexible because it would allow the widget to work without a session setup. Just no security. It would also be nice if the new security feature was configurable.

kartik-v commented 7 years ago

Yes - the session handling check can exist without testing the need for console apps.

On your next query, the module uses JavaScript based data handling and transfer of data for POST submissions... hence it will not be possible to implement this security for console apps (where you will not have a browser front end to parse javascript).

EDIT: If you need to use the security feature without sessions... then just set a value for Module::treeEncryptSalt yourself in the tree module settings... no sessions will be needed. This will be documented.