donhinkelman / moodle-block_sharing_cart

Content sharing plug-in for Moodle LMS. Now at version 4.4, release 3 (actually this is for Moodle LMS version 4.3. Requires PHP 7.4.
7 stars 38 forks source link

Error when add a block to any course on Moodle 3.6.10 get the following exception in description #88

Closed ahmadsaadkhan closed 3 years ago

ahmadsaadkhan commented 3 years ago

Exception - syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE)

Debug info: Error code: generalexceptionmessage Stack trace: line 42 of \blocks\sharing_cart\classes\controller.php: ParseError thrown line ? of unknownfile: call to core_component::classloader() line 87 of \blocks\sharing_cart\block_sharing_cart.php: call to spl_autoload_call() line 321 of \blocks\moodleblock.class.php: call to block_sharing_cart->get_content() line 230 of \blocks\moodleblock.class.php: call to block_base->formatted_contents() line 1216 of \lib\blocklib.php: call to block_base->get_content_for_output() line 1268 of \lib\blocklib.php: call to block_manager->create_block_contents() line 374 of \lib\blocklib.php: call to block_manager->ensure_content_created() line 4022 of \lib\outputrenderers.php: call to block_manager->region_has_content() line 40 of \theme\moove\layout\course.php: call to core_renderer->blocks() line 1332 of \lib\outputrenderers.php: call to include() line 1262 of \lib\outputrenderers.php: call to core_renderer->render_page_layout() line 295 of \course\view.php: call to core_renderer->header()


Installed on Moodle 3.6.10 and get this error when I add a block of sharing cart to any course, don't get what is the issue maybe any class file is missing check the second line in Stack trace. Whereas same plugin worked in Moodle 3.8

vancouverdeveloper commented 3 years ago

I have the same problem just now with version 3.6.x after moodle recommended I upgrade it

donhinkelman commented 3 years ago

Hi Ahmad, as I told Larry, I am guessing there is a conflict with your Moodle 3.6 and the Sharing Cart version you have updated to. Larry mentionned that "Moodle recommended I upgrade it". However, I don't know how to change this message. Where did you get the message from? How can I fix it?

donhinkelman commented 3 years ago

Please update to the latest Sharing Cart 3.9, release 3 (2021031300) from the plugins database: https://moodle.org/plugins/pluginversions.php?plugin=block_sharing_cart Or download the latest version from here on Github, and tell me if that solves your problem.

ahmadsaadkhan commented 3 years ago

@donhinkelman I get it the issue was with my PHP version as the class constants CONST used in controller class don't work in previous version of PHP in 7.0 so I updated to latest version 7.1.3. Thanks

vancouverdeveloper commented 3 years ago

Interesting... my PHP version could be issue as well.. as I am running PHP Version 7.0.33 :-(

is this the cause of it? no constant class

ahmadsaadkhan commented 3 years ago

@vancouverdeveloper create a different test environment and check there if you can, but I am sure this is the issue same was with me, my php was 7.0 and get this error and after 7.1.33 it was resolved

vancouverdeveloper commented 3 years ago

I had to delete all the associated tables with sharing cart and that seem to have done the trick for the older version at least and still with php 7.0.33... I will upgrade it as I read in the docs, the class controller is only supported in version 7.1.x and above.

donhinkelman commented 3 years ago

Thanks, Larry, for the detailed info. Should I put a recommendation or requirement that the Sharing Cart needs PHP 7.1.x? Does that requirement apply to which versions of Sharing Cart?

vancouverdeveloper commented 3 years ago

yes... that would help... really help...

donhinkelman commented 3 years ago

Thanks Ahmad and vancouverdeveloper for discovering that PHP 7.1.x with class controller support is required for Sharing Cart operation, at least with recent SC versions. I will close this issue.