Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to assign property "elapsed" on null #18

Open
PixelFringant opened this issue Aug 6, 2023 · 17 comments
Open

Attempt to assign property "elapsed" on null #18

PixelFringant opened this issue Aug 6, 2023 · 17 comments

Comments

@PixelFringant
Copy link

Hi I have sole issues when i add a block in a course on Moodle 4.2. I have this error message « Attempt to assign property "elapsed" on null «  on an error page and i can open the course it become unusable. I must uninstall the plugin to regain access to the corrupted course. Any ideas to what’s happening ?

@dgarciatotem
Copy link

Hello, I have the very same issue, I also posted it on the plugin page in moodle let's hope they can provide a solution because this plugin was really useful.

Please if you find any workaround or fix let me know
Thanks!

@vfremaux
Copy link
Owner

Hi guys !
Could you force developer debugging to see the code line number where it is happenning ?
We at the moment are up to moodle 4.1, but should not be hard to fix that for 4.2...

@dgarciatotem
Copy link

Hello, the problem is that we are currently having a bunch of students connecting to our moodle platform and if debugging affects what they see on screen might be a bit of an issue.

One thing I checked is an "older" moodle isntalation that is running moodle 4.0.1 and is using an old version of the plugin "2017090600". In that moodle installation the plugin works, at least the course does not crash. However, when installing the very same version of the plugin into our newer moodle installation it does crash. This time instead of complaning about the "elapsed" variable it complains about the "startsession" or something like that.

I'm not sure what's going on because I just updated the plugin version into the older moodle installation and it still works.
However I see there is no "show details" link to see everything the users have done, how much time they've spent in moodle modules, etc

At this point I'm not sure what's causing the issue to be honest I thought I could reproduce the issue in an older installation of moodle 4.0 that we not use currently but looks like we cannot do that either.

Do you know by any chance if debug mode can be enable just for a particular course?
Thanks!

@dgarciatotem
Copy link

dgarciatotem commented Oct 30, 2023

Hello again, I was able to quickly enable the debugging to get the error and disable it. This is with the old version of the plugin 2017090600

Here's what it said:

Error
Exception - Attempt to assign property "sessionstart" on null
Debug info:
Error code: generalexceptionmessage
Stack trace:

line 388 of /blocks/use_stats/locallib.php: Error thrown
line 159 of /blocks/use_stats/block_use_stats.php: call to use_stats_aggregate_logs()
line 341 of /blocks/moodleblock.class.php: call to block_use_stats->get_content()
line 235 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
line 1222 of /lib/blocklib.php: call to block_base->get_content_for_output()
line 1280 of /lib/blocklib.php: call to block_manager->create_block_contents()
line 377 of /lib/blocklib.php: call to block_manager->ensure_content_created()
line 27 of /theme/lambda/layout/columns3.php: call to block_manager->region_has_content()
line 1477 of /lib/outputrenderers.php: call to include()
line 1403 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 238 of /course/view.php: call to core_renderer->header()

Here's what it says with the version for moodle 4.0:

Error
Exception - Attempt to assign property "elapsed" on null
Debug info:
Error code: generalexceptionmessage
Stack trace:

line 414 of /blocks/use_stats/locallib.php: Error thrown
line 161 of /blocks/use_stats/block_use_stats.php: call to use_stats_aggregate_logs()
line 341 of /blocks/moodleblock.class.php: call to block_use_stats->get_content()
line 235 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
line 1222 of /lib/blocklib.php: call to block_base->get_content_for_output()
line 1280 of /lib/blocklib.php: call to block_manager->create_block_contents()
line 377 of /lib/blocklib.php: call to block_manager->ensure_content_created()
line 27 of /theme/lambda/layout/columns3.php: call to block_manager->region_has_content()
line 1477 of /lib/outputrenderers.php: call to include()
line 1403 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 238 of /course/view.php: call to core_renderer->header()

I also see that when installing the plugin for the 4.0 it gives a warning about some english language values being null "Multiple English language files found [null]"

@dgarciatotem
Copy link

Hello again, were you able to check the trace I sent you? Also could you please fix it for the 4.0.X moodle version as currently we are not able to update to 4.2

