Here's a short web page which will generate the bug. Basically, I define a small class that increments a variable on the method call. I store an object of the class in a global, then if I call the method directly from the global, it all works, but if I assign the global to a local and call the method, the variable is not incremented.
Help!!!
<?php
class Apple {
var $worm = 0;
function bite() {
echo "was ".$this->worm;
$this->worm++;
echo " -> now ".$this->worm."<br>\n";
}
}
$gala = new Apple;
function smooth() {
echo "smooth: ";
$GLOBALS ["gala"]->bite();
}
function rough() {
echo "rough: ";
$g = $GLOBALS ["gala"];
$g->bite();
}
smooth();
smooth();
smooth();
rough();
rough();
rough();
?>