Environment:
- Chamilo: 2.0.2 (problem also observed before update)
- PHP: [8.3]
- Browser: Firefox
- Fresh browser session / private window tested
- Cache cleared, Service Worker removed
- Problem persists after upgrade to 2.0.2
Problem:
Opening a document inside a learning path causes the page to never finish loading. Browser console shows Vue runtime errors.
Observed errors:
TypeError: can't access property "roles", n.user is null
and after investigation:
TypeError: can't access property "@id", n.user is null
Stack traces involve:
/build/vue.[hash].js
/build/legacy_document.[hash].js
Reproduction steps:
- Log in as user
- Open a course
- Open a learning path
- Open a document item inside the learning path
- Browser stays loading indefinitely
- Vue errors appear in console
Findings:
/check-session returns HTTP 200.
Database integrity checks did not reveal missing users:
session_rel_user OK
session_rel_course_rel_user OK
- resource/user relations OK
The issue appears frontend-related.
Possible problematic code found in:
assets/vue/router/index.js
Example:
securityStore.user.roles.push("ROLE_CURRENT_COURSE_SESSION_TEACHER")
securityStore.user.roles.push("ROLE_CURRENT_COURSE_SESSION_STUDENT")
This code executes without verifying that:
securityStore.user !== null
Other parts of Chamilo already use safe access patterns:
securityStore.user?.roles || []
This suggests a race condition where router initialization runs before securityStore.user is available.
Potential fix:
Guard access to securityStore.user before reading roles or ["@id"].
Environment:
Problem:
Opening a document inside a learning path causes the page to never finish loading. Browser console shows Vue runtime errors.
Observed errors:
and after investigation:
Stack traces involve:
Reproduction steps:
Findings:
/check-sessionreturns HTTP 200.Database integrity checks did not reveal missing users:
session_rel_userOKsession_rel_course_rel_userOKThe issue appears frontend-related.
Possible problematic code found in:
Example:
This code executes without verifying that:
Other parts of Chamilo already use safe access patterns:
This suggests a race condition where router initialization runs before
securityStore.useris available.Potential fix:
Guard access to
securityStore.userbefore readingrolesor["@id"].