diff options
author | Malf Furious <m@lfurio.us> | 2018-09-26 16:16:32 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2018-09-26 16:16:32 -0400 |
commit | 1f36f47e968f2249502f7649594f88500209c6e3 (patch) | |
tree | 8f0d2e690231aaf2d15a772b6a089cea10470546 /app | |
parent | fbb9bcb787287597a0666b9313a4754ed03d242b (diff) | |
download | scrott-1f36f47e968f2249502f7649594f88500209c6e3.tar.gz scrott-1f36f47e968f2249502f7649594f88500209c6e3.zip |
df: Address class cyclic require loop
A dependency loop exists between class/agent.class.php and
class/group.class.php. Due to specific `require_once` ordering within
the app, this problem was not surfaced until now.
These two classes depend on eachother, but strictly speaking, the
interpreter needs to read the agent class first. This is because group
directly inherits from agent. It is only one of agent's functions which
references group. Group has a `require_once "class/agent.class.php"` at
its top, so requiring group first will read both classes, in the correct
order, and provide their definition's for the remainder of the runtime.
The main entry-point, index.php, did not have this problem since it was
explicitly requiring group itself (it actually needs group, though).
The df.php entry-point wasn't and was relying on requires in the class/
directory to resolve this issue. In a more-sane language, I could patch
this more easily directly in the affected file; rather, this patch
updates the df entry-point to explicitly require group, solving the
issue up front.
Hopefully this can be fleshed out in the future as it should not consern
the entry-points that this specific evaluation order needs to take
place.
The third and final entry-point, cron.php, is already fine at the time
of this commit. Its require tree is much simplier, and does not even
include either of the affected classes.
Diffstat (limited to '')
-rw-r--r-- | app/df.php | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -13,6 +13,7 @@ */ require_once "class/user.class.php"; +require_once "class/group.class.php"; require_once "class/mesg.class.php"; /* |