[PHP-DEV] [PATCH] ext/date tzinfo structure references
by Joe Orton other posts by this author
Jul 8 2008 7:46AM messages near this date
#45458 [Opn]: oci_fetch_all add NULL char to field name when field name is numeric
|
Re: [PHP-DEV] [PATCH] ext/date tzinfo structure references
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?
Regards, Joe
Thread:
Joe Orton
Derick Rethans
|