On Tue, 8 Jul 2008, Joe Orton wrote: > The result of calling getTimezone() on a Date object results in a > DateTimeZone object with a reference to the dateobj->time->tz_info > object which may get later destroyed. > > This can cause unexpected script behaviour or interpreter crashes, test > case in attachment (1). > > When I fixed this the obvious way, per attachment 3, by adding a clone, > I wondered where the cloned tzinfo structures would get destroyed and I > can't see anywhere. > > After looking at this further - so far as I can tell, the duplication of > the tzinfo structures throughout this code is not actually necessary; > when the structures are created they are referenced from the global > tzcache and will hence last "forever" anyway. The structures are not > changed anywhere either, again AFAICT; though they aren't treated as > const so maybe I'm missing something there. > > So simply copying pointers around would simplify the code, fix leaks and > fix the bug as well. That's attachment (2). > > What do you think?
Sounds sane... I was going to have a look at this tonight and do something similar - this saves some work. I'll see if it fixes all leaks, and commit it if it works fine. Thanks for the patch. regards, Derick -- Derick Rethans http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php