WoltLab/WCF — pull request #568 by NetzwergX (2012-04-13 18:09:37+00:00)
Title: DBOEditor->update() now also updates the array that represents the objects data

Consider the following test case:

smileyPath;
// at this point, some plugin might call $dboEditor->update(...);
echo "\r";
if(strpos($dboEditor->smileyPath, ".svg") === false)
$dboEditor->update(array("smileyPath" => str_replace(".png", ".svg", $dboEditor->smileyPath)));
else
$dboEditor->update(array("smileyPath" => str_replace(".svg", ".png", $dboEditor->smileyPath)));
echo "Path new: " . $dboEditor->smileyPath;
// another plugin, that uses a later event, will now get the old values, not the updated ones

This will print the following output:
Path: images/smilies/smileySmiling.svg
Path new: images/smilies/smileySmiling.svg
That is not exactly what one might expect to happen when he updates an object ;)
The real problem lies in the event system: when one event listener updates an object, and another event listener uses a value that is affected by the beforementioned event listener, the behavior might become irradic due to the latter event listener now using obsolete data.

My pull request changes that behavior, the output is now as expected:
Path: images/smilies/smileySmiling.svg
Path new: images/smilies/smileySmiling.png

Tested it in a live installation of the latest WCF with the wbbaddons dummy app, seems not to affect any existing code ;)