Ticket #269 (new defect)

Opened 11 months ago

Last modified 9 months ago

Improper include of profile.config.php in profile module

Reported by: kevin Assigned to: rho
Priority: normal Milestone: 0.9.3
Component: core Version: 0.9.0
Severity: normal Keywords:
Cc: rho Patch Included: 0
Review Stage: accepted

Description

The line

$functionsearch:init?[] = $CFG->profilelocation . "profile.config.php";

in /mod/profile/lib.php does not work properly if some other module has already loaded this file (as does my prfext module, which runs first because it is lower alphabetically).

If profile.config.php has already been loaded, this second load in /mod/profile/lib.php puts duplicate entries in $dataprofile:details?.

This line should be replaced by

require_once($CFG->profilelocation . "profile.config.php");

There is a similar problem with the loading of invite.config.php in the invite module. This should also be loaded using require_once.

Change History

(follow-up: ↓ 2 ) 01/14/08 20:56:12 changed by kevin

Trac has mangled the square brackets. But I think that you see what I mean.

Why does does a bug tracker mangle perfectly ordinary PHP code? Does the bug tracker have a bug?

(in reply to: ↑ 1 ) 01/14/08 22:14:11 changed by renato

Replying to kevin:

Why does does a bug tracker mangle perfectly ordinary PHP code? Does the bug tracker have a bug?

You should put code between three { and three } to get code displayed correctly.

01/25/08 19:05:47 changed by ewout

  • owner changed from misja to ewout.
  • status changed from new to assigned.
  • haspatch changed.
  • review_stage set to accepted.

(follow-up: ↓ 5 ) 01/28/08 17:29:43 changed by ewout

  • cc set to rho.
  • owner changed from ewout to rho.
  • status changed from assigned to new.
  • milestone changed from 0.9.1 to 1.0.

Ok, I don't understand this. I accepted this because I thought it was trivial, but some voodoo is going on here. I just tried to use require_once in mod/profile/lib.php instead of $function['search:init'] = $CFG->profilelocation . "profile.config.php"; and now the interests field is shown twice.

Kevin, could you explain more and contribute a patch? Reassigning this to rho, who probably understands the "run" and $function mechanism better. Also, changing the milestone, since this seems to be a change which can have implications in other places.

(in reply to: ↑ 4 ) 02/01/08 17:38:44 changed by kevin

I have a temporary fix in place for my profile field search code (I delete the profile field data after I use it), so if require_once results in the file being included twice, there is indeed some deep voodoo going on and this will have to be fixed when we get rid of run it looks like.

03/13/08 11:26:31 changed by

  • milestone deleted.

Milestone 1.0 deleted

03/13/08 11:29:49 changed by misja

  • milestone set to 0.9.3.