summaryrefslogtreecommitdiff
path: root/actions/apiblockdestroy.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-15 15:41:57 -0700
committerBrion Vibber <brion@pobox.com>2010-03-19 11:18:27 -0700
commit5c314c22885f78a04684637cb8a0e4e745220bd9 (patch)
tree955376a3b0eb5c1aa80dbb0edad5e4b25bec47e8 /actions/apiblockdestroy.php
parentb97400bd6f49dfac71124a3243d1c27f49822f58 (diff)
Drop result ID from data objects on clone(). This keeps the original object working if it was in the middle of a query loop, even if the cloned object falls out of scope and triggers its destructor.
This bug was hitting a number of places where we had the pattern: $db->find(); while($dbo->fetch()) { $x = clone($dbo); // do anything with $x other than storing it in an array } The cloned object's destructor would trigger on the second run through the loop, freeing the database result set -- not really what we wanted. (Loops that stored the clones into an array were fine, since the clones stay in scope in the array longer than the original does.) Detaching the database result from the clone lets us work with its data without interfering with the rest of the query. In the unlikely even that somebody is making clones in the middle of a query, then trying to continue the query with the clone instead of the original object, well they're gonna be broken now.
Diffstat (limited to 'actions/apiblockdestroy.php')
0 files changed, 0 insertions, 0 deletions