Menu

#70 The facility maintenance module MOD function doesn't work

open
nobody
None
5
2004-12-22
2004-12-22
GATMAN
No

If I add a Facility via main-> Support Data, clicking
MOD to change it doesn't work.

I think I have located the problem.

At line 113 in facility.db.module.php @ 0.7.1

foreach ($this->variables AS $k => $v) { global ${$k}; }

As I'm new to PHP, I was puzzled by the syntax at first.
As I understand it:
It makes the variable global named by $k. This would
be a numeric key. 1,2,3... so $1, $2, $3 etc.

Shouldn't it be
foreach ($this->variables AS $k => $v) { global ${$v}; }
So it makes global, each of the variables named in the
variables array?
I made this change and MOD now works for me!

I haven't tried turning on global.

But even if register_global = on is required. The code
in question seems to "globalize" Numeric variable names.

If this a correct fix let me know. I'll attach a patch.
This appears to be done in other modules as well.

Please advise.

Discussion

  • GATMAN

    GATMAN - 2004-12-22
    • summary: The facility maintenance module MOD funtion doesn't work --> The facility maintenance module MOD function doesn't work
     
  • GATMAN

    GATMAN - 2004-12-22

    Logged In: YES
    user_id=1183246

    This code in question changed at revision 1.12.

     
  • GATMAN

    GATMAN - 2004-12-22

    Logged In: YES
    user_id=1183246

    AHHHH!!!!!

    It appears that All Arrays in PHP are associative so there
    may a more appropriate fix.

     

Log in to post a comment.

MongoDB Logo MongoDB