Piotr Pokora schrieb:
Andreas Flack writes:

Hi!

So I did var_dump($_MIDGARD); in the style code and saw that it was
indeed an object. The funny thing is now that I did a second
var_dump($_MIDGARD); at the beginning of my code-init, and there
$_MIDGARD is an array.

So, my question is: Is this intentional? If so, where exactly does
$_MIDGARD become an object?

$_MIDGARD is initialized ( internaly ) as array, before code-global is
executed. But it's not read only. Any code may change this to an object.

Now that you mention it: It was indeed overwritten by the Style code (it is a very old site with lots of strange hacks):

<?php $_MIDGARD = $GLOBALS['midgard']; ?>

So in essence, there is an object called $GLOBALS['midgard'] and an array $_MIDGARD. I always thought the two were equivalent, but well, it seems I was wrong again :-)



And more importantly: Why does it behave
like this? To me, this seems like the perfect opportunity to introduce
subtle db corruptions, especially if you only log errors to the file and
don't display them on site.

How would you like to corrupt db like this?

Well, I just thought if what I saw was the default behavior, then all actions requiring a can_do() call from style code would fail, leaving incomplete DB entries, like the person I created (which was missing the midgard_owner privilege). But since this was a local issue, I guess I'm the one to blame.


Bye,

Andreas



Piotras
_______________________________________________
user mailing list
[email protected]
http://lists.midgard-project.org/mailman/listinfo/user

_______________________________________________
user mailing list
[email protected]
http://lists.midgard-project.org/mailman/listinfo/user

Reply via email to