Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Extensions list broken

edited April 2006 in Vanilla 1.0 Help
Instead of displaying all of the extensions in the list, Vanilla displays the right number, but thinks they're all the whisper plugin:


Any ideas?

Running PHP 5.0.4 on Windows, if it's any help. (If it's PHP5 that's the problem then that's fine, since the host I'll be putting this on is still on 4.x)


  • whoa busted. are all the extensions in the extensions folder?
  • Yup, all the files are present and correct. This is a brand spanking new install, I'm trying it out locally before I use it properly on my site.
  • did you turn on all the extensions? they should all be off by default if i remember correctly.
  • also look at your appg/extensions.php and see what is in that.
  • I can only turn whispers on, because that's the only one that's there :P It appears like this whether the whispers extension is turned on or off.
  • Only whispers is being loaded in appg/extensions.php.
  • MarkMark Vanilla Staff
    I've had another member report this bug and he's granted me access to his server so I can figure out what the problem is. he's got php5 as well, so it is definitely related to that. I imagine it's a simple matter of changing a looping method or something. I'm planning on having this bug fixed for Friday's revision.
  • /me waits for mark
  • He's too quick for you :P Righto, sounds like it's related to PHP5 then. In what file are extensions loaded, out of interest?
  • MarkMark Vanilla Staff
    Extensions are managed by the appg/extensions.php file. All that form does is add (or remove) an include line to the actual extension in that file.
  • Yeah I'd guessed that - where is the code that displays the extensions on the admin page, though? I've had a poke but I think I'm just being blind or something :/
  • Ah, got it, in settings.php. I'll have a play with it, see if I can't work it out :)
  • MarkMark Vanilla Staff
    Yeah - it should be in the controls/settings.php control file. The class is ExtensionForm, which is an implementation of PostBackControl. All of the fancy directory reading stuff happens in the constructor. I don't know why I told you that since you already knew. But I did.
  • edited July 2005
    It's got to be to do with the way PHP5 handles objects. When you append the $this->Extensions array with $Extension, it seems to be modifying that instance of the object when you modify the other instances - so when you call $Extension->Clear(), it's also clearing the instance in $this->Extensions, too, just like if you passed a reference to $Extensions. Thus, when you add the next extensions info into $Extension, it's also modifying the first instance, and in the third loop it modifies the first and second too and so on. (If you'll excuse the shoddy explanation) I'm really not sure why, as you're not passing a reference - it should be cloning the object - but that's what seems to be happening, since a dump of $Extensions each time shows each individual extension, but a dump of $this->Extensions after the loop shows each array item as Whispers.
  • edited July 2005
    You can fix it on PHP5 by changing it to:

    $this->Extensions[] = clone $Extension;

    But I would presume that breaks PHP4, since it has no idea what cloning objects is.

    e: I guess you could do it the somewhat ugly way:
    if(version_compare(PHP_VERSION, '5.0.0', 'ge')) {
    	$this->Extensions[] = clone $Extension;
    } else {
    	$this->Extensions[] = $Extension;
    but it doesn't really seem like an elegant solution.
  • MarkMark Vanilla Staff
    cool - thanks for looking into this. I'll take a closer look at php 5 and see if there is some alternate method I can come up with.
  • Looking back, not even the ugly way would work, since it's still syntactically incorrect in PHP4. Hmm.
  • edited July 2005
    I just found another solution to the bug:

    php_admin_value zend.ze1_compatibility_mode 1
    in the apache config also fixes this issue. It definitely has to do with PHP5s object handling.
  • MarkMark Vanilla Staff
    Sweet! Thanks 413x!
  • Hmm, weird. It seems like an integral part of PHP5's OOP, I wouldn't have expected you to be able to turn it off so easily. I wonder how it affects other applications?
This discussion has been closed.