Thanks!

@dgarciatotem
Copy link

Hello, did you find anything in the trace? We need to generate a few reports in Moodle and one of them is the detailed view of the use_stats block.

Thanks a lot for your help!
Kind regards,
Daniel García

@vfremaux
Copy link
Owner

Can you confirm me your php version ? Seems it's a behaviour change in php 8.0)
We will address it ASAP

@dgarciatotem
Copy link

Hello there, the exact php version for our moodle site is 8.0.30. Looks like that's the issue, the older installation we had was running version 7.4.33 and as soon as I switched to version 8 it crashed

@dgarciatotem
Copy link

Hello again, there's one thing I don't understand, I went back and use php 7.4.33 in our "newer" moodle installation. The course does not crash, however, the "show details" link does not appear, did you remove that from the plugin in newer versions?

Thanks in advance!

@ablancoTadel
Copy link

Hello, same issue here, after installing use_stats on a server running PHP 8.0.30 I keep getting the "Exception - Attempt to assign property "elapsed" on null" error message. Is there any fix or solution yet? Thanks

@vfremaux
Copy link
Owner

=> ablancoTadel : Can you pick the line number ? there should be some dispatched cases of php 8.0 fixes to add to code to pass new coding constraints.
=> dgarciatotem => Advanced functions are being passed to "Pro" version, to let us get minimal funding for development and maintenance. Use Stats is loosely used alone, but as data source of the "trainingsessions" report. It is moreover not a good solution to instanciate the block in the UI as it will compile logs each time it is dsplayed. Using with "trainingsessions" report let compilation occur only when needed for reporting.

@ablancoTadel
Copy link

Hello again, the error is thrown at line 423 of use_stats/locallib.php and at line 161 of use_stats/block_use_stats.php when calling to use_stats_aggregate_logs.

@ablancoTadel
Copy link

I fixed it by adding some lines of code, for example, from PHP 8.0 std class variables need to be initialized before accessing a property. Now the problem is that the use stats block along with trainingsessions are returning a lot more time than they should.

@vfremaux
Copy link
Owner

=> ablanco
One of the tuning of the use stats is the "implicit disconnection time credit" that will add standard time goodie to a user when it detects session has been gone without notice. This may create an artificial overhead on learning programs that have a lot of short working sessions. when this setting has an appropriate value, our experience is that time measurement is often realistic... but in some cases it's not. This is why we coupled another system called "Learningtimecheck" that allows combine real time measurement with standardized time credits to cover all metrics needs. Please ocntéct us at concact@activeprolearn.com for more information. We actually noticed that metrics are strongly depending on both learnng program architecture, and metrics consumers requirements, which leads to a non trivial setup.

@Ewa55
Copy link

Ewa55 commented Jan 26, 2024

Hi,
I have the same error for Moodle 4.3
(PHP 8.1.2)
Is there any fix or solution yet?
Thanks

Error
Exception - Attempt to assign property "elapsed" on null
Debug info:
Error code: generalexceptionmessage
Stack trace:
line 414 of /blocks/use_stats/locallib.php: Error thrown
line 161 of /blocks/use_stats/block_use_stats.php: call to use_stats_aggregate_logs()
line 337 of /blocks/moodleblock.class.php: call to block_use_stats->get_content()
line 231 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
line 1231 of /lib/blocklib.php: call to block_base->get_content_for_output()
line 1289 of /lib/blocklib.php: call to block_manager->create_block_contents()
line 377 of /lib/blocklib.php: call to block_manager->ensure_content_created()
line 4183 of /lib/outputrenderers.php: call to block_manager->region_has_content()
line 50 of /theme/boost/layout/drawers.php: call to core_renderer->blocks()
line 1490 of /lib/outputrenderers.php: call to include()
line 1416 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 116 of /index.php: call to core_renderer->header()

@ablancoTadel
Copy link

Hi, as far as I know there isn't any fix yet, I had to go back to php 7.4 because I'm currently using moodle 4.1 and this version doesn't require php 8, so my recomendation would be, at least for now, go back to Moodle 4.1.

@Ewa55
Copy link

Ewa55 commented Jan 26, 2024

thanks for your message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants