[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Tue Jun 30 16:15:44 2009 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed bug #47351 (Memory leak in DateTime). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.240&r2=1.241&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.240 php-src/ext/date/php_date.c:1.241 --- php-src/ext/date/php_date.c:1.240 Thu Jun 25 12:41:41 2009 +++ php-src/ext/date/php_date.c Tue Jun 30 16:15:43 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.240 2009/06/25 12:41:41 iliaa Exp $ */ +/* $Id: php_date.c,v 1.241 2009/06/30 16:15:43 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2517,7 +2517,7 @@ } timelib_unixtime2local(now, (timelib_sll) time(NULL)); - timelib_fill_holes(dateobj->time, now, 0); + timelib_fill_holes(dateobj->time, now, TIMELIB_NO_CLONE); timelib_update_ts(dateobj->time, tzi); dateobj->time->have_relative = 0; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
iliaa Thu Jun 25 12:41:41 2009 UTC Modified files: /php-src/ext/date php_date.c Log: Fixed bug #48678 (DateInterval segfaults when unserialising) http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.239&r2=1.240&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.239 php-src/ext/date/php_date.c:1.240 --- php-src/ext/date/php_date.c:1.239 Mon Jun 22 13:43:06 2009 +++ php-src/ext/date/php_date.c Thu Jun 25 12:41:41 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.239 2009/06/22 13:43:06 iliaa Exp $ */ +/* $Id: php_date.c,v 1.240 2009/06/25 12:41:41 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -2316,6 +2316,10 @@ props = intervalobj->std.properties; + if (!intervalobj->initialized) { + return props; + } + #define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \ MAKE_STD_ZVAL(zv); \ ZVAL_LONG(zv, intervalobj->diff->f); \ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
iliaa Mon Jun 22 13:43:06 2009 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: Fixed bug #48636 (Error compiling of ext/date on netware). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.238&r2=1.239&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.238 php-src/ext/date/php_date.c:1.239 --- php-src/ext/date/php_date.c:1.238 Sun Jun 21 22:18:53 2009 +++ php-src/ext/date/php_date.c Mon Jun 22 13:43:06 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.238 2009/06/21 22:18:53 scottmac Exp $ */ +/* $Id: php_date.c,v 1.239 2009/06/22 13:43:06 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -36,6 +36,10 @@ # include "win32/php_stdint.h" #endif +#if defined(NETWARE) && defined(__MWERKS__) +static __inline long long llabs( long long i ) { return i >= 0 ? i : -i; } +#endif + /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1) ZEND_ARG_INFO(0, format) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
scottmacSun Jun 21 22:18:53 2009 UTC Modified files: /php-src/ext/date php_date.c Log: Fix bug #48276 - year is a long long so we need %lld so big endian systems print the correct value. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.237&r2=1.238&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.237 php-src/ext/date/php_date.c:1.238 --- php-src/ext/date/php_date.c:1.237 Sun Jun 21 20:41:51 2009 +++ php-src/ext/date/php_date.c Sun Jun 21 22:18:53 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.237 2009/06/21 20:41:51 bjori Exp $ */ +/* $Id: php_date.c,v 1.238 2009/06/21 22:18:53 scottmac Exp $ */ #include "php.h" #include "php_streams.h" @@ -1143,7 +1143,7 @@ /* year */ case 'L': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%d", timelib_is_leap((int) t->y)); break; case 'y': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%02d", (int) t->y % 100); break; - case 'Y': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s%04ld", t->y < 0 ? "-" : "", llabs(t->y)); break; + case 'Y': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s%04lld", t->y < 0 ? "-" : "", llabs(t->y)); break; /* time */ case 'a': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%R", localized ? IS_UNICODE : IS_STRING, am_pm_lower_full(t->h >= 12 ? 1 : 0, localized)); break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
bjori Sun Jun 21 20:41:51 2009 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: Fix proto and arginfo http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.236&r2=1.237&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.236 php-src/ext/date/php_date.c:1.237 --- php-src/ext/date/php_date.c:1.236 Sun May 31 21:29:54 2009 +++ php-src/ext/date/php_date.c Sun Jun 21 20:41:51 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.236 2009/05/31 21:29:54 stas Exp $ */ +/* $Id: php_date.c,v 1.237 2009/06/21 20:41:51 bjori Exp $ */ #include "php.h" #include "php_streams.h" @@ -328,6 +328,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_identifiers_list, 0, 0, 0) ZEND_ARG_INFO(0, what) + ZEND_ARG_INFO(0, country) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_timezone_abbreviations_list, 0) @@ -3859,7 +3860,7 @@ return 0; } -/* {{{ proto array timezone_identifiers_list([long what]) U +/* {{{ proto array timezone_identifiers_list([long what[, string country]]) U Returns numerically index array with all timezone identifiers. */ PHP_FUNCTION(timezone_identifiers_list) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] Re: [PHP-DOC] Re: [PHP-CVS] cvs: php-src /ext/date php_date.c
Derick Rethans wrote: > On Tue, 26 May 2009, Philip Olson wrote: > derick Tue May 19 19:43:44 2009 UTC Modified files: /php-src/ext/datephp_date.c Log: - Getting rid of using the environment to guess timezone information from. #- [DOC] >>> Wait, what? I can see moving it to the lowest priority, but why get rid >>> of it completely? >> Any word on this? > > I'll reply to it in a bit. Needs a proper explanation and I'm rather > swamped. Is it "a bit" yet? -Rasmus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h
stasSun May 31 21:29:54 2009 UTC Modified files: /php-src/ext/date php_date.c php_date.h Log: fix for #48247 http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.235&r2=1.236&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.235 php-src/ext/date/php_date.c:1.236 --- php-src/ext/date/php_date.c:1.235 Wed May 20 08:18:07 2009 +++ php-src/ext/date/php_date.c Sun May 31 21:29:54 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.235 2009/05/20 08:18:07 kalle Exp $ */ +/* $Id: php_date.c,v 1.236 2009/05/31 21:29:54 stas Exp $ */ #include "php.h" #include "php_streams.h" @@ -597,6 +597,7 @@ { date_globals->default_timezone = NULL; date_globals->timezone = NULL; + date_globals->tzcache = NULL; } /* }}} */ @@ -615,7 +616,7 @@ efree(DATEG(timezone)); } DATEG(timezone) = NULL; - zend_hash_init(&DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0); + DATEG(tzcache) = NULL; return SUCCESS; } @@ -628,8 +629,11 @@ efree(DATEG(timezone)); } DATEG(timezone) = NULL; - zend_hash_destroy(&DATEG(tzcache)); - + if(DATEG(tzcache)) { + zend_hash_destroy(DATEG(tzcache)); + FREE_HASHTABLE(DATEG(tzcache)); + DATEG(tzcache) = NULL; + } return SUCCESS; } /* }}} */ @@ -811,13 +815,18 @@ { timelib_tzinfo *tzi, **ptzi; - if (zend_hash_find(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void **) &ptzi) == SUCCESS) { + if(!DATEG(tzcache)) { + ALLOC_HASHTABLE(DATEG(tzcache)); + zend_hash_init(DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0); + } + + if (zend_hash_find(DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void **) &ptzi) == SUCCESS) { return *ptzi; } tzi = timelib_parse_tzfile(formal_tzname, tzdb); if (tzi) { - zend_hash_add(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL); + zend_hash_add(DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL); } return tzi; } @@ -906,7 +915,7 @@ { char *tz; timelib_tzinfo *tzi; - + tz = guess_timezone(DATE_TIMEZONEDB TSRMLS_CC); tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB TSRMLS_CC); if (! tzi) { http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.h?r1=1.45&r2=1.46&diff_format=u Index: php-src/ext/date/php_date.h diff -u php-src/ext/date/php_date.h:1.45 php-src/ext/date/php_date.h:1.46 --- php-src/ext/date/php_date.h:1.45Sun May 3 19:57:35 2009 +++ php-src/ext/date/php_date.h Sun May 31 21:29:54 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.h,v 1.45 2009/05/03 19:57:35 derick Exp $ */ +/* $Id: php_date.h,v 1.46 2009/05/31 21:29:54 stas Exp $ */ #ifndef PHP_DATE_H #define PHP_DATE_H @@ -153,7 +153,7 @@ ZEND_BEGIN_MODULE_GLOBALS(date) char *default_timezone; char *timezone; - HashTable tzcache; + HashTable *tzcache; timelib_error_container *last_errors; ZEND_END_MODULE_GLOBALS(date) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] Re: [PHP-DOC] Re: [PHP-CVS] cvs: php-src /ext/date php_date.c
On Tue, 26 May 2009, Philip Olson wrote: > > > > derickTue May 19 19:43:44 2009 UTC > > > > > > Modified files: > > > /php-src/ext/date php_date.c > > > Log: > > > - Getting rid of using the environment to guess timezone information from. > > > #- [DOC] > > > > > Wait, what? I can see moving it to the lowest priority, but why get rid > > of it completely? > > Any word on this? I'll reply to it in a bit. Needs a proper explanation and I'm rather swamped. regards, Derick -- http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org twitter: @derickr -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] Re: [PHP-DOC] Re: [PHP-CVS] cvs: php-src /ext/date php_date.c
derick Tue May 19 19:43:44 2009 UTC Modified files: /php-src/ext/datephp_date.c Log: - Getting rid of using the environment to guess timezone information from. #- [DOC] Wait, what? I can see moving it to the lowest priority, but why get rid of it completely? -Rasmus Any word on this? Regards, Philip -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
kalle Wed May 20 08:18:07 2009 UTC Modified files: /php-src/ext/date php_date.c Log: Nuke newly introduced warning http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.234&r2=1.235&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.234 php-src/ext/date/php_date.c:1.235 --- php-src/ext/date/php_date.c:1.234 Tue May 19 19:43:44 2009 +++ php-src/ext/date/php_date.c Wed May 20 08:18:07 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.234 2009/05/19 19:43:44 derick Exp $ */ +/* $Id: php_date.c,v 1.235 2009/05/20 08:18:07 kalle Exp $ */ #include "php.h" #include "php_streams.h" @@ -826,8 +826,6 @@ /* {{{ Helper functions */ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) { - char *env; - /* Checking configure timezone */ if (DATEG(timezone) && (strlen(DATEG(timezone)) > 0)) { return DATEG(timezone); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c
Wait, what? I can see moving it to the lowest priority, but why get rid of it completely? -Rasmus Derick Rethans wrote: > derickTue May 19 19:43:44 2009 UTC > > Modified files: > /php-src/ext/date php_date.c > Log: > - Getting rid of using the environment to guess timezone information from. > #- [DOC] > > > http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.233&r2=1.234&diff_format=u > Index: php-src/ext/date/php_date.c > diff -u php-src/ext/date/php_date.c:1.233 php-src/ext/date/php_date.c:1.234 > --- php-src/ext/date/php_date.c:1.233 Tue May 19 19:23:12 2009 > +++ php-src/ext/date/php_date.c Tue May 19 19:43:44 2009 > @@ -16,7 +16,7 @@ > +--+ > */ > > -/* $Id: php_date.c,v 1.233 2009/05/19 19:23:12 bjori Exp $ */ > +/* $Id: php_date.c,v 1.234 2009/05/19 19:43:44 derick Exp $ */ > > #include "php.h" > #include "php_streams.h" > @@ -832,11 +832,6 @@ > if (DATEG(timezone) && (strlen(DATEG(timezone)) > 0)) { > return DATEG(timezone); > } > - /* Check environment variable */ > - env = getenv("TZ"); > - if (env && *env && timelib_timezone_id_is_valid(env, tzdb)) { > - return env; > - } > /* Check config setting for default timezone */ > if (DATEG(default_timezone) && (strlen(DATEG(default_timezone)) > 0) && > timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) { > return DATEG(default_timezone); > > > -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Tue May 19 19:43:44 2009 UTC Modified files: /php-src/ext/date php_date.c Log: - Getting rid of using the environment to guess timezone information from. #- [DOC] http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.233&r2=1.234&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.233 php-src/ext/date/php_date.c:1.234 --- php-src/ext/date/php_date.c:1.233 Tue May 19 19:23:12 2009 +++ php-src/ext/date/php_date.c Tue May 19 19:43:44 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.233 2009/05/19 19:23:12 bjori Exp $ */ +/* $Id: php_date.c,v 1.234 2009/05/19 19:43:44 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -832,11 +832,6 @@ if (DATEG(timezone) && (strlen(DATEG(timezone)) > 0)) { return DATEG(timezone); } - /* Check environment variable */ - env = getenv("TZ"); - if (env && *env && timelib_timezone_id_is_valid(env, tzdb)) { - return env; - } /* Check config setting for default timezone */ if (DATEG(default_timezone) && (strlen(DATEG(default_timezone)) > 0) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) { return DATEG(default_timezone); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
bjori Tue May 19 19:23:12 2009 UTC Modified files: /php-src/ext/date php_date.c Log: Partial fix for bug#48333 (DateInterval.format() expects a single, undocumented parameter) http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.232&r2=1.233&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.232 php-src/ext/date/php_date.c:1.233 --- php-src/ext/date/php_date.c:1.232 Tue May 19 15:38:21 2009 +++ php-src/ext/date/php_date.c Tue May 19 19:23:12 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.232 2009/05/19 15:38:21 jani Exp $ */ +/* $Id: php_date.c,v 1.233 2009/05/19 19:23:12 bjori Exp $ */ #include "php.h" #include "php_streams.h" @@ -340,11 +340,13 @@ ZEND_ARG_INFO(0, time) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_format, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_format, 0, 0, 2) ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, format) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_date_method_interval_format, 0) + ZEND_ARG_INFO(0, format) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_date_period_construct, 0, 0, 3) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
janiTue May 19 15:38:22 2009 UTC Modified files: /php-src/ext/date php_date.c Log: - Revert bad compile warning fix which causes compile failures with older glibc http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.231&r2=1.232&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.231 php-src/ext/date/php_date.c:1.232 --- php-src/ext/date/php_date.c:1.231 Wed May 13 00:45:57 2009 +++ php-src/ext/date/php_date.c Tue May 19 15:38:21 2009 @@ -16,9 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.231 2009/05/13 00:45:57 jani Exp $ */ - -#define _ISOC9X_SOURCE +/* $Id: php_date.c,v 1.232 2009/05/19 15:38:21 jani Exp $ */ #include "php.h" #include "php_streams.h" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
iliaa Tue May 5 12:34:04 2009 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: Fixed compiler warning due to llabs() function http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.229&r2=1.230&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.229 php-src/ext/date/php_date.c:1.230 --- php-src/ext/date/php_date.c:1.229 Mon May 4 17:11:39 2009 +++ php-src/ext/date/php_date.c Tue May 5 12:34:03 2009 @@ -16,7 +16,9 @@ +--+ */ -/* $Id: php_date.c,v 1.229 2009/05/04 17:11:39 pajoye Exp $ */ +/* $Id: php_date.c,v 1.230 2009/05/05 12:34:03 iliaa Exp $ */ + +#define _ISOC9X_SOURCE #include "php.h" #include "php_streams.h" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
pajoye Mon May 4 17:11:39 2009 UTC Modified files: /php-src/ext/date php_date.c Log: - cleaner fix http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.228&r2=1.229&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.228 php-src/ext/date/php_date.c:1.229 --- php-src/ext/date/php_date.c:1.228 Mon May 4 16:29:09 2009 +++ php-src/ext/date/php_date.c Mon May 4 17:11:39 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.228 2009/05/04 16:29:09 pajoye Exp $ */ +/* $Id: php_date.c,v 1.229 2009/05/04 17:11:39 pajoye Exp $ */ #include "php.h" #include "php_streams.h" @@ -34,7 +34,6 @@ #ifdef PHP_WIN32 # include "win32/php_stdint.h" -static inline int64_t llabs( int64_t i ) { return i >= 0? i: -i; } #endif /* {{{ arginfo */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
pajoye Mon May 4 16:29:09 2009 UTC Modified files: /php-src/ext/date php_date.c Log: - fix build http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.227&r2=1.228&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.227 php-src/ext/date/php_date.c:1.228 --- php-src/ext/date/php_date.c:1.227 Sun May 3 19:57:35 2009 +++ php-src/ext/date/php_date.c Mon May 4 16:29:09 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.227 2009/05/03 19:57:35 derick Exp $ */ +/* $Id: php_date.c,v 1.228 2009/05/04 16:29:09 pajoye Exp $ */ #include "php.h" #include "php_streams.h" @@ -32,6 +32,11 @@ #include #include +#ifdef PHP_WIN32 +# include "win32/php_stdint.h" +static inline int64_t llabs( int64_t i ) { return i >= 0? i: -i; } +#endif + /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1) ZEND_ARG_INFO(0, format) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h
derick Sun May 3 19:57:35 2009 UTC Modified files: /php-src/ext/date php_date.c php_date.h Log: - Added timezone_version_get() to retrieve the version of the used timezone database. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.226&r2=1.227&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.226 php-src/ext/date/php_date.c:1.227 --- php-src/ext/date/php_date.c:1.226 Sun May 3 18:45:05 2009 +++ php-src/ext/date/php_date.c Sun May 3 19:57:35 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.226 2009/05/03 18:45:05 derick Exp $ */ +/* $Id: php_date.c,v 1.227 2009/05/03 19:57:35 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -329,6 +329,9 @@ ZEND_BEGIN_ARG_INFO(arginfo_timezone_abbreviations_list, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_timezone_version_get, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_create_from_date_string, 0, 0, 1) ZEND_ARG_INFO(0, time) ZEND_END_ARG_INFO() @@ -405,6 +408,7 @@ PHP_FE(timezone_location_get, arginfo_timezone_location_get) PHP_FE(timezone_identifiers_list, arginfo_timezone_identifiers_list) PHP_FE(timezone_abbreviations_list, arginfo_timezone_abbreviations_list) + PHP_FE(timezone_version_get, arginfo_timezone_version_get) PHP_FE(date_interval_create_from_date_string, arginfo_date_interval_create_from_date_string) PHP_FE(date_interval_format, arginfo_date_interval_format) @@ -3893,6 +3897,18 @@ } /* }}} */ +/* {{{ proto array timezone_version_get() + Returns the Olson database version number. +*/ +PHP_FUNCTION(timezone_version_get) +{ + const timelib_tzdb *tzdb; + + tzdb = DATE_TIMEZONEDB; + RETURN_ASCII_STRING(tzdb->version, 1); +} +/* }}} */ + /* {{{ proto array timezone_abbreviations_list() U Returns associative array containing dst, offset and the timezone name */ http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.h?r1=1.44&r2=1.45&diff_format=u Index: php-src/ext/date/php_date.h diff -u php-src/ext/date/php_date.h:1.44 php-src/ext/date/php_date.h:1.45 --- php-src/ext/date/php_date.h:1.44Tue Mar 10 23:39:11 2009 +++ php-src/ext/date/php_date.h Sun May 3 19:57:35 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.h,v 1.44 2009/03/10 23:39:11 helly Exp $ */ +/* $Id: php_date.h,v 1.45 2009/05/03 19:57:35 derick Exp $ */ #ifndef PHP_DATE_H #define PHP_DATE_H @@ -80,6 +80,7 @@ PHP_FUNCTION(timezone_location_get); PHP_FUNCTION(timezone_identifiers_list); PHP_FUNCTION(timezone_abbreviations_list); +PHP_FUNCTION(timezone_version_get); PHP_METHOD(timezone, identifiers_list); PHP_METHOD(timezone, abbreviations_list); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests bug45682.phpt
derick Sun May 3 18:45:06 2009 UTC Added files: /php-src/ext/date/tests bug45682.phpt Modified files: /php-src/ext/date php_date.c Log: - Fixed bug #45682 (Unable to var_dump(DateInterval)). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.225&r2=1.226&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.225 php-src/ext/date/php_date.c:1.226 --- php-src/ext/date/php_date.c:1.225 Sun May 3 18:21:52 2009 +++ php-src/ext/date/php_date.c Sun May 3 18:45:05 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.225 2009/05/03 18:21:52 derick Exp $ */ +/* $Id: php_date.c,v 1.226 2009/05/03 18:45:05 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -555,6 +555,7 @@ static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC); static HashTable *date_object_get_properties(zval *object TSRMLS_DC); +static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC); zval *date_interval_read_property(zval *object, zval *member, int type TSRMLS_DC); void date_interval_write_property(zval *object, zval *member, zval *value TSRMLS_DC); @@ -2063,6 +2064,7 @@ date_object_handlers_interval.clone_obj = date_object_clone_interval; date_object_handlers_interval.read_property = date_interval_read_property; date_object_handlers_interval.write_property = date_interval_write_property; + date_object_handlers_interval.get_properties = date_object_get_properties_interval; INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period); ce_period.create_object = date_object_new_period; @@ -2292,6 +2294,34 @@ return new_ov; } +static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) +{ + HashTable *props; + zval *zv; + php_interval_obj *intervalobj; + + + intervalobj = (php_interval_obj *) zend_object_store_get_object(object TSRMLS_CC); + + props = intervalobj->std.properties; + +#define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \ + MAKE_STD_ZVAL(zv); \ + ZVAL_LONG(zv, intervalobj->diff->f); \ + zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zval), NULL); + + PHP_DATE_INTERVAL_ADD_PROPERTY("y", y); + PHP_DATE_INTERVAL_ADD_PROPERTY("m", m); + PHP_DATE_INTERVAL_ADD_PROPERTY("d", d); + PHP_DATE_INTERVAL_ADD_PROPERTY("h", h); + PHP_DATE_INTERVAL_ADD_PROPERTY("i", i); + PHP_DATE_INTERVAL_ADD_PROPERTY("s", s); + PHP_DATE_INTERVAL_ADD_PROPERTY("invert", invert); + PHP_DATE_INTERVAL_ADD_PROPERTY("days", days); + + return props; +} + static inline zend_object_value date_object_new_period_ex(zend_class_entry *class_type, php_period_obj **ptr TSRMLS_DC) { php_period_obj *intern; http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug45682.phpt?view=markup&rev=1.1 Index: php-src/ext/date/tests/bug45682.phpt +++ php-src/ext/date/tests/bug45682.phpt --TEST-- Bug #45682 (Unable to var_dump(DateInterval)) --INI-- date.timezone=UTC --FILE-- int(0) [u"m"]=> int(0) [u"d"]=> int(3) [u"h"]=> int(0) [u"i"]=> int(0) [u"s"]=> int(0) [u"invert"]=> int(0) [u"days"]=> int(3) } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/lib timelib_structs.h tm2unixtime.c /ext/date/tests bug48058.phpt date_create-relative.phpt strtotime-relative.phpt
derick Sun May 3 18:21:52 2009 UTC Added files: /php-src/ext/date/tests bug48058.phpt date_create-relative.phpt strtotime-relative.phpt Modified files: /php-src/ext/date php_date.c /php-src/ext/date/lib timelib_structs.h tm2unixtime.c Log: - Fixed bug #48058 (Year formatter goes wrong with out-of-int range). - Fixed bug #45822 (Near infinite-loops while parsing huge relative offsets). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.224&r2=1.225&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.224 php-src/ext/date/php_date.c:1.225 --- php-src/ext/date/php_date.c:1.224 Mon Apr 27 14:21:57 2009 +++ php-src/ext/date/php_date.c Sun May 3 18:21:52 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.224 2009/04/27 14:21:57 kalle Exp $ */ +/* $Id: php_date.c,v 1.225 2009/05/03 18:21:52 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1135,7 +1135,7 @@ /* year */ case 'L': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%d", timelib_is_leap((int) t->y)); break; case 'y': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%02d", (int) t->y % 100); break; - case 'Y': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s%04d", t->y < 0 ? "-" : "", abs((int) t->y)); break; + case 'Y': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s%04ld", t->y < 0 ? "-" : "", llabs(t->y)); break; /* time */ case 'a': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%R", localized ? IS_UNICODE : IS_STRING, am_pm_lower_full(t->h >= 12 ? 1 : 0, localized)); break; http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/timelib_structs.h?r1=1.32&r2=1.33&diff_format=u Index: php-src/ext/date/lib/timelib_structs.h diff -u php-src/ext/date/lib/timelib_structs.h:1.32 php-src/ext/date/lib/timelib_structs.h:1.33 --- php-src/ext/date/lib/timelib_structs.h:1.32 Tue Mar 10 23:39:12 2009 +++ php-src/ext/date/lib/timelib_structs.h Sun May 3 18:21:52 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: timelib_structs.h,v 1.32 2009/03/10 23:39:12 helly Exp $ */ +/* $Id: timelib_structs.h,v 1.33 2009/05/03 18:21:52 derick Exp $ */ #ifndef __TIMELIB_STRUCTS_H__ #define __TIMELIB_STRUCTS_H__ @@ -216,6 +216,9 @@ #define SECS_PER_DAY 86400 #define DAYS_PER_YEAR365 #define DAYS_PER_LYEAR 366 +/* 400*365 days + 97 leap days */ +#define DAYS_PER_LYEAR_PERIOD 146097 +#define YEARS_PER_LYEAR_PERIOD 400 #define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0)) http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/tm2unixtime.c?r1=1.31&r2=1.32&diff_format=u Index: php-src/ext/date/lib/tm2unixtime.c diff -u php-src/ext/date/lib/tm2unixtime.c:1.31 php-src/ext/date/lib/tm2unixtime.c:1.32 --- php-src/ext/date/lib/tm2unixtime.c:1.31 Tue Mar 10 23:39:12 2009 +++ php-src/ext/date/lib/tm2unixtime.c Sun May 3 18:21:52 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: tm2unixtime.c,v 1.31 2009/03/10 23:39:12 helly Exp $ */ +/* $Id: tm2unixtime.c,v 1.32 2009/05/03 18:21:52 derick Exp $ */ #include "timelib.h" @@ -31,20 +31,12 @@ static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b) { if (*a < start) { - *a += adj; - (*b)--; - return 1; + *b -= (start - *a - 1) / adj + 1; + *a += adj * ((start - *a - 1) / adj + 1); } if (*a >= end) { - if (start == 0) { - (*b) += (*a / end); - (*a) -= (end * (*a / end)); - return 0; - } - - *a -= adj; - (*b)++; - return 1; + *b += *a / adj; + *a -= adj * (*a / adj); } return 0; } @@ -90,6 +82,12 @@ timelib_sll days_this_month; timelib_sll last_month, last_year; timelib_sll days_last_month; + + /* can jump an entire leap year period quickly */ + if (*d >= DAYS_PER_LYEAR_PERIOD || *d <= -DAYS_PER_LYEAR_PERIOD) { + *y += YEARS_PER_LYEAR_PERIOD * (*d / DAYS_PER_LYEAR_PERIOD); + *d -= DAYS_PER_LYEAR_PERIOD * (*d / DAYS_PER_LYEAR_PERIOD); + } do_range_limit(1, 13, 12, m, y); http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug48058.phpt?view=markup&rev=1.1 Index: php-src/ext/date/tests/bug48058.phpt +++ php-src/ext/date/tests/bug48058.phpt --TEST-- Bug #48058 (Year formatter goes wrong with out-of-int range) --INI-- date.ti
[PHP-CVS] cvs: php-src /ext/date php_date.c
kalle Mon Apr 27 14:21:57 2009 UTC Modified files: /php-src/ext/date php_date.c Log: Fixed bug #48088 (Wrong ARG_INFO for OO-API of DateTime) http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.223&r2=1.224&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.223 php-src/ext/date/php_date.c:1.224 --- php-src/ext/date/php_date.c:1.223 Tue Apr 7 20:03:00 2009 +++ php-src/ext/date/php_date.c Mon Apr 27 14:21:57 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.223 2009/04/07 20:03:00 felipe Exp $ */ +/* $Id: php_date.c,v 1.224 2009/04/27 14:21:57 kalle Exp $ */ #include "php.h" #include "php_streams.h" @@ -435,7 +435,7 @@ PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_date_method_offset_get, 0) PHP_ME_MAPPING(setTime, date_time_set, arginfo_date_method_time_set, 0) PHP_ME_MAPPING(setDate, date_date_set, arginfo_date_method_date_set, 0) - PHP_ME_MAPPING(setISODate, date_isodate_set, arginfo_date_isodate_set, 0) + PHP_ME_MAPPING(setISODate, date_isodate_set, arginfo_date_method_isodate_set, 0) PHP_ME_MAPPING(setTimestamp,date_timestamp_set, arginfo_date_method_timestamp_set, 0) PHP_ME_MAPPING(getTimestamp,date_timestamp_get, arginfo_date_method_timestamp_get, 0) PHP_ME_MAPPING(diff,date_diff, arginfo_date_method_diff, 0) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
felipe Tue Apr 7 20:03:00 2009 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed bug #46108 (DateTime - Memory leak when unserializing) http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.222&r2=1.223&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.222 php-src/ext/date/php_date.c:1.223 --- php-src/ext/date/php_date.c:1.222 Fri Mar 27 19:22:18 2009 +++ php-src/ext/date/php_date.c Tue Apr 7 20:03:00 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.222 2009/03/27 19:22:18 bjori Exp $ */ +/* $Id: php_date.c,v 1.223 2009/04/07 20:03:00 felipe Exp $ */ #include "php.h" #include "php_streams.h" @@ -2382,10 +2382,6 @@ /* Advanced Interface */ static zval * date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) { - if (!object) { - ALLOC_ZVAL(object); - } - Z_TYPE_P(object) = IS_OBJECT; object_init_ex(object, pce); Z_SET_REFCOUNT_P(object, 1); @@ -2575,12 +2571,14 @@ tzi = php_date_parse_tzfile(Z_STRVAL_PP(z_timezone), DATE_TIMEZONEDB TSRMLS_CC); + ALLOC_INIT_ZVAL(tmp_obj); tzobj = zend_object_store_get_object(tmp_obj = date_instantiate(date_ce_timezone, tmp_obj TSRMLS_CC) TSRMLS_CC); tzobj->type = TIMELIB_ZONETYPE_ID; tzobj->tzi.tz = tzi; tzobj->initialized = 1; date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC); + zval_ptr_dtor(&tmp_obj); return 1; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c /ext/libxml libxml.c /ext/soap soap.c /ext/standard string.c var_unserializer.c var_unserializer.re ZendEngine2 zend_constants.c zend_hash.c zend_ob
Please, keep all the branches in sync, and also merge that change to PHP 5.2 and PHP 5.3 if needed. I don't see what to sync, almost all the variables removed are related to the dropped UG() stuff. The change in php_date.c was just for sync with 5.3, non related to UG()... -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c /ext/libxml libxml.c /ext/soap soap.c /ext/standard string.c var_unserializer.c var_unserializer.re ZendEngine2 zend_constants.c zend_hash.c zend_ob
On Thu, 26 Mar 2009, Felipe Pena wrote: > felipeThu Mar 26 22:16:48 2009 UTC > > Modified files: > /ZendEngine2 zend_constants.c zend_hash.c zend_object_handlers.c > zend_operators.c > /php-src/ext/date php_date.c Please, keep all the branches in sync, and also merge that change to PHP 5.2 and PHP 5.3 if needed. regards, Derick -- http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org twitter: derickrethans -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
bjori Fri Mar 27 19:22:18 2009 UTC Modified files: /php-src/ext/date php_date.c Log: Fix protos http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.221&r2=1.222&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.221 php-src/ext/date/php_date.c:1.222 --- php-src/ext/date/php_date.c:1.221 Thu Mar 26 22:16:48 2009 +++ php-src/ext/date/php_date.c Fri Mar 27 19:22:18 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.221 2009/03/26 22:16:48 felipe Exp $ */ +/* $Id: php_date.c,v 1.222 2009/03/27 19:22:18 bjori Exp $ */ #include "php.h" #include "php_streams.h" @@ -2814,7 +2814,7 @@ } /* }}} */ -/* {{{ proto void date_modify(DateTime object, string modify) U +/* {{{ proto DateTime date_modify(DateTime object, string modify) U Alters the timestamp. */ PHP_FUNCTION(date_modify) @@ -2845,7 +2845,7 @@ } /* }}} */ -/* {{{ proto void date_add(DateTime object, DateInterval interval) U +/* {{{ proto DateTime date_add(DateTime object, DateInterval interval) U Adds an interval to the current date in object. */ PHP_FUNCTION(date_add) @@ -2890,7 +2890,7 @@ } /* }}} */ -/* {{{ proto void date_sub(DateTime object, DateInterval interval) U +/* {{{ proto DateTime date_sub(DateTime object, DateInterval interval) U Subtracts an interval to the current date in object. */ PHP_FUNCTION(date_sub) @@ -2968,7 +2968,7 @@ } /* }}} */ -/* {{{ proto void date_timezone_set(DateTime object, DateTimeZone object) +/* {{{ proto DateTimeZone date_timezone_set(DateTime object, DateTimeZone object) U Sets the timezone for the DateTime object. */ PHP_FUNCTION(date_timezone_set) @@ -3030,7 +3030,7 @@ } /* }}} */ -/* {{{ proto void date_time_set(DateTime object, long hour, long minute[, long second]) U +/* {{{ proto DateTime date_time_set(DateTime object, long hour, long minute[, long second]) U Sets the time. */ PHP_FUNCTION(date_time_set) @@ -3053,7 +3053,7 @@ } /* }}} */ -/* {{{ proto void date_date_set(DateTime object, long year, long month, long day) U +/* {{{ proto DateTime date_date_set(DateTime object, long year, long month, long day) U Sets the date. */ PHP_FUNCTION(date_date_set) @@ -3076,7 +3076,7 @@ } /* }}} */ -/* {{{ proto void date_isodate_set(DateTime object, long year, long week[, long day]) U +/* {{{ proto DateTime date_isodate_set(DateTime object, long year, long week[, long day]) U Sets the ISO date. */ PHP_FUNCTION(date_isodate_set) @@ -3102,7 +3102,7 @@ } /* }}} */ -/* {{{ proto void date_timestamp_set(DateTime object, long unixTimestamp) U +/* {{{ proto DateTime date_timestamp_set(DateTime object, long unixTimestamp) U Sets the date and time based on an Unix timestamp. */ PHP_FUNCTION(date_timestamp_set) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/libxml libxml.c /ext/soap soap.c /ext/standard string.c var_unserializer.c var_unserializer.re ZendEngine2 zend_constants.c zend_hash.c zend_object
felipe Thu Mar 26 22:16:48 2009 UTC Modified files: /ZendEngine2zend_constants.c zend_hash.c zend_object_handlers.c zend_operators.c /php-src/ext/date php_date.c /php-src/ext/libxml libxml.c /php-src/ext/soap soap.c /php-src/ext/standard string.c var_unserializer.c var_unserializer.re Log: - Removed unused variables http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_constants.c?r1=1.118&r2=1.119&diff_format=u Index: ZendEngine2/zend_constants.c diff -u ZendEngine2/zend_constants.c:1.118 ZendEngine2/zend_constants.c:1.119 --- ZendEngine2/zend_constants.c:1.118 Thu Mar 26 20:01:38 2009 +++ ZendEngine2/zend_constants.cThu Mar 26 22:16:47 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_constants.c,v 1.118 2009/03/26 20:01:38 felipe Exp $ */ +/* $Id: zend_constants.c,v 1.119 2009/03/26 22:16:47 felipe Exp $ */ #include "zend.h" #include "zend_constants.h" @@ -37,8 +37,6 @@ void copy_zend_constant(zend_constant *c) /* {{{ */ { - TSRMLS_FETCH(); - c->name.u = zend_ustrndup(c->name.u, c->name_len - 1); if (!(c->flags & CONST_PERSISTENT)) { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_hash.c?r1=1.163&r2=1.164&diff_format=u Index: ZendEngine2/zend_hash.c diff -u ZendEngine2/zend_hash.c:1.163 ZendEngine2/zend_hash.c:1.164 --- ZendEngine2/zend_hash.c:1.163 Thu Mar 26 20:01:38 2009 +++ ZendEngine2/zend_hash.c Thu Mar 26 22:16:47 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_hash.c,v 1.163 2009/03/26 20:01:38 felipe Exp $ */ +/* $Id: zend_hash.c,v 1.164 2009/03/26 22:16:47 felipe Exp $ */ #include "zend.h" #include "zend_operators.h" @@ -333,7 +333,6 @@ { zstr key; int ret; - TSRMLS_FETCH(); key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); ret = _zend_u_hash_add_or_update(ht, IS_UNICODE, key, nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); @@ -673,7 +672,6 @@ { zstr key; int ret; - TSRMLS_FETCH(); key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); ret = zend_u_hash_del_key_or_index(ht, IS_UNICODE, key, nKeyLength, 0, HASH_DEL_KEY); @@ -1135,7 +1133,6 @@ { zstr key; int ret; - TSRMLS_FETCH(); key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); ret = zend_u_hash_find(ht, IS_UNICODE, key, nKeyLength, pData); @@ -1268,7 +1265,6 @@ { zstr key; int ret; - TSRMLS_FETCH(); key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); ret = zend_u_hash_exists(ht, IS_UNICODE, key, nKeyLength); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.213&r2=1.214&diff_format=u Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.213 ZendEngine2/zend_object_handlers.c:1.214 --- ZendEngine2/zend_object_handlers.c:1.213Thu Mar 26 20:01:38 2009 +++ ZendEngine2/zend_object_handlers.c Thu Mar 26 22:16:47 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_object_handlers.c,v 1.213 2009/03/26 20:01:38 felipe Exp $ */ +/* $Id: zend_object_handlers.c,v 1.214 2009/03/26 22:16:47 felipe Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -785,7 +785,6 @@ static inline union _zend_function *zend_get_user_call_function(zend_object *zobj, zstr method_name, int method_len) /* {{{ */ { zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function)); - TSRMLS_FETCH(); call_user_call->type = ZEND_INTERNAL_FUNCTION; call_user_call->module = zobj->ce->module; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.303&r2=1.304&diff_format=u Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.303 ZendEngine2/zend_operators.c:1.304 --- ZendEngine2/zend_operators.c:1.303 Thu Mar 26 20:01:38 2009 +++ ZendEngine2/zend_operators.cThu Mar 26 22:16:47 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_operators.c,v 1.303 2009/03/26 20:01:38 felipe Exp $ */ +/* $Id: zend_operators.c,v 1.304 2009/03/26 22:16:47 felipe Exp $ */ #include @@ -2330,8 +2330,6 @@ int ch; if (Z_USTRLEN_P(str) == 0) { - TSRMLS_FETCH(); - USTR_FREE(Z_USTRVAL_P(str)); ZVAL_ASCII_STRINGL(str, "1", sizeof("1")-1, 1); return; http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.220&r2=1.221&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.220 php-src/ext/date/php_date.c:1.221 --- php-src/ext/date/php_date.c:1.220
[PHP-CVS] cvs: php-src /ext/date php_date.c
tony2001Fri Mar 20 08:38:43 2009 UTC Modified files: /php-src/ext/date php_date.c Log: set return_len to 0 when returning empty string and fix segfault http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.218&r2=1.219&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.218 php-src/ext/date/php_date.c:1.219 --- php-src/ext/date/php_date.c:1.218 Tue Mar 10 23:39:11 2009 +++ php-src/ext/date/php_date.c Fri Mar 20 08:38:42 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.218 2009/03/10 23:39:11 helly Exp $ */ +/* $Id: php_date.c,v 1.219 2009/03/20 08:38:42 tony2001 Exp $ */ #include "php.h" #include "php_streams.h" @@ -1082,6 +1082,7 @@ int rfc_colon; if (!format_len) { + *return_len = 0; if (UG(unicode)) { return (char*)eustrdup(EMPTY_STR); } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests date_default_timezone_get-1.phpt date_default_timezone_get-2.phpt date_default_timezone_set-1.phpt idate_variation7.phpt timestamp-in-dst.p
derick Tue Jan 27 13:44:38 2009 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/tests date_default_timezone_get-1.phpt date_default_timezone_get-2.phpt date_default_timezone_set-1.phpt idate_variation7.phpt timestamp-in-dst.phpt Log: - Elevate no-tz setting made from E_STRICT to E_WARNING. #- [DOC] http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.216&r2=1.217&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.216 php-src/ext/date/php_date.c:1.217 --- php-src/ext/date/php_date.c:1.216 Wed Dec 31 11:12:30 2008 +++ php-src/ext/date/php_date.c Tue Jan 27 13:44:38 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.216 2008/12/31 11:12:30 sebastian Exp $ */ +/* $Id: php_date.c,v 1.217 2009/01/27 13:44:38 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -714,8 +714,8 @@ #define DATE_FORMAT_ISO8601 "Y-m-d\\TH:i:sO" #define DATE_TZ_ERRMSG \ - "It is not safe to rely on the system's timezone settings. Please use " \ - "the date.timezone setting, the TZ environment variable or the " \ + "It is not safe to rely on the system's timezone settings. You are " \ + "*required* to use the date.timezone setting or the " \ "date_default_timezone_set() function. In case you used any of those " \ "methods and you are still getting this warning, you most likely " \ "misspelled the timezone identifier. " @@ -852,7 +852,7 @@ tzid = "UTC"; } - php_error_docref(NULL TSRMLS_CC, E_STRICT, DATE_TZ_ERRMSG "We selected '%s' for '%s/%.1f/%s' instead", tzid, ta ? ta->tm_zone : "Unknown", ta ? (float) (ta->tm_gmtoff / 3600) : 0, ta ? (ta->tm_isdst ? "DST" : "no DST") : "Unknown"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%s/%.1f/%s' instead", tzid, ta ? ta->tm_zone : "Unknown", ta ? (float) (ta->tm_gmtoff / 3600) : 0, ta ? (ta->tm_isdst ? "DST" : "no DST") : "Unknown"); return tzid; } #endif @@ -871,7 +871,7 @@ if (! tzid) { tzid = "UTC"; } - php_error_docref(NULL TSRMLS_CC, E_STRICT, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/no DST' instead", tzid, ((tzi.Bias + tzi.StandardBias) / -60.0)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/no DST' instead", tzid, ((tzi.Bias + tzi.StandardBias) / -60.0)); break; /* DST in effect */ @@ -885,7 +885,7 @@ if (! tzid) { tzid = "UTC"; } - php_error_docref(NULL TSRMLS_CC, E_STRICT, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/DST' instead", tzid, ((tzi.Bias + tzi.DaylightBias) / -60.0)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/DST' instead", tzid, ((tzi.Bias + tzi.DaylightBias) / -60.0)); break; } return tzid; http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_default_timezone_get-1.phpt?r1=1.8&r2=1.9&diff_format=u Index: php-src/ext/date/tests/date_default_timezone_get-1.phpt diff -u php-src/ext/date/tests/date_default_timezone_get-1.phpt:1.8 php-src/ext/date/tests/date_default_timezone_get-1.phpt:1.9 --- php-src/ext/date/tests/date_default_timezone_get-1.phpt:1.8 Tue Dec 20 19:50:05 2005 +++ php-src/ext/date/tests/date_default_timezone_get-1.phpt Tue Jan 27 13:44:38 2009 @@ -9,8 +9,8 @@ echo date('e'), "\n"; ?> --EXPECTF-- -Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3 +Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3 UTC -Strict Standards: date(): It is not
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests bug46268.phpt
derick Thu Dec 18 20:32:44 2008 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/tests bug46268.phpt Log: - Fixed bug #46268 (DateTime::modify() does not reset relative time values). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.214&r2=1.215&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.214 php-src/ext/date/php_date.c:1.215 --- php-src/ext/date/php_date.c:1.214 Thu Dec 18 14:54:50 2008 +++ php-src/ext/date/php_date.c Thu Dec 18 20:32:44 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.214 2008/12/18 14:54:50 derick Exp $ */ +/* $Id: php_date.c,v 1.215 2008/12/18 20:32:44 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2871,6 +2871,7 @@ timelib_update_ts(dateobj->time, NULL); timelib_update_from_sse(dateobj->time); + dateobj->time->have_relative = 0; RETURN_ZVAL(object, 1, 0); } @@ -2915,6 +2916,7 @@ timelib_update_ts(dateobj->time, NULL); timelib_update_from_sse(dateobj->time); + dateobj->time->have_relative = 0; RETURN_ZVAL(object, 1, 0); } http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug46268.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/bug46268.phpt diff -u /dev/null php-src/ext/date/tests/bug46268.phpt:1.2 --- /dev/null Thu Dec 18 20:32:44 2008 +++ php-src/ext/date/tests/bug46268.phptThu Dec 18 20:32:44 2008 @@ -0,0 +1,23 @@ +--TEST-- +Bug #46268 (When call DateTime#setTime, it seems to be called the last modify method too) +--FILE-- +format("Y-m-d H:i:s") . PHP_EOL; + +$now->modify("1 day after"); +echo $now->format("Y-m-d H:i:s") . PHP_EOL; + +$now->modify("1 hour after"); +echo $now->format("Y-m-d H:i:s") . PHP_EOL; + +$now->setTime(0, 0, 0); +//date_time_set($now, 0, 0, 0); +echo $now->format("Y-m-d H:i:s") . PHP_EOL; +--EXPECT-- +2008-10-10 01:02:03 +2008-10-11 01:02:03 +2008-10-11 02:02:03 +2008-10-11 00:00:00 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/lib parse_date.c parse_date.re timelib.h
derick Thu Dec 18 14:54:51 2008 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/lib parse_date.c parse_date.re timelib.h Log: - Fixed bug #46889: Memory leak in strtotime(). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.213&r2=1.214&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.213 php-src/ext/date/php_date.c:1.214 --- php-src/ext/date/php_date.c:1.213 Tue Dec 2 18:01:07 2008 +++ php-src/ext/date/php_date.c Thu Dec 18 14:54:50 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.213 2008/12/02 18:01:07 derick Exp $ */ +/* $Id: php_date.c,v 1.214 2008/12/18 14:54:50 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1513,7 +1513,7 @@ t = timelib_strtotime(times, time_len, &error, DATE_TIMEZONEDB); error1 = error->error_count; timelib_error_container_dtor(error); - timelib_fill_holes(t, now, 0); + timelib_fill_holes(t, now, TIMELIB_NO_CLONE); timelib_update_ts(t, tzi); ts = timelib_date_to_int(t, &error2); http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.100&r2=1.101&diff_format=u Index: php-src/ext/date/lib/parse_date.c diff -u php-src/ext/date/lib/parse_date.c:1.100 php-src/ext/date/lib/parse_date.c:1.101 --- php-src/ext/date/lib/parse_date.c:1.100 Wed Nov 5 10:41:48 2008 +++ php-src/ext/date/lib/parse_date.c Thu Dec 18 14:54:50 2008 @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Wed Nov 5 11:39:34 2008 */ +/* Generated by re2c 0.13.5 on Thu Dec 18 15:50:45 2008 */ #line 1 "ext/date/lib/parse_date.re" /* +--+ @@ -18,7 +18,7 @@ +--+ */ -/* $Id: parse_date.c,v 1.100 2008/11/05 10:41:48 derick Exp $ */ +/* $Id: parse_date.c,v 1.101 2008/12/18 14:54:50 derick Exp $ */ #include "timelib.h" @@ -24232,7 +24232,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options) { - if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) { + if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) { parsed->h = 0; parsed->i = 0; parsed->s = 0; @@ -24252,7 +24252,7 @@ parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL; } if (!parsed->tz_info) { - parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL; + parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL; } if (parsed->zone_type == 0 && now->zone_type != 0) { parsed->zone_type = now->zone_type; http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.re?r1=1.91&r2=1.92&diff_format=u Index: php-src/ext/date/lib/parse_date.re diff -u php-src/ext/date/lib/parse_date.re:1.91 php-src/ext/date/lib/parse_date.re:1.92 --- php-src/ext/date/lib/parse_date.re:1.91 Wed Nov 5 10:41:48 2008 +++ php-src/ext/date/lib/parse_date.re Thu Dec 18 14:54:51 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_date.re,v 1.91 2008/11/05 10:41:48 derick Exp $ */ +/* $Id: parse_date.re,v 1.92 2008/12/18 14:54:51 derick Exp $ */ #include "timelib.h" @@ -2089,7 +2089,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options) { - if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) { + if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) { parsed->h = 0; parsed->i = 0; parsed->s = 0; @@ -2109,7 +2109,7 @@ parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL; } if (!parsed->tz_info) { - parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL; + parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL; } if (parsed->zone_type == 0 && now->zone_type != 0) { parsed->zone_type = now->zone_type; http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/timelib.h?r1=1.32&r2=1.33&diff_format=u Index: php-src/ext/date/lib/timelib.h diff -u php-src/ext/date/lib/timelib.h:1.32 php-src/ext/date/lib/timelib.h:1.33 --- php-src/ext/date/lib/timelib.h:1.32 Tue Jul 15 17:37:33 2008 +++ php-src/ext/date/lib/timelib.h Thu Dec 18 14:54:51 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: timelib.h,v 1.32 2008/07/15 17:37:33 derick Exp $ */ +/* $Id: timel
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests mktime-3-64bit.phpt
derick Tue Dec 2 18:01:07 2008 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/tests mktime-3-64bit.phpt Log: - Fixed bug #46732 (mktime.year description is wrong). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.212&r2=1.213&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.212 php-src/ext/date/php_date.c:1.213 --- php-src/ext/date/php_date.c:1.212 Wed Nov 19 01:59:07 2008 +++ php-src/ext/date/php_date.c Tue Dec 2 18:01:07 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.212 2008/11/19 01:59:07 colder Exp $ */ +/* $Id: php_date.c,v 1.213 2008/12/02 18:01:07 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1558,7 +1558,7 @@ case 6: if (yea >= 0 && yea < 70) { yea += 2000; - } else if (yea >= 70 && yea <= 110) { + } else if (yea >= 70 && yea <= 100) { yea += 1900; } now->y = yea; http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/mktime-3-64bit.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/mktime-3-64bit.phpt diff -u php-src/ext/date/tests/mktime-3-64bit.phpt:1.1 php-src/ext/date/tests/mktime-3-64bit.phpt:1.2 --- php-src/ext/date/tests/mktime-3-64bit.phpt:1.1 Mon Feb 25 22:32:26 2008 +++ php-src/ext/date/tests/mktime-3-64bit.phpt Tue Dec 2 18:01:07 2008 @@ -7,7 +7,7 @@ --FILE-- http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/dom attr.c cdatasection.c comment.c document.c documentfragment.c element.c entityreference.c processinginstruction.c text.c xpath.c /ext/mysqli mysq
colder Wed Nov 19 01:59:08 2008 UTC Added files: /ZendEngine2/tests bug46241.phpt Modified files: /ZendEngine2zend_execute_API.c zend_vm_def.h zend_vm_execute.h /ZendEngine2/tests bug46196.phpt /php-src/ext/date php_date.c /php-src/ext/domattr.c cdatasection.c comment.c document.c documentfragment.c element.c entityreference.c processinginstruction.c text.c xpath.c /php-src/ext/mysqli mysqli_driver.c /php-src/ext/simplexml simplexml.c /php-src/ext/splspl_array.c spl_directory.c spl_iterators.c spl_observer.c /php-src/ext/sqlite sqlite.c /php-src/ext/sqlite3sqlite3.c Log: Fix #46241 (stacked error_handlers, error_handling in general) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.466&r2=1.467&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.466 ZendEngine2/zend_execute_API.c:1.467 --- ZendEngine2/zend_execute_API.c:1.466Thu Oct 2 19:53:48 2008 +++ ZendEngine2/zend_execute_API.c Wed Nov 19 01:59:06 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_execute_API.c,v 1.466 2008/10/02 19:53:48 colder Exp $ */ +/* $Id: zend_execute_API.c,v 1.467 2008/11/19 01:59:06 colder Exp $ */ #include #include @@ -956,14 +956,11 @@ EG(opline_ptr) = original_opline_ptr; } else if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { int call_via_handler = (EX(function_state).function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0; - zend_error_handling error_handling; - zend_save_error_handling(&error_handling TSRMLS_CC); ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr); if (EX(function_state).function->common.scope) { EG(scope) = EX(function_state).function->common.scope; } ((zend_internal_function *) EX(function_state).function)->handler(fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, (fci->object_pp?*fci->object_pp:NULL), 1 TSRMLS_CC); - zend_restore_error_handling(&error_handling TSRMLS_CC); /* We shouldn't fix bad extensions here, because it can break proper ones (Bug #34045) if (!EX(function_state).function->common.return_reference) @@ -984,10 +981,7 @@ /* Not sure what should be done here if it's a static method */ if (fci->object_pp) { - zend_error_handling error_handling; - zend_save_error_handling(&error_handling TSRMLS_CC); Z_OBJ_HT_PP(fci->object_pp)->call_method(EX(function_state).function->common.function_name, fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, *fci->object_pp, 1 TSRMLS_CC); - zend_restore_error_handling(&error_handling TSRMLS_CC); } else { zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object"); } http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.247&r2=1.248&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.247 ZendEngine2/zend_vm_def.h:1.248 --- ZendEngine2/zend_vm_def.h:1.247 Mon Oct 6 00:35:19 2008 +++ ZendEngine2/zend_vm_def.h Wed Nov 19 01:59:07 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: zend_vm_def.h,v 1.247 2008/10/06 00:35:19 felipe Exp $ */ +/* $Id: zend_vm_def.h,v 1.248 2008/11/19 01:59:07 colder Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -2342,7 +2342,6 @@ EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC); if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { - zend_error_handling error_handling; ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr); EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference; @@ -2357,14 +2356,12 @@ arg_count--; } } - zend_save_error_handling(&error_handling TSRMLS_CC); if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ ((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, &EX_T(opline->result.u.var).var.ptr, E
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h
derick Thu Nov 6 09:44:03 2008 UTC Modified files: /php-src/ext/date php_date.c php_date.h Log: - Export DateTime and DateTimeZone class entries so that external extensions can make use of it as well. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.209&r2=1.210&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.209 php-src/ext/date/php_date.c:1.210 --- php-src/ext/date/php_date.c:1.209 Sun Nov 2 21:10:07 2008 +++ php-src/ext/date/php_date.c Thu Nov 6 09:44:03 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.209 2008/11/02 21:10:07 felipe Exp $ */ +/* $Id: php_date.c,v 1.210 2008/11/06 09:44:03 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -564,55 +564,22 @@ zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period; + +PHPAPI zend_class_entry *php_date_get_date_ce(void) +{ + return date_ce_date; +} + +PHPAPI zend_class_entry *php_date_get_timezone_ce(void) +{ + return date_ce_timezone; +} + static zend_object_handlers date_object_handlers_date; static zend_object_handlers date_object_handlers_timezone; static zend_object_handlers date_object_handlers_interval; static zend_object_handlers date_object_handlers_period; -typedef struct _php_date_obj php_date_obj; -typedef struct _php_timezone_obj php_timezone_obj; -typedef struct _php_interval_obj php_interval_obj; -typedef struct _php_period_obj php_period_obj; - -struct _php_date_obj { - zend_object std; - timelib_time *time; - HashTable*props; -}; - -struct _php_timezone_obj { - zend_object std; - int initialized; - int type; - union { - timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */ - timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */ - struct /* TIMELIB_ZONETYPE_ABBR */ - { - timelib_sll utc_offset; - char*abbr; - int dst; - } z; - } tzi; -}; - -struct _php_interval_obj { - zend_object std; - timelib_rel_time *diff; - HashTable*props; - int initialized; -}; - -struct _php_period_obj { - zend_object std; - timelib_time *start; - timelib_time *end; - timelib_rel_time *interval; - int recurrences; - int initialized; - int include_start_date; -}; - #define DATE_SET_CONTEXT \ zval *object; \ object = getThis(); \ @@ -2746,7 +2713,7 @@ /* }}} */ /* Helper function used to add an associative array of warnings and errors to a zval */ -void zval_from_error_container(zval *z, timelib_error_container *error) +static void zval_from_error_container(zval *z, timelib_error_container *error) { int i; zval *element; http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.h?r1=1.41&r2=1.42&diff_format=u Index: php-src/ext/date/php_date.h diff -u php-src/ext/date/php_date.h:1.41 php-src/ext/date/php_date.h:1.42 --- php-src/ext/date/php_date.h:1.41Fri Jul 18 14:33:27 2008 +++ php-src/ext/date/php_date.h Thu Nov 6 09:44:03 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.h,v 1.41 2008/07/18 14:33:27 derick Exp $ */ +/* $Id: php_date.h,v 1.42 2008/11/06 09:44:03 derick Exp $ */ #ifndef PHP_DATE_H #define PHP_DATE_H @@ -105,6 +105,50 @@ PHP_MSHUTDOWN_FUNCTION(date); PHP_MINFO_FUNCTION(date); +typedef struct _php_date_obj php_date_obj; +typedef struct _php_timezone_obj php_timezone_obj; +typedef struct _php_interval_obj php_interval_obj; +typedef struct _php_period_obj php_period_obj; + +struct _php_date_obj { + zend_object std; + timelib_time *time; + HashTable*props; +}; + +struct _php_timezone_obj { + zend_object std; + int initialized; + int type; + union { + timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */ + timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */ + struct /* TIMELIB_ZONETYPE_ABBR */ + { + timelib_sll utc_offset; + char*abbr; + int dst; + } z; + } tzi; +}; + +struct _php_interval_obj { + zend_object std; + timelib_rel_time *diff; + HashTable*props; + int initialized; +}; + +struct _php_period_obj { + zend_object std; + timelib_time *start; + timelib_time *end; + timelib_rel_time *interval; + int recurrences; +
[PHP-CVS] cvs: php-src /ext/date php_date.c
tony2001Sat Aug 9 21:58:40 2008 UTC Modified files: /php-src/ext/date php_date.c Log: fix leak http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.205&r2=1.206&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.205 php-src/ext/date/php_date.c:1.206 --- php-src/ext/date/php_date.c:1.205 Fri Aug 8 22:06:42 2008 +++ php-src/ext/date/php_date.c Sat Aug 9 21:58:40 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.205 2008/08/08 22:06:42 colder Exp $ */ +/* $Id: php_date.c,v 1.206 2008/08/09 21:58:40 tony2001 Exp $ */ #include "php.h" #include "php_streams.h" @@ -2311,7 +2311,7 @@ abs(utc_offset / 60), abs((utc_offset % 60))); - ZVAL_ASCII_STRING(zv, tmpstr, 0); + ZVAL_ASCII_STRING(zv, tmpstr, ZSTR_AUTOFREE); } break; case TIMELIB_ZONETYPE_ABBR: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/dom attr.c cdatasection.c comment.c document.c documentfragment.c element.c entityreference.c processinginstruction.c text.c xpath.c /ext/mysqli mysq
colder Fri Aug 8 22:06:43 2008 UTC Modified files: /php-src/ext/sqlite sqlite.c /php-src/ext/splspl_array.c spl_iterators.c spl_observer.c spl_directory.c /php-src/ext/mysqli mysqli_driver.c /php-src/ext/simplexml simplexml.c /php-src/ext/date php_date.c /php-src/ext/domdocumentfragment.c element.c processinginstruction.c attr.c document.c entityreference.c comment.c xpath.c text.c cdatasection.c Log: Fix error_handling usage in various extensions http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite/sqlite.c?r1=1.212&r2=1.213&diff_format=u Index: php-src/ext/sqlite/sqlite.c diff -u php-src/ext/sqlite/sqlite.c:1.212 php-src/ext/sqlite/sqlite.c:1.213 --- php-src/ext/sqlite/sqlite.c:1.212 Sat Aug 2 04:40:45 2008 +++ php-src/ext/sqlite/sqlite.c Fri Aug 8 22:06:42 2008 @@ -17,7 +17,7 @@ | Marcus Boerger <[EMAIL PROTECTED]> | +--+ - $Id: sqlite.c,v 1.212 2008/08/02 04:40:45 felipe Exp $ + $Id: sqlite.c,v 1.213 2008/08/08 22:06:42 colder Exp $ */ #ifdef HAVE_CONFIG_H @@ -1612,7 +1612,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "SQLite support", "enabled"); - php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.212 2008/08/02 04:40:45 felipe Exp $"); + php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.213 2008/08/08 22:06:42 colder Exp $"); php_info_print_table_row(2, "SQLite Library", sqlite_libversion()); php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding()); php_info_print_table_end(); @@ -1780,10 +1780,9 @@ zval *errmsg = NULL; zval *object = getThis(); - php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC); + zend_replace_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception, NULL TSRMLS_CC); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|lz/", &ppfilename, &mode, &errmsg) || FAILURE == php_stream_path_param_encode(ppfilename, &filename, &filename_len, REPORT_ERRORS, FG(default_context))) { - php_std_error_handling(); return; } if (errmsg) { @@ -1794,7 +1793,6 @@ if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) { /* resolve the fully-qualified path name to use as the hash key */ if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { - php_std_error_handling(); if (object) { RETURN_NULL(); } else { @@ -1803,7 +1801,6 @@ } if (php_check_open_basedir(fullpath TSRMLS_CC)) { - php_std_error_handling(); efree(fullpath); if (object) { RETURN_NULL(); @@ -1818,7 +1815,6 @@ if (fullpath) { efree(fullpath); } - php_std_error_handling(); } /* }}} */ @@ -1832,10 +1828,9 @@ int filename_len; zval *errmsg = NULL; - php_set_error_handling(EH_THROW, sqlite_ce_exception TSRMLS_CC); + zend_replace_error_handling(EH_THROW, sqlite_ce_exception, NULL TSRMLS_CC); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|lz/", &ppfilename, &mode, &errmsg) || FAILURE == php_stream_path_param_encode(ppfilename, &filename, &filename_len, REPORT_ERRORS, FG(default_context))) { - php_std_error_handling(); RETURN_NULL(); } if (errmsg) { @@ -1846,13 +1841,11 @@ if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) { /* resolve the fully-qualified path name to use as the hash key */ if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { - php_std_error_handling(); RETURN_NULL(); } if (php_check_open_basedir(fullpath TSRMLS_CC)) { efree(fullpath); - php_std_error_handling(); RETURN_NULL(); } } @@ -1861,7 +1854,6 @@ if (fullpath) { efree(fullpath); } - php_std_error_handling(); } /* }}} */ @@ -2629,11 +2621,11 @@ zval *retval_ptr; zval *ctor_params = NULL; zend_uchar class_name_type; + zend_error_handling error_handling; - php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC); + zend_replace_error_handling(object ? E
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Sun Aug 3 16:44:31 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed bug #45696 (Not all DateTime methods allow method chaining). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.203&r2=1.204&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.203 php-src/ext/date/php_date.c:1.204 --- php-src/ext/date/php_date.c:1.203 Wed Jul 30 17:48:20 2008 +++ php-src/ext/date/php_date.c Sun Aug 3 16:44:31 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.203 2008/07/30 17:48:20 derick Exp $ */ +/* $Id: php_date.c,v 1.204 2008/08/03 16:44:31 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2992,23 +2992,29 @@ intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC); DATE_CHECK_INITIALIZED(intobj->initialized, DateInterval); - if (intobj->diff->invert) { - bias = -1; - } - dateobj->time->relative.y = intobj->diff->y * bias; - dateobj->time->relative.m = intobj->diff->m * bias; - dateobj->time->relative.d = intobj->diff->d * bias; - dateobj->time->relative.h = intobj->diff->h * bias; - dateobj->time->relative.i = intobj->diff->i * bias; - dateobj->time->relative.s = intobj->diff->s * bias; + if (intobj->diff->have_weekday_relative || intobj->diff->have_special_relative) { + memcpy(&dateobj->time->relative, intobj->diff, sizeof(struct timelib_rel_time)); + } else { + if (intobj->diff->invert) { + bias = -1; + } + dateobj->time->relative.y = intobj->diff->y * bias; + dateobj->time->relative.m = intobj->diff->m * bias; + dateobj->time->relative.d = intobj->diff->d * bias; + dateobj->time->relative.h = intobj->diff->h * bias; + dateobj->time->relative.i = intobj->diff->i * bias; + dateobj->time->relative.s = intobj->diff->s * bias; + dateobj->time->relative.weekday = 0; + dateobj->time->relative.have_weekday_relative = 0; + } dateobj->time->have_relative = 1; - dateobj->time->relative.weekday = 0; - dateobj->time->relative.have_weekday_relative = 0; dateobj->time->sse_uptodate = 0; timelib_update_ts(dateobj->time, NULL); timelib_update_from_sse(dateobj->time); + + RETURN_ZVAL(object, 1, 0); } /* }}} */ @@ -3047,6 +3053,8 @@ timelib_update_ts(dateobj->time, NULL); timelib_update_from_sse(dateobj->time); + + RETURN_ZVAL(object, 1, 0); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/lib parse_date.c parse_date.re /ext/date/tests 012.phpt 013.phpt date_parse_001.phpt
derick Wed Jul 30 17:48:21 2008 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/lib parse_date.c parse_date.re /php-src/ext/date/tests 012.phpt 013.phpt date_parse_001.phpt Log: - Fixed a bug with the -MM format not resetting the day correctly. - Fixed a bug in the DateTime->modify() methods, it would not use the advanced relative time strings. - Fixed return values of all the modifying methods, they now properly return the object itself. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.202&r2=1.203&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.202 php-src/ext/date/php_date.c:1.203 --- php-src/ext/date/php_date.c:1.202 Wed Jul 30 08:13:02 2008 +++ php-src/ext/date/php_date.c Wed Jul 30 17:48:20 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.202 2008/07/30 08:13:02 jani Exp $ */ +/* $Id: php_date.c,v 1.203 2008/07/30 17:48:20 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2962,20 +2962,15 @@ DATE_CHECK_INITIALIZED(dateobj->time, DateTime); tmp_time = timelib_strtotime(modify, modify_len, NULL, DATE_TIMEZONEDB); - dateobj->time->relative.y = tmp_time->relative.y; - dateobj->time->relative.m = tmp_time->relative.m; - dateobj->time->relative.d = tmp_time->relative.d; - dateobj->time->relative.h = tmp_time->relative.h; - dateobj->time->relative.i = tmp_time->relative.i; - dateobj->time->relative.s = tmp_time->relative.s; - dateobj->time->relative.weekday = tmp_time->relative.weekday; + memcpy(&dateobj->time->relative, &tmp_time->relative, sizeof(struct timelib_rel_time)); dateobj->time->have_relative = tmp_time->have_relative; - dateobj->time->relative.have_weekday_relative = tmp_time->relative.have_weekday_relative; dateobj->time->sse_uptodate = 0; timelib_time_dtor(tmp_time); timelib_update_ts(dateobj->time, NULL); timelib_update_from_sse(dateobj->time); + + RETURN_ZVAL(object, 1, 0); } /* }}} */ @@ -3115,6 +3110,8 @@ } timelib_set_timezone(dateobj->time, tzobj->tzi.tz); timelib_unixtime2local(dateobj->time, dateobj->time->sse); + + RETURN_ZVAL(object, 1, 0); } /* }}} */ @@ -3171,6 +3168,8 @@ dateobj->time->i = i; dateobj->time->s = s; timelib_update_ts(dateobj->time, NULL); + + RETURN_ZVAL(object, 1, 0); } /* }}} */ @@ -3192,6 +3191,8 @@ dateobj->time->m = m; dateobj->time->d = d; timelib_update_ts(dateobj->time, NULL); + + RETURN_ZVAL(object, 1, 0); } /* }}} */ @@ -3216,6 +3217,8 @@ dateobj->time->have_relative = 1; timelib_update_ts(dateobj->time, NULL); + + RETURN_ZVAL(object, 1, 0); } /* }}} */ @@ -3235,6 +3238,8 @@ DATE_CHECK_INITIALIZED(dateobj->time, DateTime); timelib_unixtime2local(dateobj->time, (timelib_sll)timestamp); timelib_update_ts(dateobj->time, NULL); + + RETURN_ZVAL(object, 1, 0); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.97&r2=1.98&diff_format=u Index: php-src/ext/date/lib/parse_date.c diff -u php-src/ext/date/lib/parse_date.c:1.97 php-src/ext/date/lib/parse_date.c:1.98 --- php-src/ext/date/lib/parse_date.c:1.97 Wed Jul 23 19:52:50 2008 +++ php-src/ext/date/lib/parse_date.c Wed Jul 30 17:48:20 2008 @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Wed Jul 23 21:49:54 2008 */ +/* Generated by re2c 0.13.5 on Wed Jul 30 19:25:10 2008 */ #line 1 "ext/date/lib/parse_date.re" /* +--+ @@ -18,7 +18,7 @@ +--+ */ -/* $Id: parse_date.c,v 1.97 2008/07/23 19:52:50 derick Exp $ */ +/* $Id: parse_date.c,v 1.98 2008/07/30 17:48:20 derick Exp $ */ #include "timelib.h" @@ -982,7 +982,7 @@ } yy3: YYDEBUG(3, *YYCURSOR); -#line 1605 "ext/date/lib/parse_date.re" +#line 1606 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("tzcorrection | tz"); @@ -1306,7 +1306,7 @@ if (yych <= '9') goto yy1343; yy12: YYDEBUG(12, *YYCURSOR); -#line 1700 "ext/date/lib/parse_date.re" +#line 1701 "ext/date/lib/parse_date.re" { add_error(s, "Unexpected character"); goto std; @@ -2334,7 +2334,7 @@ if (yych <= '9') goto yy52; yy47: YYDEBUG(47, *YYCURSOR); -#line 1689 "ext/date/lib/parse_date.re" +#line 1690 "ext/date/lib/parse_date.re" { goto std; } @@ -2347,7 +2347,7 @@ YYDEBUG(49, *YYCURSOR); ++YYCURSOR; YYDEBUG(50, *YYCURSOR); -#line 1694 "ext/date/lib/parse_date.re" +#line 1695 "ext/date/lib/pa
[PHP-CVS] cvs: php-src /ext/date php_date.c
janiWed Jul 30 08:13:03 2008 UTC Modified files: /php-src/ext/date php_date.c Log: ws http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.201&r2=1.202&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.201 php-src/ext/date/php_date.c:1.202 --- php-src/ext/date/php_date.c:1.201 Tue Jul 29 12:56:18 2008 +++ php-src/ext/date/php_date.c Wed Jul 30 08:13:02 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.201 2008/07/29 12:56:18 dmitry Exp $ */ +/* $Id: php_date.c,v 1.202 2008/07/30 08:13:02 jani Exp $ */ #include "php.h" #include "php_streams.h" @@ -660,8 +660,8 @@ /* This is need to ensure that session extension request shutdown occurs 1st, because it uses the date extension */ static const zend_module_dep date_deps[] = { -ZEND_MOD_OPTIONAL("session") -{NULL, NULL, NULL} + ZEND_MOD_OPTIONAL("session") + {NULL, NULL, NULL} }; /* {{{ Module struct */ @@ -2105,21 +2105,21 @@ zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) { -date_period_it *iterator = emalloc(sizeof(date_period_it)); -php_period_obj *dpobj= (php_period_obj *)zend_object_store_get_object(object TSRMLS_CC); + date_period_it *iterator = emalloc(sizeof(date_period_it)); + php_period_obj *dpobj= (php_period_obj *)zend_object_store_get_object(object TSRMLS_CC); + + if (by_ref) { + zend_error(E_ERROR, "An iterator cannot be used with foreach by reference"); + } -if (by_ref) { -zend_error(E_ERROR, "An iterator cannot be used with foreach by reference"); -} - -Z_ADDREF_P(object); -iterator->intern.data = (void*) dpobj; -iterator->intern.funcs = &date_period_it_funcs; + Z_ADDREF_P(object); + iterator->intern.data = (void*) dpobj; + iterator->intern.funcs = &date_period_it_funcs; iterator->date_period_zval = object; -iterator->object = dpobj; -iterator->current = NULL; + iterator->object = dpobj; + iterator->current = NULL; -return (zend_object_iterator*)iterator; + return (zend_object_iterator*)iterator; } static void date_register_classes(TSRMLS_D) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
dmitry Tue Jul 29 12:56:19 2008 UTC Modified files: /php-src/ext/date php_date.c Log: Fixed memory leak http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.200&r2=1.201&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.200 php-src/ext/date/php_date.c:1.201 --- php-src/ext/date/php_date.c:1.200 Sun Jul 27 19:09:36 2008 +++ php-src/ext/date/php_date.c Tue Jul 29 12:56:18 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.200 2008/07/27 19:09:36 derick Exp $ */ +/* $Id: php_date.c,v 1.201 2008/07/29 12:56:18 dmitry Exp $ */ #include "php.h" #include "php_streams.h" @@ -1974,6 +1974,7 @@ /* define an overloaded iterator structure */ typedef struct { zend_object_iterator intern; + zval *date_period_zval; zval *current; php_period_obj *object; int current_index; @@ -1999,6 +2000,8 @@ date_period_it_invalidate_current(iter TSRMLS_CC); + zval_ptr_dtor(&iterator->date_period_zval); + efree(iterator); } /* }}} */ @@ -2112,7 +2115,7 @@ Z_ADDREF_P(object); iterator->intern.data = (void*) dpobj; iterator->intern.funcs = &date_period_it_funcs; -MAKE_STD_ZVAL(iterator->current); + iterator->date_period_zval = object; iterator->object = dpobj; iterator->current = NULL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests date-set-timestamp.phpt
derick Sun Jul 27 19:09:37 2008 UTC Added files: /php-src/ext/date/tests date-set-timestamp.phpt Modified files: /php-src/ext/date php_date.c Log: - Fixed DateTime::setTimestamp() and added a test for it. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.199&r2=1.200&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.199 php-src/ext/date/php_date.c:1.200 --- php-src/ext/date/php_date.c:1.199 Sun Jul 20 20:58:35 2008 +++ php-src/ext/date/php_date.c Sun Jul 27 19:09:36 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.199 2008/07/20 20:58:35 derick Exp $ */ +/* $Id: php_date.c,v 1.200 2008/07/27 19:09:36 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -3230,7 +3230,7 @@ } dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); DATE_CHECK_INITIALIZED(dateobj->time, DateTime); - timelib_unixtime2gmt(dateobj->time, (timelib_sll)timestamp); + timelib_unixtime2local(dateobj->time, (timelib_sll)timestamp); timelib_update_ts(dateobj->time, NULL); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date-set-timestamp.phpt?view=markup&rev=1.1 Index: php-src/ext/date/tests/date-set-timestamp.phpt +++ php-src/ext/date/tests/date-set-timestamp.phpt --TEST-- DateTime::setTimestamp() --INI-- date.timezone=Europe/Oslo --FILE-- format( "Y-m-d H:i e\n" ); $d = new DateTime(); $d->setTimestamp( 1217184864 ); echo $d->format( "Y-m-d H:i e\n" ); ?> --EXPECT-- 2008-07-27 18:54 +00:00 2008-07-27 20:54 Europe/Oslo -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Sun Jul 20 20:58:35 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed bug #45562 (Creating instance of DatePeriod crashes). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.198&r2=1.199&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.198 php-src/ext/date/php_date.c:1.199 --- php-src/ext/date/php_date.c:1.198 Sat Jul 19 17:38:15 2008 +++ php-src/ext/date/php_date.c Sun Jul 20 20:58:35 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.198 2008/07/19 17:38:15 derick Exp $ */ +/* $Id: php_date.c,v 1.199 2008/07/20 20:58:35 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -3730,6 +3730,7 @@ time = timelib_strtotime(time_str, time_str_len, &err, DATE_TIMEZONEDB); diobj = (php_interval_obj *) zend_object_store_get_object(return_value TSRMLS_CC); diobj->diff = timelib_rel_time_clone(&time->relative); + diobj->initialized = 1; timelib_time_dtor(time); timelib_error_container_dtor(err); } @@ -3846,7 +3847,7 @@ zval *start, *end = NULL, *interval; long recurrences = 0, options = 0; char *isostr = NULL; - int isostr_len; + int isostr_len = 0; timelib_time *clone; php_set_error_handling(EH_THROW, NULL TSRMLS_CC); @@ -3873,7 +3874,9 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ISO interval '%s' did not contain an end date or a recurrence count.", isostr); } - timelib_update_ts(dpobj->start, NULL); + if (dpobj->start) { + timelib_update_ts(dpobj->start, NULL); + } if (dpobj->end) { timelib_update_ts(dpobj->end, NULL); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Sat Jul 19 17:38:15 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Country codes are ISO 3166. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.197&r2=1.198&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.197 php-src/ext/date/php_date.c:1.198 --- php-src/ext/date/php_date.c:1.197 Fri Jul 18 14:33:27 2008 +++ php-src/ext/date/php_date.c Sat Jul 19 17:38:15 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.197 2008/07/18 14:33:27 derick Exp $ */ +/* $Id: php_date.c,v 1.198 2008/07/19 17:38:15 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -3956,7 +3956,7 @@ /* Extra validation */ if (what == PHP_DATE_TIMEZONE_PER_COUNTRY && option_len != 2) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "A two-letter ISO 639-2 compatible country code is expected"); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "A two-letter ISO 3166-1 compatible country code is expected"); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h /ext/date/lib parse_tz.c timelib_structs.h
derick Fri Jul 18 14:33:27 2008 UTC Modified files: /php-src/ext/date php_date.c php_date.h /php-src/ext/date/lib parse_tz.c timelib_structs.h Log: - Added support for selectively listing timezone identifiers by country code through timezone_identifiers_list() / DateTimezone::listIdentifiers(). - Added timezone_location_get() / DateTimezone::getLocation() for retrieving location information from timezones. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.196&r2=1.197&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.196 php-src/ext/date/php_date.c:1.197 --- php-src/ext/date/php_date.c:1.196 Wed Jul 16 12:35:45 2008 +++ php-src/ext/date/php_date.c Fri Jul 18 14:33:27 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.196 2008/07/16 12:35:45 derick Exp $ */ +/* $Id: php_date.c,v 1.197 2008/07/18 14:33:27 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -372,6 +372,15 @@ ZEND_END_ARG_INFO() static +ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_location_get, 0, 0, 1) + ZEND_ARG_INFO(0, object) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_timezone_method_location_get, 0) +ZEND_END_ARG_INFO() + +static ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_identifiers_list, 0, 0, 0) ZEND_ARG_INFO(0, what) ZEND_END_ARG_INFO() @@ -459,6 +468,7 @@ PHP_FE(timezone_name_from_abbr, arginfo_timezone_name_from_abbr) PHP_FE(timezone_offset_get, arginfo_timezone_offset_get) PHP_FE(timezone_transitions_get, arginfo_timezone_transitions_get) + PHP_FE(timezone_location_get, arginfo_timezone_location_get) PHP_FE(timezone_identifiers_list, arginfo_timezone_identifiers_list) PHP_FE(timezone_abbreviations_list, arginfo_timezone_abbreviations_list) @@ -503,6 +513,7 @@ PHP_ME_MAPPING(getName, timezone_name_get, arginfo_timezone_method_name_get, 0) PHP_ME_MAPPING(getOffset, timezone_offset_get, arginfo_timezone_method_offset_get, 0) PHP_ME_MAPPING(getTransitions,timezone_transitions_get, arginfo_timezone_method_transitions_get, 0) + PHP_ME_MAPPING(getLocation, timezone_location_get, arginfo_timezone_method_location_get, 0) PHP_ME_MAPPING(listAbbreviations, timezone_abbreviations_list, arginfo_timezone_abbreviations_list, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(listIdentifiers, timezone_identifiers_list, arginfo_timezone_identifiers_list, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) {NULL, NULL, NULL} @@ -1955,6 +1966,7 @@ #define PHP_DATE_TIMEZONE_GROUP_UTC0x0400 #define PHP_DATE_TIMEZONE_GROUP_ALL0x07FF #define PHP_DATE_TIMEZONE_GROUP_ALL_W_BC 0x0FFF +#define PHP_DATE_TIMEZONE_PER_COUNTRY 0x1000 #define PHP_DATE_PERIOD_EXCLUDE_START_DATE 0x0001 @@ -2157,6 +2169,7 @@ REGISTER_TIMEZONE_CLASS_CONST_STRING("UTC", PHP_DATE_TIMEZONE_GROUP_UTC); REGISTER_TIMEZONE_CLASS_CONST_STRING("ALL", PHP_DATE_TIMEZONE_GROUP_ALL); REGISTER_TIMEZONE_CLASS_CONST_STRING("ALL_WITH_BC", PHP_DATE_TIMEZONE_GROUP_ALL_W_BC); + REGISTER_TIMEZONE_CLASS_CONST_STRING("PER_COUNTRY", PHP_DATE_TIMEZONE_PER_COUNTRY); INIT_CLASS_ENTRY(ce_interval, "DateInterval", date_funcs_interval); ce_interval.create_object = date_object_new_interval; @@ -3531,6 +3544,31 @@ } /* }}} */ +/* {{{ proto array timezone_location_get() + Returns location information for a timezone, including country code, latitude/longitude and comments +*/ +PHP_FUNCTION(timezone_location_get) +{ + zval*object; + php_timezone_obj*tzobj; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_timezone) == FAILURE) { + RETURN_FALSE; + } + tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC); + DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone); + if (tzobj->type != TIMELIB_ZONETYPE_ID) { + RETURN_FALSE; + } + + array_init(return_value); + add_assoc_string(return_value, "country_code", tzobj->tzi.tz->location.country_code, 1); + add_assoc_double(return_value, "latitude", tzobj->tzi.tz->location.latitude); + add_assoc_double(return_value, "longitude", tzobj->tzi.tz->location.longitude); + add_assoc_string(return_value, "comments", tzobj->tzi.tz->location.comments, 1); +} +/* }}} */ + static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *format, int format_length TSRMLS_DC) { timelib_time *b = NULL, *e = NULL; @@ -3909,8 +3947,16 @@ const timelib_tzdb_index_entry *table; int i, item_count; longwhat = PHP_DATE_TIM
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Wed Jul 16 12:35:45 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - MF53: Fixed segfault. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.195&r2=1.196&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.195 php-src/ext/date/php_date.c:1.196 --- php-src/ext/date/php_date.c:1.195 Mon Jul 14 17:38:19 2008 +++ php-src/ext/date/php_date.c Wed Jul 16 12:35:45 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.195 2008/07/14 17:38:19 derick Exp $ */ +/* $Id: php_date.c,v 1.196 2008/07/16 12:35:45 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -3095,6 +3095,7 @@ tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC); if (tzobj->type != TIMELIB_ZONETYPE_ID) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only do this for zones with ID for now"); + return; } timelib_set_timezone(dateobj->time, tzobj->tzi.tz); timelib_unixtime2local(dateobj->time, dateobj->time->sse); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Mon Jul 14 17:38:19 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed reversed logic. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.194&r2=1.195&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.194 php-src/ext/date/php_date.c:1.195 --- php-src/ext/date/php_date.c:1.194 Mon Jul 14 17:30:08 2008 +++ php-src/ext/date/php_date.c Mon Jul 14 17:38:19 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.194 2008/07/14 17:30:08 derick Exp $ */ +/* $Id: php_date.c,v 1.195 2008/07/14 17:38:19 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1736,7 +1736,7 @@ RETURN_FALSE; } - if (y < 1 || y > 32767 || timelib_valid_date(y, m, d)) { + if (y < 1 || y > 32767 || !timelib_valid_date(y, m, d)) { RETURN_FALSE; } RETURN_TRUE;/* True : This month, day, year arguments are valid */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/lib dow.c parse_date.c parse_date.re timelib.h
derick Mon Jul 14 17:30:09 2008 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/lib dow.c parse_date.c parse_date.re timelib.h Log: - Added a warning to the error struct in case a parsed-date was found to be invalid. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.193&r2=1.194&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.193 php-src/ext/date/php_date.c:1.194 --- php-src/ext/date/php_date.c:1.193 Wed Jul 9 12:51:26 2008 +++ php-src/ext/date/php_date.c Mon Jul 14 17:30:08 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.193 2008/07/09 12:51:26 felipe Exp $ */ +/* $Id: php_date.c,v 1.194 2008/07/14 17:30:08 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1736,7 +1736,7 @@ RETURN_FALSE; } - if (y < 1 || y > 32767 || m < 1 || m > 12 || d < 1 || d > timelib_days_in_month(y, m)) { + if (y < 1 || y > 32767 || timelib_valid_date(y, m, d)) { RETURN_FALSE; } RETURN_TRUE;/* True : This month, day, year arguments are valid */ http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/dow.c?r1=1.14&r2=1.15&diff_format=u Index: php-src/ext/date/lib/dow.c diff -u php-src/ext/date/lib/dow.c:1.14 php-src/ext/date/lib/dow.c:1.15 --- php-src/ext/date/lib/dow.c:1.14 Fri Feb 22 17:48:31 2008 +++ php-src/ext/date/lib/dow.c Mon Jul 14 17:30:08 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: dow.c,v 1.14 2008/02/22 17:48:31 derick Exp $ */ +/* $Id: dow.c,v 1.15 2008/07/14 17:30:08 derick Exp $ */ #include "timelib.h" @@ -140,6 +140,13 @@ return day + ((w - 1) * 7) + d; } +int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d) +{ + if (m < 1 || m > 12 || d < 1 || d > timelib_days_in_month(y, m)) { + return 0; + } + return 1; +} #if 0 int main(void) { http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.92&r2=1.93&diff_format=u Index: php-src/ext/date/lib/parse_date.c diff -u php-src/ext/date/lib/parse_date.c:1.92 php-src/ext/date/lib/parse_date.c:1.93 --- php-src/ext/date/lib/parse_date.c:1.92 Fri Jul 11 08:42:10 2008 +++ php-src/ext/date/lib/parse_date.c Mon Jul 14 17:30:08 2008 @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Fri Jul 11 10:41:19 2008 */ +/* Generated by re2c 0.13.5 on Mon Jul 14 19:27:22 2008 */ #line 1 "ext/date/lib/parse_date.re" /* +--+ @@ -18,7 +18,7 @@ +--+ */ -/* $Id: parse_date.c,v 1.92 2008/07/11 08:42:10 derick Exp $ */ +/* $Id: parse_date.c,v 1.93 2008/07/14 17:30:08 derick Exp $ */ #include "timelib.h" @@ -23358,6 +23358,11 @@ #endif } while(t != EOI); + /* do funky checking whether the parsed date was valid date */ + if (in.time->have_date && !timelib_valid_date( in.time->y, in.time->m, in.time->d)) { + add_warning(&in, "The parsed date was invalid"); + } + free(in.str); if (errors) { *errors = in.errors; @@ -23625,6 +23630,12 @@ } } + /* do funky checking whether the parsed date was valid date */ + if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET && + s->time->d != TIMELIB_UNSET && + !timelib_valid_date( s->time->y, s->time->m, s->time->d)) { + add_pbf_warning(s, "The parsed date was invalid", string, ptr); + } if (errors) { *errors = in.errors; http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.re?r1=1.83&r2=1.84&diff_format=u Index: php-src/ext/date/lib/parse_date.re diff -u php-src/ext/date/lib/parse_date.re:1.83 php-src/ext/date/lib/parse_date.re:1.84 --- php-src/ext/date/lib/parse_date.re:1.83 Fri Jul 11 08:42:11 2008 +++ php-src/ext/date/lib/parse_date.re Mon Jul 14 17:30:09 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_date.re,v 1.83 2008/07/11 08:42:11 derick Exp $ */ +/* $Id: parse_date.re,v 1.84 2008/07/14 17:30:09 derick Exp $ */ #include "timelib.h" @@ -1768,6 +1768,11 @@ #endif } while(t != EOI); + /* do funky checking whether the parsed date was valid date */ + if (in.time->have_date && !timelib_valid_date( in.time->y, in.time->m, in.time->d)) { + add_warning(&in, "The parsed date was invalid"); + } + free(in.str); if (errors) { *errors = in.errors; @@ -2035,6 +2040,12 @@ } } + /* do funky checking whether the parsed date was valid date */ + if (s->time->y != TIMELIB_UNSET
[PHP-CVS] cvs: php-src /ext/date php_date.c
felipe Wed Jul 9 12:51:26 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - MFB: Added arginfo http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.192&r2=1.193&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.192 php-src/ext/date/php_date.c:1.193 --- php-src/ext/date/php_date.c:1.192 Tue Jul 8 19:29:06 2008 +++ php-src/ext/date/php_date.c Wed Jul 9 12:51:26 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.192 2008/07/08 19:29:06 derick Exp $ */ +/* $Id: php_date.c,v 1.193 2008/07/09 12:51:26 felipe Exp $ */ #include "php.h" #include "php_streams.h" @@ -147,6 +147,270 @@ ZEND_ARG_INFO(0, longitude) ZEND_END_ARG_INFO() +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create, 0, 0, 0) + ZEND_ARG_INFO(0, time) + ZEND_ARG_INFO(0, object) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create_from_format, 0, 0, 2) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, time) + ZEND_ARG_INFO(0, object) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_parse, 0, 0, 1) + ZEND_ARG_INFO(0, date) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_parse_from_format, 0, 0, 2) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, date) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_date_get_last_errors, 0) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_format, 0, 0, 2) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, format) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_format, 0, 0, 1) + ZEND_ARG_INFO(0, format) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_modify, 0, 0, 2) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, modify) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_modify, 0, 0, 1) + ZEND_ARG_INFO(0, modify) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_add, 0, 0, 2) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, interval) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_add, 0, 0, 1) + ZEND_ARG_INFO(0, interval) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sub, 0, 0, 2) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, interval) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_sub, 0, 0, 1) + ZEND_ARG_INFO(0, interval) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timezone_get, 0, 0, 1) + ZEND_ARG_INFO(0, object) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_date_method_timezone_get, 0) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timezone_set, 0, 0, 2) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, timezone) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_timezone_set, 0, 0, 1) + ZEND_ARG_INFO(0, timezone) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_offset_get, 0, 0, 1) + ZEND_ARG_INFO(0, object) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_date_method_offset_get, 0) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_diff, 0, 0, 2) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, object2) + ZEND_ARG_INFO(0, absolute) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_diff, 0, 0, 1) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, absolute) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_time_set, 0, 0, 3) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, hour) + ZEND_ARG_INFO(0, minute) + ZEND_ARG_INFO(0, second) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_time_set, 0, 0, 2) + ZEND_ARG_INFO(0, hour) + ZEND_ARG_INFO(0, minute) + ZEND_ARG_INFO(0, second) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_date_set, 0, 0, 4) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, year) + ZEND_ARG_INFO(0, month) + ZEND_ARG_INFO(0, day) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_date_set, 0, 0, 3) + ZEND_ARG_INFO(0, year) + ZEND_ARG_INFO(0, month) + ZEND_ARG_INFO(0, day) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_isodate_set, 0, 0, 3) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, year) + ZEND_ARG_INFO(0, week) + ZEND_ARG_INFO(0, day) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_isodate_set, 0, 0, 2) + ZEND_ARG_INFO(0, year) + ZEND_ARG_INFO(0, week) + ZEND_ARG_INFO(0, day) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timestamp_set, 0, 0, 2) + ZEND_ARG_INFO(0, obje
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Tue Jul 8 19:29:07 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed a memleak (Original patch by Hannes Magnusson). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.191&r2=1.192&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.191 php-src/ext/date/php_date.c:1.192 --- php-src/ext/date/php_date.c:1.191 Tue Jul 8 17:56:35 2008 +++ php-src/ext/date/php_date.c Tue Jul 8 19:29:06 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.191 2008/07/08 17:56:35 derick Exp $ */ +/* $Id: php_date.c,v 1.192 2008/07/08 19:29:06 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -3317,11 +3317,13 @@ GET_VALUE_FROM_STRUCT(invert, "invert"); GET_VALUE_FROM_STRUCT(days, "days"); + ALLOC_INIT_ZVAL(retval); + Z_SET_REFCOUNT_P(retval, 0); + if (value == -1) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unknown property (%s)", Z_STRVAL_P(member)); } - ALLOC_INIT_ZVAL(retval); ZVAL_LONG(retval, value); if (member == &tmp_member) { @@ -3337,6 +3339,7 @@ { php_interval_obj *obj; zval tmp_member, tmp_value; + int found = 0; if (member->type != IS_STRING) { tmp_member = *member; @@ -3354,6 +3357,7 @@ convert_to_long(&tmp_value); \ value = &tmp_value; \ } \ + found = 1;\ obj->diff->n = Z_LVAL_P(value); \ if (value == &tmp_value) { \ zval_dtor(value); \ @@ -3368,7 +3372,7 @@ SET_VALUE_FROM_STRUCT(s, "s"); SET_VALUE_FROM_STRUCT(invert, "invert"); - if (value == -1) { + if (!found) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unknown property (%s)", Z_STRVAL_P(member)); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/lib parse_date.c parse_date.re parse_iso_intervals.c tm2unixtime.c
derick Tue Jul 8 17:56:36 2008 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/lib parse_date.c parse_date.re parse_iso_intervals.c tm2unixtime.c Log: - Replaced // by /* .. */ comments. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.190&r2=1.191&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.190 php-src/ext/date/php_date.c:1.191 --- php-src/ext/date/php_date.c:1.190 Tue Jul 8 17:40:34 2008 +++ php-src/ext/date/php_date.c Tue Jul 8 17:56:35 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.190 2008/07/08 17:40:34 derick Exp $ */ +/* $Id: php_date.c,v 1.191 2008/07/08 17:56:35 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -310,9 +310,9 @@ int initialized; int type; union { - timelib_tzinfo *tz; // TIMELIB_ZONETYPE_ID; - timelib_sll utc_offset; // TIMELIB_ZONETYPE_OFFSET - struct // TIMELIB_ZONETYPE_ABBR + timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */ + timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */ + struct /* TIMELIB_ZONETYPE_ABBR */ { timelib_sll utc_offset; char*abbr; @@ -2001,7 +2001,7 @@ return props; } - // first we add the date and time in ISO format + /* first we add the date and time in ISO format */ str = date_format("Y-m-d H:i:s", 12, &return_len, dateobj->time, 1, 0 TSRMLS_CC); MAKE_STD_ZVAL(zv); if (UG(unicode)) { @@ -2011,7 +2011,7 @@ } zend_hash_update(props, "date", 5, &zv, sizeof(zval), NULL); - // then we add the timezone name (or similar) + /* then we add the timezone name (or similar) */ if (dateobj->time->is_localtime) { MAKE_STD_ZVAL(zv); ZVAL_LONG(zv, dateobj->time->zone_type); @@ -2264,7 +2264,7 @@ dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, &err, DATE_TIMEZONEDB); } - // update last errors and warnings + /* update last errors and warnings */ update_errors_warnings(err TSRMLS_CC); http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.88&r2=1.89&diff_format=u Index: php-src/ext/date/lib/parse_date.c diff -u php-src/ext/date/lib/parse_date.c:1.88 php-src/ext/date/lib/parse_date.c:1.89 --- php-src/ext/date/lib/parse_date.c:1.88 Sun May 4 20:50:46 2008 +++ php-src/ext/date/lib/parse_date.c Tue Jul 8 17:56:35 2008 @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.4 on Sun May 4 22:48:05 2008 */ +/* Generated by re2c 0.13.4 on Tue Jul 8 19:51:01 2008 */ #line 1 "ext/date/lib/parse_date.re" /* +--+ @@ -18,7 +18,7 @@ +--+ */ -/* $Id: parse_date.c,v 1.88 2008/05/04 20:50:46 derick Exp $ */ +/* $Id: parse_date.c,v 1.89 2008/07/08 17:56:35 derick Exp $ */ #include "timelib.h" @@ -19051,7 +19051,7 @@ TIMELIB_INIT; TIMELIB_HAVE_RELATIVE(); - // skip "last day of" or "first day of" + /* skip "last day of" or "first day of" */ if (*ptr == 'l') { s->time->relative.first_last_day_of = 2; } else { @@ -23398,17 +23398,17 @@ while (*fptr && *ptr) { begin = ptr; switch (*fptr) { - case 'd': // two digit day, with leading zero - case 'j': // two digit day, without leading zero + case 'd': /* two digit day, with leading zero */ + case 'j': /* two digit day, without leading zero */ TIMELIB_CHECK_NUMBER; if ((s->time->d = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) { add_pbf_error(s, "A two digit day could not be found", string, begin); } break; - case 'S': // day suffix, ignored, nor checked + case 'S': /* day suffix, ignored, nor checked */ timelib_skip_day_suffix((char **) &ptr); break; - case 'z': // day of year - resets month (0 based) + case 'z': /* day of year - resets month (0 based) */ TIMELIB_CHECK_NUMBER; if ((tmp = timelib_get_
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests 015.phpt dateinterval_errors.phpt
derick Tue Jul 8 17:40:35 2008 UTC Added files: /php-src/ext/date/tests 015.phpt dateinterval_errors.phpt Modified files: /php-src/ext/date php_date.c Log: - Fixed memory leaks and segfaults, patch by Joe Orton. - Fixed bug #45038 (Crash when using DateTimeZone object returned by Date::getTimezone). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.189&r2=1.190&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.189 php-src/ext/date/php_date.c:1.190 --- php-src/ext/date/php_date.c:1.189 Sat Jun 7 22:41:02 2008 +++ php-src/ext/date/php_date.c Tue Jul 8 17:40:34 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.189 2008/06/07 22:41:02 tony2001 Exp $ */ +/* $Id: php_date.c,v 1.190 2008/07/08 17:40:34 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1341,14 +1341,6 @@ timelib_update_ts(t, tzi); ts = timelib_date_to_int(t, &error2); - /* if tz_info is not a copy, avoid double free */ - if (now->tz_info != tzi && now->tz_info) { - timelib_tzinfo_dtor(now->tz_info); - } - if (t->tz_info != tzi) { - timelib_tzinfo_dtor(t->tz_info); - } - timelib_time_dtor(now); timelib_time_dtor(t); @@ -1779,7 +1771,7 @@ newdateobj->time->tz_abbr = strdup(it_time->tz_abbr); } if (it_time->tz_info) { - newdateobj->time->tz_info = timelib_tzinfo_clone(it_time->tz_info); + newdateobj->time->tz_info = it_time->tz_info; } *data = &iterator->current; @@ -1966,7 +1958,7 @@ new_obj->time->tz_abbr = strdup(old_obj->time->tz_abbr); } if (old_obj->time->tz_info) { - new_obj->time->tz_info = timelib_tzinfo_clone(old_obj->time->tz_info); + new_obj->time->tz_info = old_obj->time->tz_info; } return new_ov; @@ -2185,9 +2177,6 @@ php_date_obj *intern = (php_date_obj *)object; if (intern->time) { - if (intern->time->tz_info) { - timelib_tzinfo_dtor(intern->time->tz_info); - } timelib_time_dtor(intern->time); } @@ -2220,16 +2209,10 @@ php_period_obj *intern = (php_period_obj *)object; if (intern->start) { - if (intern->start->tz_info) { - timelib_tzinfo_dtor(intern->start->tz_info); - } timelib_time_dtor(intern->start); } if (intern->end) { - if (intern->end->tz_info) { - timelib_tzinfo_dtor(intern->end->tz_info); - } timelib_time_dtor(intern->end); } @@ -2268,14 +2251,11 @@ timelib_time *now; timelib_tzinfo *tzi; timelib_error_container *err = NULL; - int free_tzi = 0, type = TIMELIB_ZONETYPE_ID, new_dst; + int type = TIMELIB_ZONETYPE_ID, new_dst; char *new_abbr; timelib_sll new_offset; if (dateobj->time) { - if (dateobj->time->tz_info) { - timelib_tzinfo_dtor(dateobj->time->tz_info); - } timelib_time_dtor(dateobj->time); } if (format) { @@ -2303,8 +2283,7 @@ tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC); switch (tzobj->type) { case TIMELIB_ZONETYPE_ID: - tzi = timelib_tzinfo_clone(tzobj->tzi.tz); - free_tzi = 1; + tzi = tzobj->tzi.tz; break; case TIMELIB_ZONETYPE_OFFSET: new_offset = tzobj->tzi.utc_offset; @@ -2317,8 +2296,7 @@ } type = tzobj->type; } else if (dateobj->time->tz_info) { - tzi = timelib_tzinfo_clone(dateobj->time->tz_info); - free_tzi = 1; + tzi = dateobj->time->tz_info; } else { tzi = get_timezone_info(TSRMLS_C); } @@ -2345,12 +2323,6 @@ dateobj->time->have_relative = 0; - if (type == TIMELIB_ZONETYPE_ID && now->tz_info != tzi) { - timelib_tzinfo_dtor(now->tz_info); - } - if (free_tzi) { - timelib_tzinfo_dtor(tzi); - } timelib_time_dtor(now); return 1; @@ -2860,10 +2832,7 @@ if (tzobj->type != TIMELIB_ZONETYPE_ID) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only do this for zones with ID for now"); } - if (dateobj->time->tz_info) { - timelib_tzinfo_dtor(dateobj->time->tz_info); - } - timelib_se
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c
On Tue, 10 Jun 2008, Andrei Zmievski wrote: > In date(), strtotime(), etc, do we want to restrict the format argument to be > an ASCII string? Because right now if you pass Unicode string in, it will be > converted to binary using runtime encoding.. Yes, that's fine. The parser doesn't understand unicode anyway. regards, Derick -- Derick Rethans http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c
In date(), strtotime(), etc, do we want to restrict the format argument to be an ASCII string? Because right now if you pass Unicode string in, it will be converted to binary using runtime encoding.. -Andrei Henrique do Nascimento Angelo wrote: hnangeloSat Jun 7 20:30:30 2008 UTC Modified files: /php-src/ext/date php_date.c Log: Add Unicode support and set as unicode compatible -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c
On 08.06.2008 00:30, Henrique do Nascimento Angelo wrote: hnangeloSat Jun 7 20:30:30 2008 UTC Modified files: /php-src/ext/date php_date.c Log: Add Unicode support and set as unicode compatible Please don't forget to test your patches in ZTS mode (./configure --enable-maintainer-zts). -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
tony2001Sat Jun 7 22:41:02 2008 UTC Modified files: /php-src/ext/date php_date.c Log: fix ZTS build http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.188&r2=1.189&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.188 php-src/ext/date/php_date.c:1.189 --- php-src/ext/date/php_date.c:1.188 Sat Jun 7 20:30:30 2008 +++ php-src/ext/date/php_date.c Sat Jun 7 22:41:02 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.188 2008/06/07 20:30:30 hnangelo Exp $ */ +/* $Id: php_date.c,v 1.189 2008/06/07 22:41:02 tony2001 Exp $ */ #include "php.h" #include "php_streams.h" @@ -2499,6 +2499,7 @@ { int i; zval *element; + TSRMLS_FETCH(); add_ascii_assoc_long(z, "warning_count", error->warning_count); MAKE_STD_ZVAL(element); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
hnangeloSat Jun 7 20:30:30 2008 UTC Modified files: /php-src/ext/date php_date.c Log: Add Unicode support and set as unicode compatible http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.187&r2=1.188&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.187 php-src/ext/date/php_date.c:1.188 --- php-src/ext/date/php_date.c:1.187 Tue May 20 12:07:13 2008 +++ php-src/ext/date/php_date.c Sat Jun 7 20:30:30 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.187 2008/05/20 12:07:13 tony2001 Exp $ */ +/* $Id: php_date.c,v 1.188 2008/06/07 20:30:30 hnangelo Exp $ */ #include "php.h" #include "php_streams.h" @@ -1214,7 +1214,7 @@ } /* }}} */ -/* {{{ proto string date(string format [, long timestamp]) +/* {{{ proto string date(string format [, long timestamp]) U Format a local date/time */ PHP_FUNCTION(date) { @@ -1222,7 +1222,7 @@ } /* }}} */ -/* {{{ proto string gmdate(string format [, long timestamp]) +/* {{{ proto string gmdate(string format [, long timestamp]) U Format a GMT date/time */ PHP_FUNCTION(gmdate) { @@ -1230,7 +1230,7 @@ } /* }}} */ -/* {{{ proto int idate(string format [, int timestamp]) +/* {{{ proto int idate(string format [, int timestamp]) U Format a local time/date as integer */ PHP_FUNCTION(idate) { @@ -1292,7 +1292,7 @@ /* }}} */ -/* {{{ proto int strtotime(string time [, int now ]) +/* {{{ proto int strtotime(string time [, int now ]) U Convert string representation of date and time to a timestamp */ PHP_FUNCTION(strtotime) { @@ -1453,7 +1453,7 @@ } /* }}} */ -/* {{{ proto int mktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]) +/* {{{ proto int mktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]) U Get UNIX timestamp for a date */ PHP_FUNCTION(mktime) { @@ -1461,7 +1461,7 @@ } /* }}} */ -/* {{{ proto int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]) +/* {{{ proto int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]) U Get UNIX timestamp for a GMT date */ PHP_FUNCTION(gmmktime) { @@ -1470,7 +1470,7 @@ /* }}} */ -/* {{{ proto bool checkdate(int month, int day, int year) +/* {{{ proto bool checkdate(int month, int day, int year) U Returns true(1) if it is a valid date in gregorian calendar */ PHP_FUNCTION(checkdate) { @@ -1578,7 +1578,7 @@ } /* }}} */ -/* {{{ proto string strftime(string format [, int timestamp]) +/* {{{ proto string strftime(string format [, int timestamp]) U Format a local time/date according to locale settings */ PHP_FUNCTION(strftime) { @@ -1586,7 +1586,7 @@ } /* }}} */ -/* {{{ proto string gmstrftime(string format [, int timestamp]) +/* {{{ proto string gmstrftime(string format [, int timestamp]) U Format a GMT/UCT time/date according to locale settings */ PHP_FUNCTION(gmstrftime) { @@ -1595,7 +1595,7 @@ /* }}} */ #endif -/* {{{ proto int time(void) +/* {{{ proto int time(void) U Return current UNIX timestamp */ PHP_FUNCTION(time) { @@ -1603,7 +1603,7 @@ } /* }}} */ -/* {{{ proto array localtime([int timestamp [, bool associative_array]]) +/* {{{ proto array localtime([int timestamp [, bool associative_array]]) U Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */ PHP_FUNCTION(localtime) { @@ -1650,7 +1650,7 @@ } /* }}} */ -/* {{{ proto array getdate([int timestamp]) +/* {{{ proto array getdate([int timestamp]) U Get date/time information */ PHP_FUNCTION(getdate) { @@ -1678,8 +1678,8 @@ add_ascii_assoc_long(return_value, "mon", ts->m); add_ascii_assoc_long(return_value, "year", ts->y); add_ascii_assoc_long(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d)); - add_ascii_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d), 1); - add_ascii_assoc_string(return_value, "month", mon_full_names[ts->m - 1], 1); + add_ascii_assoc_ascii_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d), 1); + add_ascii_assoc_ascii_string(return_value, "month", mon_full_names[ts->m - 1], 1); add_index_long(return_value, 0, timestamp); timelib_time_dtor(ts); @@ -2028,7 +2028,7 @@ MAKE_STD_ZVAL(zv); switch (dateobj->time->zone_type) { case TIMELIB_ZONETYPE_ID: - ZVAL_STRING(zv, dateobj->time->tz_info->name, 1); + ZVAL_ASCII_STRING(zv, dateobj->time->tz_info->name, 1); break; case TIMELIB_ZONETYPE_OFFSET: { char *tmpstr = emalloc(sizeof("U
[PHP-CVS] cvs: php-src /ext/date php_date.c
tony2001Tue May 20 12:07:13 2008 UTC Modified files: /php-src/ext/date php_date.c Log: fix function signature and silence compile warning http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.186&r2=1.187&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.186 php-src/ext/date/php_date.c:1.187 --- php-src/ext/date/php_date.c:1.186 Wed May 7 23:46:11 2008 +++ php-src/ext/date/php_date.c Tue May 20 12:07:13 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.186 2008/05/07 23:46:11 iliaa Exp $ */ +/* $Id: php_date.c,v 1.187 2008/05/20 12:07:13 tony2001 Exp $ */ #include "php.h" #include "php_streams.h" @@ -1788,7 +1788,7 @@ /* {{{ date_period_it_current_key */ -static int date_period_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) +static int date_period_it_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { date_period_it *iterator = (date_period_it *)iter; *int_key = iterator->current_index; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
iliaa Wed May 7 23:46:11 2008 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: kill unused vars http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.185&r2=1.186&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.185 php-src/ext/date/php_date.c:1.186 --- php-src/ext/date/php_date.c:1.185 Sun May 4 09:59:42 2008 +++ php-src/ext/date/php_date.c Wed May 7 23:46:11 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.185 2008/05/04 09:59:42 derick Exp $ */ +/* $Id: php_date.c,v 1.186 2008/05/07 23:46:11 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -1728,7 +1728,6 @@ static void date_period_it_dtor(zend_object_iterator *iter TSRMLS_DC) { date_period_it *iterator = (date_period_it *)iter; - zval*intern = (zval*)iterator->intern.data; date_period_it_invalidate_current(iter TSRMLS_CC); @@ -1792,7 +1791,6 @@ static int date_period_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { date_period_it *iterator = (date_period_it *)iter; - php_period_obj *object = iterator->object; *int_key = iterator->current_index; return HASH_KEY_IS_LONG; } @@ -1803,7 +1801,6 @@ static void date_period_it_move_forward(zend_object_iterator *iter TSRMLS_DC) { date_period_it *iterator = (date_period_it *)iter; - php_period_obj *object = iterator->object; iterator->current_index++; date_period_it_invalidate_current(iter TSRMLS_CC); @@ -1815,7 +1812,6 @@ static void date_period_it_rewind(zend_object_iterator *iter TSRMLS_DC) { date_period_it *iterator = (date_period_it *)iter; - php_period_obj *object = iterator->object; iterator->current_index = 0; date_period_it_invalidate_current(iter TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/lib parse_iso_intervals.c parse_iso_intervals.re
derick Sun May 4 09:59:42 2008 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/lib parse_iso_intervals.c parse_iso_intervals.re Log: - Added support for using ISO 8601 time intervals to define a DatePeriod iterator. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.184&r2=1.185&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.184 php-src/ext/date/php_date.c:1.185 --- php-src/ext/date/php_date.c:1.184 Sat May 3 10:59:14 2008 +++ php-src/ext/date/php_date.c Sun May 4 09:59:42 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.184 2008/05/03 10:59:14 derick Exp $ */ +/* $Id: php_date.c,v 1.185 2008/05/04 09:59:42 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -3538,6 +3538,30 @@ } /* }}} */ +static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, int *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) +{ + timelib_time *b = NULL, *e = NULL; + timelib_rel_time *p = NULL; + int r = 0; + int retval = 0; + struct timelib_error_container *errors; + + timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors); + + if (errors->error_count > 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format); + retval = FAILURE; + } else { + *st = b; + *et = e; + *d = p; + *recurrences = r; + retval = SUCCESS; + } + timelib_error_container_dtor(errors); + return retval; +} + /* {{{ proto DatePeriod::__construct(DateTime $start, DateInterval $interval, int recurrences|DateTime $end) Creates new DatePeriod object. */ @@ -3548,38 +3572,44 @@ php_interval_obj *intobj; zval *start, *end = NULL, *interval; long recurrences = 0, options = 0; + char *isostr = NULL; + int isostr_len; timelib_time *clone; php_set_error_handling(EH_THROW, NULL TSRMLS_CC); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_date, &interval, date_ce_interval, &recurrences, &options) == FAILURE) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_date, &interval, date_ce_interval, &end, date_ce_date, &options) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "This constructor accepts either (DateTime, DateInterval, int) OR (DateTime, DateInterval, DateTime) as arguments."); - return; + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &isostr, &isostr_len, &options) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "This constructor accepts either (DateTime, DateInterval, int) OR (DateTime, DateInterval, DateTime) OR (string) as arguments."); + return; + } } } - /* init */ - intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC); dpobj = zend_object_store_get_object(getThis() TSRMLS_CC); - /* start date */ - dateobj = (php_date_obj *) zend_object_store_get_object(start TSRMLS_CC); - clone = timelib_time_ctor(); - memcpy(clone, dateobj->time, sizeof(timelib_time)); - if (dateobj->time->tz_abbr) { - clone->tz_abbr = strdup(dateobj->time->tz_abbr); - } - if (dateobj->time->tz_info) { - clone->tz_info = timelib_tzinfo_clone(dateobj->time->tz_info); - } - dpobj->start = clone; + if (isostr_len) { + date_period_initialize(&(dpobj->start), &(dpobj->end), &(dpobj->interval), (int*) &recurrences, isostr, isostr_len TSRMLS_CC); + if (dpobj->start == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ISO interval '%s' did not contain a start date.", isostr); + } + if (dpobj->interval == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ISO interval '%s' did not contain an interval.", isostr); + } + if (dpobj->end == NULL && recurrences == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ISO interval '%s' did not contain an end date or a recurrence count.", isostr); + } - /* interval */ - dpobj->interval = timelib_rel_time_clone(intobj->diff); + timelib_update_ts(dpobj->start, NULL); + if (dpobj->end) { + timelib_update
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Sat May 3 10:59:15 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Added support for using an end date to limit the amount of recursions with the DatePeriod iterator. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.183&r2=1.184&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.183 php-src/ext/date/php_date.c:1.184 --- php-src/ext/date/php_date.c:1.183 Fri May 2 21:32:13 2008 +++ php-src/ext/date/php_date.c Sat May 3 10:59:14 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.183 2008/05/02 21:32:13 derick Exp $ */ +/* $Id: php_date.c,v 1.184 2008/05/03 10:59:14 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1740,40 +1740,36 @@ /* {{{ date_period_it_has_more */ static int date_period_it_has_more(zend_object_iterator *iter TSRMLS_DC) { - date_period_it *iterator = (date_period_it *)iter; - php_period_obj *object = iterator->object; - - return (iterator->current_index < object->recurrences) ? SUCCESS : FAILURE; -} -/* }}} */ - - -/* {{{ date_period_it_current_data */ -static void date_period_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) -{ - date_period_it *iterator = (date_period_it *)iter; - php_period_obj *object = iterator->object; - timelib_time *it_time = object->start; - php_date_obj *newdateobj; + date_period_it *iterator = (date_period_it *)iter; + php_period_obj *object = iterator->object; + timelib_time *it_time = object->start; /* apply modification if it's not the first iteration */ if (!object->include_start_date || iterator->current_index > 0) { it_time->have_relative = 1; - it_time->relative.y = object->interval->y; - it_time->relative.m = object->interval->m; - it_time->relative.d = object->interval->d; - it_time->relative.h = object->interval->h; - it_time->relative.i = object->interval->i; - it_time->relative.s = object->interval->s; - it_time->relative.weekday = object->interval->weekday; - it_time->relative.special = object->interval->special; - it_time->relative.have_weekday_relative = object->interval->have_weekday_relative; - it_time->relative.have_special_relative = object->interval->have_special_relative; + it_time->relative = *object->interval; it_time->sse_uptodate = 0; timelib_update_ts(it_time, NULL); timelib_update_from_sse(it_time); } + if (object->end) { + return object->start->sse < object->end->sse ? SUCCESS : FAILURE; + } else { + return (iterator->current_index < object->recurrences) ? SUCCESS : FAILURE; + } +} +/* }}} */ + + +/* {{{ date_period_it_current_data */ +static void date_period_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) +{ + date_period_it *iterator = (date_period_it *)iter; + php_period_obj *object = iterator->object; + timelib_time *it_time = object->start; + php_date_obj *newdateobj; + /* Create new object */ MAKE_STD_ZVAL(iterator->current); date_instantiate(date_ce_date, iterator->current TSRMLS_CC); @@ -1795,7 +1791,7 @@ /* {{{ date_period_it_current_key */ static int date_period_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { - date_period_it *iterator = (date_period_it *)iter; + date_period_it *iterator = (date_period_it *)iter; php_period_obj *object = iterator->object; *int_key = iterator->current_index; return HASH_KEY_IS_LONG; @@ -1806,7 +1802,7 @@ /* {{{ date_period_it_move_forward */ static void date_period_it_move_forward(zend_object_iterator *iter TSRMLS_DC) { - date_period_it *iterator = (date_period_it *)iter; + date_period_it *iterator = (date_period_it *)iter; php_period_obj *object = iterator->object; iterator->current_index++; @@ -1818,7 +1814,7 @@ /* {{{ date_period_it_rewind */ static void date_period_it_rewind(zend_object_iterator *iter TSRMLS_DC) { - date_period_it *iterator = (date_period_it *)iter; + date_period_it *iterator = (date_period_it *)iter; php_period_obj *object = iterator->object; iterator->current_index = 0; @@ -3542,7 +3538,7 @@ } /* }}} */ -/* {{{ proto DatePeriod::__construct(DateTime $start, DateInterval $interval, int recurrences) +/* {{{ proto DatePeriod::__construct(DateTime $start, DateInterval $interval, int recurrences|DateTime $end) Creates new DatePeriod object. */ PHP_METHOD(DatePeriod, __construct) @
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Fri May 2 21:32:13 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed an issue in date() where a : was printed for the O modifier after a P modifier was used. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.182&r2=1.183&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.182 php-src/ext/date/php_date.c:1.183 --- php-src/ext/date/php_date.c:1.182 Fri May 2 12:48:19 2008 +++ php-src/ext/date/php_date.c Fri May 2 21:32:13 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.182 2008/05/02 12:48:19 derick Exp $ */ +/* $Id: php_date.c,v 1.183 2008/05/02 21:32:13 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -903,7 +903,7 @@ timelib_time_offset *offset = NULL; timelib_sll isoweek, isoyear; php_locale_data *loc_dat; - int rfc_colon = 0; + int rfc_colon; if (!format_len) { if (UG(unicode)) { @@ -940,6 +940,7 @@ for (i = 0; i < format_len; i++) { no_free = 0; + rfc_colon = 0; switch (format[i]) { /* day */ case 'd': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%02d", (int) t->d); break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h /ext/date/lib parse_date.c parse_date.re tm2unixtime.c
derick Fri May 2 12:48:19 2008 UTC Modified files: /php-src/ext/date php_date.c php_date.h /php-src/ext/date/lib parse_date.c parse_date.re tm2unixtime.c Log: - Added DateInterval::createFromDateString() that creates an interval from the relative parts of a date/time string. - Fixed an issue where special relative bits were not applied. #- @DOC http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.181&r2=1.182&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.181 php-src/ext/date/php_date.c:1.182 --- php-src/ext/date/php_date.c:1.181 Thu May 1 16:14:29 2008 +++ php-src/ext/date/php_date.c Fri May 2 12:48:19 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.181 2008/05/01 16:14:29 derick Exp $ */ +/* $Id: php_date.c,v 1.182 2008/05/02 12:48:19 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -198,6 +198,7 @@ PHP_FE(timezone_identifiers_list, NULL) PHP_FE(timezone_abbreviations_list, NULL) + PHP_FE(date_interval_create_from_date_string, NULL) PHP_FE(date_interval_format, NULL) /* Options and Configuration */ @@ -242,10 +243,11 @@ PHP_ME_MAPPING(listIdentifiers, timezone_identifiers_list, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) {NULL, NULL, NULL} }; - + const zend_function_entry date_funcs_interval[] = { PHP_ME(DateInterval, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) PHP_ME_MAPPING(format,date_interval_format,NULL, 0) + PHP_ME_MAPPING(createFromDateString, date_interval_create_from_date_string, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) {NULL, NULL, NULL} }; @@ -1755,6 +1757,7 @@ /* apply modification if it's not the first iteration */ if (!object->include_start_date || iterator->current_index > 0) { + it_time->have_relative = 1; it_time->relative.y = object->interval->y; it_time->relative.m = object->interval->m; it_time->relative.d = object->interval->d; @@ -1762,7 +1765,9 @@ it_time->relative.i = object->interval->i; it_time->relative.s = object->interval->s; it_time->relative.weekday = object->interval->weekday; - it_time->have_relative = 1; + it_time->relative.special = object->interval->special; + it_time->relative.have_weekday_relative = object->interval->have_weekday_relative; + it_time->relative.have_special_relative = object->interval->have_special_relative; it_time->sse_uptodate = 0; timelib_update_ts(it_time, NULL); timelib_update_from_sse(it_time); @@ -2378,8 +2383,8 @@ } /* }}} */ -/* {{{ proto DateTime date_create(string format, string time[, DateTimeZone object]) - Returns new DateTime object +/* {{{ proto DateTime date_create_from_format(string format, string time[, DateTimeZone object]) + Returns new DateTime object formatted according to the specified format */ PHP_FUNCTION(date_create_from_format) { @@ -2585,22 +2590,20 @@ break; } } - if (parsed_time->have_relative || parsed_time->have_weekday_relative || parsed_time->have_special_relative || parsed_time->relative.first_last_day_of) { + if (parsed_time->have_relative) { MAKE_STD_ZVAL(element); array_init(element); - } - if (parsed_time->have_relative) { add_ascii_assoc_long(element, "year", parsed_time->relative.y); add_ascii_assoc_long(element, "month", parsed_time->relative.m); add_ascii_assoc_long(element, "day", parsed_time->relative.d); add_ascii_assoc_long(element, "hour", parsed_time->relative.h); add_ascii_assoc_long(element, "minute", parsed_time->relative.i); add_ascii_assoc_long(element, "second", parsed_time->relative.s); - if (parsed_time->have_weekday_relative) { + if (parsed_time->relative.have_weekday_relative) { add_ascii_assoc_long(element, "weekday", parsed_time->relative.weekday); } - if (parsed_time->have_special_relative && (parsed_time->special.type == TIMELIB_SPECIAL_WEEKDAY)) { - add_ascii_assoc_long(element, "weekdays", parsed_time->special.amount); + if (parsed_time->relative.have_special_relative && (parsed_time->relative.special.type == TIMELIB_SPECIAL_WEEKDAY)) { + add_ascii_assoc_long(element, "weekdays", parsed_time->relative.special.amount); } if (parsed_time->relative.first_last_day_of) {
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h /ext/date/lib timelib.c timelib.h
On Fri, 2 May 2008, Marcus Boerger wrote: > Hello Derick, > > Thursday, May 1, 2008, 2:10:25 AM, you wrote: > > > http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.178&r2=1.179&diff_format=u > > Index: php-src/ext/date/php_date.c > > diff -u php-src/ext/date/php_date.c:1.178 php-src/ext/date/php_date.c:1.179 > > --- php-src/ext/date/php_date.c:1.178 Fri Apr 25 12:55:16 2008 > > +++ php-src/ext/date/php_date.c Thu May 1 00:10:25 2008 > ... > > +/* {{{ date_period_it_current_data */ > > +static void date_period_it_current_data(zend_object_iterator *iter, zval > > ***data TSRMLS_DC) > > +{ > > + date_period_it *iterator = (date_period_it *)iter; > > + php_period_obj *object = iterator->object; > > + timelib_time *it_time = object->start; > > + php_date_obj *newdateobj; > > + > > + /* apply modification */ > > + it_time->relative.y = object->interval->y; > > + it_time->relative.m = object->interval->m; > > + it_time->relative.d = object->interval->d; > > + it_time->relative.h = object->interval->h; > > + it_time->relative.i = object->interval->i; > > + it_time->relative.s = object->interval->s; > > + it_time->relative.weekday = object->interval->weekday; > > Can you not simply do it_time->relative = object->interval? Yeah, I will clean up a bit later - there's more things to clean up as well. > > +/* {{{ date_period_it_current_key */ > > +static int date_period_it_current_key(zend_object_iterator *iter, char > > **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) > > +{ > > + date_period_it *iterator = (date_period_it *)iter; > > + php_period_obj *object = iterator->object; > > Funny indentation here. Lemme guess *iterator has a tab in the front while > *object doesn't. That is copied several times, which is why I spotted it. hmm, will check. regards, Derick -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h /ext/date/lib timelib.c timelib.h
Hello Derick, Thursday, May 1, 2008, 2:10:25 AM, you wrote: > http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.178&r2=1.179&diff_format=u > Index: php-src/ext/date/php_date.c > diff -u php-src/ext/date/php_date.c:1.178 php-src/ext/date/php_date.c:1.179 > --- php-src/ext/date/php_date.c:1.178 Fri Apr 25 12:55:16 2008 > +++ php-src/ext/date/php_date.c Thu May 1 00:10:25 2008 ... > +/* {{{ date_period_it_current_data */ > +static void date_period_it_current_data(zend_object_iterator *iter, zval > ***data TSRMLS_DC) > +{ > + date_period_it *iterator = (date_period_it *)iter; > + php_period_obj *object = iterator->object; > + timelib_time *it_time = object->start; > + php_date_obj *newdateobj; > + > + /* apply modification */ > + it_time->relative.y = object->interval->y; > + it_time->relative.m = object->interval->m; > + it_time->relative.d = object->interval->d; > + it_time->relative.h = object->interval->h; > + it_time->relative.i = object->interval->i; > + it_time->relative.s = object->interval->s; > + it_time->relative.weekday = object->interval->weekday; Can you not simply do it_time->relative = object->interval? > +/* {{{ date_period_it_current_key */ > +static int date_period_it_current_key(zend_object_iterator *iter, char > **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) > +{ > + date_period_it *iterator = (date_period_it *)iter; > + php_period_obj *object = iterator->object; Funny indentation here. Lemme guess *iterator has a tab in the front while *object doesn't. That is copied several times, which is why I spotted it. Best regards, Marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/lib parse_date.c parse_date.re timelib.c timelib_structs.h tm2unixtime.c
derick Thu May 1 16:14:30 2008 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/lib parse_date.c parse_date.re timelib.c timelib_structs.h tm2unixtime.c Log: - Rearranged some structures to allow for more powerfull period/intervals. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.180&r2=1.181&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.180 php-src/ext/date/php_date.c:1.181 --- php-src/ext/date/php_date.c:1.180 Thu May 1 13:31:00 2008 +++ php-src/ext/date/php_date.c Thu May 1 16:14:29 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.180 2008/05/01 13:31:00 derick Exp $ */ +/* $Id: php_date.c,v 1.181 2008/05/01 16:14:29 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2345,7 +2345,7 @@ timelib_fill_holes(dateobj->time, now, 0); timelib_update_ts(dateobj->time, tzi); - dateobj->time->have_weekday_relative = dateobj->time->have_relative = 0; + dateobj->time->have_relative = 0; if (type == TIMELIB_ZONETYPE_ID && now->tz_info != tzi) { timelib_tzinfo_dtor(now->tz_info); @@ -2596,17 +2596,15 @@ add_ascii_assoc_long(element, "hour", parsed_time->relative.h); add_ascii_assoc_long(element, "minute", parsed_time->relative.i); add_ascii_assoc_long(element, "second", parsed_time->relative.s); - } - if (parsed_time->have_weekday_relative) { - add_ascii_assoc_long(element, "weekday", parsed_time->relative.weekday); - } - if (parsed_time->have_special_relative && (parsed_time->special.type == TIMELIB_SPECIAL_WEEKDAY)) { - add_ascii_assoc_long(element, "weekdays", parsed_time->special.amount); - } - if (parsed_time->relative.first_last_day_of) { - add_ascii_assoc_bool(element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1); - } - if (parsed_time->have_relative || parsed_time->have_weekday_relative || parsed_time->have_special_relative || parsed_time->relative.first_last_day_of) { + if (parsed_time->have_weekday_relative) { + add_ascii_assoc_long(element, "weekday", parsed_time->relative.weekday); + } + if (parsed_time->have_special_relative && (parsed_time->special.type == TIMELIB_SPECIAL_WEEKDAY)) { + add_ascii_assoc_long(element, "weekdays", parsed_time->special.amount); + } + if (parsed_time->relative.first_last_day_of) { + add_ascii_assoc_bool(element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1); + } add_ascii_assoc_zval(return_value, "relative", element); } timelib_time_dtor(parsed_time); @@ -2723,7 +2721,7 @@ dateobj->time->relative.s = tmp_time->relative.s; dateobj->time->relative.weekday = tmp_time->relative.weekday; dateobj->time->have_relative = tmp_time->have_relative; - dateobj->time->have_weekday_relative = tmp_time->have_weekday_relative; + dateobj->time->relative.have_weekday_relative = tmp_time->relative.have_weekday_relative; dateobj->time->sse_uptodate = 0; timelib_time_dtor(tmp_time); @@ -2760,9 +2758,9 @@ dateobj->time->relative.h = intobj->diff->h * bias; dateobj->time->relative.i = intobj->diff->i * bias; dateobj->time->relative.s = intobj->diff->s * bias; - dateobj->time->relative.weekday = 0; dateobj->time->have_relative = 1; - dateobj->time->have_weekday_relative = 0; + dateobj->time->relative.weekday = 0; + dateobj->time->relative.have_weekday_relative = 0; dateobj->time->sse_uptodate = 0; timelib_update_ts(dateobj->time, NULL); @@ -2798,9 +2796,9 @@ dateobj->time->relative.h = 0 - (intobj->diff->h * bias); dateobj->time->relative.i = 0 - (intobj->diff->i * bias); dateobj->time->relative.s = 0 - (intobj->diff->s * bias); - dateobj->time->relative.weekday = 0; dateobj->time->have_relative = 1; - dateobj->time->have_weekday_relative = 0; + dateobj->time->relative.weekday = 0; + dateobj->time->relative.have_weekday_relative = 0; dateobj->time->sse_uptodate = 0; timelib_update_ts(dateobj->time, NULL); http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.85&r2=1.86&diff_format=u Index: php-src/ext/date/lib/parse_date.c diff -u php-src/ext/date/lib/parse_date.c:1.85 php-src/ext/date/lib/parse_date.c:1.86 --- php-src/ext/date/lib/parse_date.c:1.85 Sun Apr 27 19:12:09 2008 +++ php-src/ext/date/lib/parse_date.c Thu May 1 16:14:29 2008 @@ -1,4
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Thu May 1 13:31:01 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Include the starting date by default in the iterator output, but add an option to disable this behavior. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.179&r2=1.180&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.179 php-src/ext/date/php_date.c:1.180 --- php-src/ext/date/php_date.c:1.179 Thu May 1 00:10:25 2008 +++ php-src/ext/date/php_date.c Thu May 1 13:31:00 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.179 2008/05/01 00:10:25 derick Exp $ */ +/* $Id: php_date.c,v 1.180 2008/05/01 13:31:00 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -333,6 +333,7 @@ timelib_rel_time *interval; int recurrences; int initialized; + int include_start_date; }; #define DATE_SET_CONTEXT \ @@ -1696,6 +1697,8 @@ #define PHP_DATE_TIMEZONE_GROUP_ALL0x07FF #define PHP_DATE_TIMEZONE_GROUP_ALL_W_BC 0x0FFF +#define PHP_DATE_PERIOD_EXCLUDE_START_DATE 0x0001 + /* define an overloaded iterator structure */ typedef struct { @@ -1750,18 +1753,20 @@ timelib_time *it_time = object->start; php_date_obj *newdateobj; - /* apply modification */ - it_time->relative.y = object->interval->y; - it_time->relative.m = object->interval->m; - it_time->relative.d = object->interval->d; - it_time->relative.h = object->interval->h; - it_time->relative.i = object->interval->i; - it_time->relative.s = object->interval->s; - it_time->relative.weekday = object->interval->weekday; - it_time->have_relative = 1; - it_time->sse_uptodate = 0; - timelib_update_ts(it_time, NULL); - timelib_update_from_sse(it_time); + /* apply modification if it's not the first iteration */ + if (!object->include_start_date || iterator->current_index > 0) { + it_time->relative.y = object->interval->y; + it_time->relative.m = object->interval->m; + it_time->relative.d = object->interval->d; + it_time->relative.h = object->interval->h; + it_time->relative.i = object->interval->i; + it_time->relative.s = object->interval->s; + it_time->relative.weekday = object->interval->weekday; + it_time->have_relative = 1; + it_time->sse_uptodate = 0; + timelib_update_ts(it_time, NULL); + timelib_update_from_sse(it_time); + } /* Create new object */ MAKE_STD_ZVAL(iterator->current); @@ -1915,6 +1920,11 @@ zend_class_implements(date_ce_period TSRMLS_CC, 1, zend_ce_traversable); memcpy(&date_object_handlers_period, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); date_object_handlers_period.clone_obj = date_object_clone_period; + +#define REGISTER_PERIOD_CLASS_CONST_STRING(const_name, value) \ + zend_declare_class_constant_long(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC); + + REGISTER_PERIOD_CLASS_CONST_STRING("EXCLUDE_START_DATE", PHP_DATE_PERIOD_EXCLUDE_START_DATE); } static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_type, php_date_obj **ptr TSRMLS_DC) @@ -3514,11 +3524,11 @@ php_date_obj *dateobj; php_interval_obj *intobj; zval *start, *interval; - long recurrences; + long recurrences, options = 0; timelib_time *clone; php_set_error_handling(EH_THROW, NULL TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OOl", &start, date_ce_date, &interval, date_ce_interval, &recurrences) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_date, &interval, date_ce_interval, &recurrences, &options) == FAILURE) { RETURN_FALSE; } @@ -3537,8 +3547,9 @@ dpobj = zend_object_store_get_object(getThis() TSRMLS_CC); dpobj->interval = timelib_rel_time_clone(intobj->diff); dpobj->start= clone; - dpobj->recurrences = recurrences; dpobj->initialized = 1; + dpobj->include_start_date = !(options & PHP_DATE_PERIOD_EXCLUDE_START_DATE); + dpobj->recurrences = recurrences + dpobj->include_start_date; php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h /ext/date/lib timelib.c timelib.h
derick Thu May 1 00:10:25 2008 UTC Modified files: /php-src/ext/date php_date.c php_date.h /php-src/ext/date/lib timelib.c timelib.h Log: - Added the DatePeriod class/iterator that iterates over a date time object for a specific number of iterators and applies a DateInterval each time. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.178&r2=1.179&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.178 php-src/ext/date/php_date.c:1.179 --- php-src/ext/date/php_date.c:1.178 Fri Apr 25 12:55:16 2008 +++ php-src/ext/date/php_date.c Thu May 1 00:10:25 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.178 2008/04/25 12:55:16 derick Exp $ */ +/* $Id: php_date.c,v 1.179 2008/05/01 00:10:25 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -27,6 +27,7 @@ #include "ext/standard/php_versioning.h" #include "ext/standard/php_math.h" #include "php_date.h" +#include "zend_interfaces.h" #include "lib/timelib.h" #include #include @@ -248,8 +249,14 @@ {NULL, NULL, NULL} }; +const zend_function_entry date_funcs_period[] = { + PHP_ME(DatePeriod,__construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + {NULL, NULL, NULL} +}; + static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC); static void date_register_classes(TSRMLS_D); +static zval * date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC); /* }}} */ ZEND_DECLARE_MODULE_GLOBALS(date) @@ -278,15 +285,17 @@ PHP_INI_END() /* }}} */ -zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval; +zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period; static zend_object_handlers date_object_handlers_date; static zend_object_handlers date_object_handlers_timezone; static zend_object_handlers date_object_handlers_interval; +static zend_object_handlers date_object_handlers_period; typedef struct _php_date_obj php_date_obj; typedef struct _php_timezone_obj php_timezone_obj; typedef struct _php_interval_obj php_interval_obj; +typedef struct _php_period_obj php_period_obj; struct _php_date_obj { zend_object std; @@ -317,6 +326,15 @@ int initialized; }; +struct _php_period_obj { + zend_object std; + timelib_time *start; + timelib_time *end; + timelib_rel_time *interval; + int recurrences; + int initialized; +}; + #define DATE_SET_CONTEXT \ zval *object; \ object = getThis(); \ @@ -344,14 +362,17 @@ static void date_object_free_storage_date(void *object TSRMLS_DC); static void date_object_free_storage_timezone(void *object TSRMLS_DC); static void date_object_free_storage_interval(void *object TSRMLS_DC); +static void date_object_free_storage_period(void *object TSRMLS_DC); static zend_object_value date_object_new_date(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_interval(zend_class_entry *class_type TSRMLS_DC); +static zend_object_value date_object_new_period(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC); +static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC); static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC); static HashTable *date_object_get_properties(zval *object TSRMLS_DC); @@ -1675,9 +1696,161 @@ #define PHP_DATE_TIMEZONE_GROUP_ALL0x07FF #define PHP_DATE_TIMEZONE_GROUP_ALL_W_BC 0x0FFF + +/* define an overloaded iterator structure */ +typedef struct { + zend_object_iterator intern; + zval *current; + php_period_obj *object; + int current_index; +} date_period_it; + +/* {{{ date_period_it_invalidate_current */ +static void date_period_it_invalidate_current(zend_object_iterator *iter TSRMLS_DC) +{ + date_period_it *iterator = (date_period_it *)iter; + + if (iterator->current) { + zval_ptr_dtor(&iterator->current); + iterator->current = NULL; + } +} +/* }}} */ + + +/* {{{ date_period_it_dtor */ +static void date_period_it_dtor(zend_object_iterator *iter TSRMLS_DC) +{ + date_period_it *iterator = (date_period_it *)iter; + zval*intern = (zval*)iterator->intern.data; + + date_period_it_invalidate_current(iter TSRMLS_CC); + + efree(iterator); +} +/* }}} */ + + +/* {{{ date_period_it_has_more */ +static int date_period_it_has_more(zend_object_iterator *iter TSR
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests bug44742.phpt
derick Wed Apr 16 17:24:00 2008 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/tests bug44742.phpt Log: - MF52: Fixed bug #44703 (htmlspecialchars() does not detect bad character set argument). #- WIll merge to 5.3 later, that branch has some more modifications. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.176&r2=1.177&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.176 php-src/ext/date/php_date.c:1.177 --- php-src/ext/date/php_date.c:1.176 Mon Mar 31 09:10:54 2008 +++ php-src/ext/date/php_date.c Wed Apr 16 17:24:00 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.176 2008/03/31 09:10:54 derick Exp $ */ +/* $Id: php_date.c,v 1.177 2008/04/16 17:24:00 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2750,9 +2750,19 @@ dateobj = (php_date_obj *) zend_object_store_get_object(dateobject TSRMLS_CC); DATE_CHECK_INITIALIZED(dateobj->time, DateTime); - offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz); - RETVAL_LONG(offset->offset); - timelib_time_offset_dtor(offset); + switch (tzobj->type) { + case TIMELIB_ZONETYPE_ID: + offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz); + RETVAL_LONG(offset->offset); + timelib_time_offset_dtor(offset); + break; + case TIMELIB_ZONETYPE_OFFSET: + RETURN_LONG(tzobj->tzi.utc_offset * -60); + break; + case TIMELIB_ZONETYPE_ABBR: + RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60); + break; + } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug44742.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/bug44742.phpt diff -u /dev/null php-src/ext/date/tests/bug44742.phpt:1.2 --- /dev/null Wed Apr 16 17:24:00 2008 +++ php-src/ext/date/tests/bug44742.phptWed Apr 16 17:24:00 2008 @@ -0,0 +1,35 @@ +--TEST-- +Bug #44742 (timezone_offset_get() causes segmentation faults) +--FILE-- + +--EXPECT-- +int(0) +int(7200) +int(12600) +int(-18000) +int(-41400) +int(7200) +int(3600) +int(0) +int(-14400) +int(7200) +int(28800) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests timestamp-in-dst.phpt
derick Mon Mar 31 09:10:54 2008 UTC Added files: /php-src/ext/date/tests timestamp-in-dst.phpt Modified files: /php-src/ext/date php_date.c Log: - Fixed a bug in formatting timestamps when DST is active in the default timezone. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.175&r2=1.176&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.175 php-src/ext/date/php_date.c:1.176 --- php-src/ext/date/php_date.c:1.175 Thu Mar 20 19:43:02 2008 +++ php-src/ext/date/php_date.c Mon Mar 31 09:10:54 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.175 2008/03/20 19:43:02 derick Exp $ */ +/* $Id: php_date.c,v 1.176 2008/03/31 09:10:54 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -868,9 +868,9 @@ offset->abbr = strdup(t->tz_abbr); } else if (t->zone_type == TIMELIB_ZONETYPE_OFFSET) { offset = timelib_time_offset_ctor(); - offset->offset = (t->z - (t->dst * 60)) * -60; + offset->offset = (t->z) * -60; offset->leap_secs = 0; - offset->is_dst = t->dst; + offset->is_dst = 0; offset->abbr = malloc(9); /* GMT±\0 */ snprintf(offset->abbr, 9, "GMT%c%02d%02d", localtime ? ((offset->offset < 0) ? '-' : '+') : '+', http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/timestamp-in-dst.phpt?view=markup&rev=1.1 Index: php-src/ext/date/tests/timestamp-in-dst.phpt +++ php-src/ext/date/tests/timestamp-in-dst.phpt --TEST-- Format timestamp in DST test --INI-- date.timezone=CEST --FILE-- format( 'c' ) ); ?> --EXPECT-- string(25) "2008-02-14T13:34:51+00:00" --UEXPECT-- unicode(25) "2008-02-14T13:34:51+00:00" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Thu Mar 20 19:43:02 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Fix the DateTimeZone::getTransitions() algorithm. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.174&r2=1.175&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.174 php-src/ext/date/php_date.c:1.175 --- php-src/ext/date/php_date.c:1.174 Sun Mar 16 15:15:47 2008 +++ php-src/ext/date/php_date.c Thu Mar 20 19:43:02 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.174 2008/03/16 15:15:47 iliaa Exp $ */ +/* $Id: php_date.c,v 1.175 2008/03/20 19:43:02 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2763,7 +2763,7 @@ { zval*object, *element; php_timezone_obj*tzobj; - int i, first = 1; + int i, begin = 0, found; long timestamp_begin = LONG_MIN, timestamp_end = LONG_MAX; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ll", &object, date_ce_timezone, ×tamp_begin, ×tamp_end) == FAILURE) { @@ -2775,39 +2775,72 @@ RETURN_FALSE; } +#define add_nominal() \ + MAKE_STD_ZVAL(element); \ + array_init(element); \ + add_ascii_assoc_long(element, "ts", timestamp_begin); \ + if (UG(unicode)) { \ + add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); \ + } else { \ + add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); \ + } \ + add_ascii_assoc_long(element, "offset", tzobj->tzi.tz->type[0].offset); \ + add_ascii_assoc_bool(element, "isdst", tzobj->tzi.tz->type[0].isdst); \ + add_ascii_assoc_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx], 1); \ + add_next_index_zval(return_value, element); + +#define add(i,ts) \ + MAKE_STD_ZVAL(element); \ + array_init(element); \ + add_ascii_assoc_long(element, "ts", ts); \ + if (UG(unicode)) { \ + add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC), 0); \ + } else { \ + add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC), 0); \ + } \ + add_ascii_assoc_long(element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \ + add_ascii_assoc_bool(element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \ + add_ascii_assoc_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1); \ + add_next_index_zval(return_value, element); + +#define add_last() add(tzobj->tzi.tz->timecnt - 1, timestamp_begin) + array_init(return_value); - for (i = 0; i < tzobj->tzi.tz->timecnt; ++i) { - if (tzobj->tzi.tz->trans[i] >= timestamp_begin && tzobj->tzi.tz->trans[i] < timestamp_end) { - if (first && timestamp_begin != LONG_MIN && i > 0 && timestamp_begin != tzobj->tzi.tz->trans[i]) - { - MAKE_STD_ZVAL(element); - array_init(element); - add_ascii_assoc_long(element, "ts", timestamp_begin); - if (UG(unicode)) { - add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); - } else { - add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); + + if (timestamp_begin == LONG_MIN) { + add_nominal(); + begin = 0; + found = 1; + } else { + begin = 0; + found = 0; + if (tzobj->tzi.tz->timecnt > 0) { + do { + if (tzobj->tzi.tz->trans[begin] > timestamp_begin) { + if (begin > 0) { + add(begin - 1, timestamp_begin); + } else { + add_nominal(); + } + found = 1; + break; } -
[PHP-CVS] cvs: php-src /ext/date php_date.c
iliaa Sun Mar 16 15:15:47 2008 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: Remove unused variable http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.173&r2=1.174&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.173 php-src/ext/date/php_date.c:1.174 --- php-src/ext/date/php_date.c:1.173 Fri Mar 14 17:57:44 2008 +++ php-src/ext/date/php_date.c Sun Mar 16 15:15:47 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.173 2008/03/14 17:57:44 felipe Exp $ */ +/* $Id: php_date.c,v 1.174 2008/03/16 15:15:47 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -2124,7 +2124,6 @@ */ PHP_METHOD(DateTime, __set_state) { - zval *object = getThis(); php_date_obj *dateobj; zval *array; HashTable*myht; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
felipe Fri Mar 14 17:57:44 2008 UTC Modified files: /php-src/ext/date php_date.c Log: Fix build (ZTS) http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.172&r2=1.173&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.172 php-src/ext/date/php_date.c:1.173 --- php-src/ext/date/php_date.c:1.172 Fri Mar 14 16:18:25 2008 +++ php-src/ext/date/php_date.c Fri Mar 14 17:57:44 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.172 2008/03/14 16:18:25 derick Exp $ */ +/* $Id: php_date.c,v 1.173 2008/03/14 17:57:44 felipe Exp $ */ #include "php.h" #include "php_streams.h" @@ -1780,7 +1780,7 @@ } // first we add the date and time in ISO format - str = date_format("Y-m-d H:i:s", 12, &return_len, dateobj->time, 1, 0); + str = date_format("Y-m-d H:i:s", 12, &return_len, dateobj->time, 1, 0 TSRMLS_CC); MAKE_STD_ZVAL(zv); if (UG(unicode)) { ZVAL_UNICODEL(zv, (UChar*) str, return_len - 1, 0); @@ -2075,7 +2075,7 @@ } /* }}} */ -static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dateobj, HashTable *myht) +static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dateobj, HashTable *myht TSRMLS_DC) { zval**z_date = NULL; zval**z_timezone = NULL; @@ -2137,7 +2137,7 @@ date_instantiate(date_ce_date, return_value TSRMLS_CC); dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC); - php_date_initialize_from_hash(&return_value, &dateobj, myht); + php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC); } /* }}} */ @@ -2153,7 +2153,7 @@ myht = Z_OBJPROP_P(object); - php_date_initialize_from_hash(&return_value, &dateobj, myht); + php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h
derick Fri Mar 14 16:18:26 2008 UTC Modified files: /php-src/ext/date php_date.c php_date.h Log: - Allow datetime objects to be serialized and woken up. - Implemented __set_state(). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.171&r2=1.172&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.171 php-src/ext/date/php_date.c:1.172 --- php-src/ext/date/php_date.c:1.171 Sun Mar 9 18:10:09 2008 +++ php-src/ext/date/php_date.c Fri Mar 14 16:18:25 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.171 2008/03/09 18:10:09 iliaa Exp $ */ +/* $Id: php_date.c,v 1.172 2008/03/14 16:18:25 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -207,8 +207,10 @@ const zend_function_entry date_funcs_date[] = { PHP_ME(DateTime,__construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(createFromFormat, date_create_from_format, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(getLastErrors, date_get_last_errors, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(DateTime,__wakeup, NULL, ZEND_ACC_PUBLIC) + PHP_ME(DateTime,__set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME_MAPPING(createFromFormat, date_create_from_format, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME_MAPPING(getLastErrors, date_get_last_errors, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(format, date_format, NULL, 0) PHP_ME_MAPPING(modify, date_modify, NULL, 0) PHP_ME_MAPPING(getTimezone, date_timezone_get, NULL, 0) @@ -273,6 +275,7 @@ struct _php_date_obj { zend_object std; timelib_time *time; + HashTable*props; }; struct _php_timezone_obj { @@ -321,6 +324,7 @@ static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC); static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC); +static HashTable *date_object_get_properties(zval *object TSRMLS_DC); static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC); /* This is need to ensure that session extension request shutdown occurs 1st, because it uses the date extension */ @@ -1649,6 +1653,7 @@ memcpy(&date_object_handlers_date, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); date_object_handlers_date.clone_obj = date_object_clone_date; date_object_handlers_date.compare_objects = date_object_compare_date; + date_object_handlers_date.get_properties = date_object_get_properties; #define REGISTER_DATE_CLASS_CONST_STRING(const_name, value) \ zend_declare_class_constant_stringl(date_ce_date, const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC); @@ -1758,6 +1763,65 @@ return 1; } +static HashTable *date_object_get_properties(zval *object TSRMLS_DC) +{ + HashTable*props; + zval *zv; + php_date_obj *dateobj; + char *str; + int return_len; + + dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); + + props = dateobj->std.properties; + + if (!dateobj->time) { + return props; + } + + // first we add the date and time in ISO format + str = date_format("Y-m-d H:i:s", 12, &return_len, dateobj->time, 1, 0); + MAKE_STD_ZVAL(zv); + if (UG(unicode)) { + ZVAL_UNICODEL(zv, (UChar*) str, return_len - 1, 0); + } else { + ZVAL_STRINGL(zv, str, return_len - 1, 0); + } + zend_hash_update(props, "date", 5, &zv, sizeof(zval), NULL); + + // then we add the timezone name (or similar) + if (dateobj->time->is_localtime) { + MAKE_STD_ZVAL(zv); + ZVAL_LONG(zv, dateobj->time->zone_type); + zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL); + + MAKE_STD_ZVAL(zv); + switch (dateobj->time->zone_type) { + case TIMELIB_ZONETYPE_ID: + ZVAL_STRING(zv, dateobj->time->tz_info->name, 1); + break; + case TIMELIB_ZONETYPE_OFFSET: { + char *tmpstr = emalloc(sizeof("UTC+05:00")); + timelib_sll utc_offset = dateobj->time->z; + + snprintf(tmpstr, sizeof("+05:00"), "%c%02d:%02d", + utc_offset > 0 ? '-' : '+', + abs(utc_offset / 60), + abs((utc_offset % 60))); + + ZVAL_STRING(zv, tmpstr, 0); +
[PHP-CVS] cvs: php-src /ext/date php_date.c
iliaa Sun Mar 9 18:10:09 2008 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: Initialize ts only after successful argument parsing http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.170&r2=1.171&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.170 php-src/ext/date/php_date.c:1.171 --- php-src/ext/date/php_date.c:1.170 Fri Mar 7 02:05:48 2008 +++ php-src/ext/date/php_date.c Sun Mar 9 18:10:09 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.170 2008/03/07 02:05:48 iliaa Exp $ */ +/* $Id: php_date.c,v 1.171 2008/03/09 18:10:09 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -1013,12 +1013,12 @@ longts; char *string; - if (ZEND_NUM_ARGS() == 1) { - ts = time(NULL); - } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } + if (ZEND_NUM_ARGS() == 1) { + ts = time(NULL); + } string = php_format_date(format, format_len, ts, localtime TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
iliaa Fri Mar 7 02:05:48 2008 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: Fixed a memory leak inside date_get_last_errors() when there are no errors http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.169&r2=1.170&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.169 php-src/ext/date/php_date.c:1.170 --- php-src/ext/date/php_date.c:1.169 Tue Mar 4 23:39:15 2008 +++ php-src/ext/date/php_date.c Fri Mar 7 02:05:48 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.169 2008/03/04 23:39:15 felipe Exp $ */ +/* $Id: php_date.c,v 1.170 2008/03/07 02:05:48 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -2039,8 +2039,8 @@ */ PHP_FUNCTION(date_get_last_errors) { - array_init(return_value); if (DATEG(last_errors)) { + array_init(return_value); zval_from_error_container(return_value, DATEG(last_errors)); } else { RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/filter filter.c /ext/msql php_msql.c /ext/mysqli mysqli_nonapi.c /ext/pdo pdo_dbh.c pdo_stmt.c /ext/posix posix.c /ext/standard filestat.c /ext/
felipe Tue Mar 4 23:39:16 2008 UTC Modified files: /php-src/sapi/apache2handlerphp_functions.c /php-src/main output.c /php-src/ext/zlib zlib.c /php-src/ext/xmlwriter php_xmlwriter.c /php-src/ext/unicodecollator.c /php-src/ext/tidy tidy.c /php-src/ext/standard filestat.c /php-src/ext/posix posix.c /php-src/ext/pdopdo_stmt.c pdo_dbh.c /php-src/ext/mysqli mysqli_nonapi.c /php-src/ext/msql php_msql.c /php-src/ext/filter filter.c /php-src/ext/date php_date.c Log: New way for check void parameters http://cvs.php.net/viewvc.cgi/php-src/sapi/apache2handler/php_functions.c?r1=1.31&r2=1.32&diff_format=u Index: php-src/sapi/apache2handler/php_functions.c diff -u php-src/sapi/apache2handler/php_functions.c:1.31 php-src/sapi/apache2handler/php_functions.c:1.32 --- php-src/sapi/apache2handler/php_functions.c:1.31Mon Dec 31 07:12:19 2007 +++ php-src/sapi/apache2handler/php_functions.c Tue Mar 4 23:39:14 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_functions.c,v 1.31 2007/12/31 07:12:19 sebastian Exp $ */ +/* $Id: php_functions.c,v 1.32 2008/03/04 23:39:14 felipe Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -179,8 +179,8 @@ const apr_array_header_t *arr; char *key, *val; - if (ZEND_NUM_ARGS()) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters_none() == FAILURE) { + return; } array_init(return_value); @@ -203,8 +203,8 @@ const apr_array_header_t *arr; char *key, *val; - if (ZEND_NUM_ARGS()) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters_none() == FAILURE) { + return; } array_init(return_value); http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.209&r2=1.210&diff_format=u Index: php-src/main/output.c diff -u php-src/main/output.c:1.209 php-src/main/output.c:1.210 --- php-src/main/output.c:1.209 Sat Feb 2 23:25:43 2008 +++ php-src/main/output.c Tue Mar 4 23:39:15 2008 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: output.c,v 1.209 2008/02/02 23:25:43 helly Exp $ */ +/* $Id: output.c,v 1.210 2008/03/04 23:39:15 felipe Exp $ */ #ifndef PHP_OUTPUT_DEBUG # define PHP_OUTPUT_DEBUG 0 @@ -1355,8 +1355,8 @@ Flush (send) contents of the output buffer. The last buffer content is sent to next buffer */ PHP_FUNCTION(ob_flush) { - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } if (!OG(active)) { @@ -1376,8 +1376,8 @@ Clean (delete) the current output buffer */ PHP_FUNCTION(ob_clean) { - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } if (!OG(active)) { @@ -1396,8 +1396,8 @@ Flush (send) the output buffer, and delete current output buffer */ PHP_FUNCTION(ob_end_flush) { - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } if (!OG(active)) { @@ -1412,8 +1412,8 @@ Clean the output buffer, and delete current output buffer */ PHP_FUNCTION(ob_end_clean) { - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } if (!OG(active)) { @@ -1428,8 +1428,8 @@ Get current buffer contents, flush (send) the output buffer, and delete current output buffer */ PHP_FUNCTION(ob_get_flush) { - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } if (SUCCESS != php_output_get_contents(return_value TSRMLS_CC)) { @@ -1446,8 +1446,8 @@ Get current buffer contents and delete current output buffer */ PHP_FUNCTION(ob_get_clean) { - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } if (SUCCESS != php_output_get_contents(return_value TSRMLS_CC)) { @@ -1464,8 +1464,8 @@ Return the contents of the output buffer */ PHP_FUNCTION(ob_get_contents) { - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } if (SUCCESS != php_output_get_contents(return_value TSRMLS_CC)) { RETURN_FALSE; @@ -1477,8 +1477,8 @@ Return the nesting level of the output buffer */ PHP_FUNCTION(ob_get_level) { -
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Wed Feb 27 09:47:24 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed bug #44260 (African timezones missing). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.167&r2=1.168&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.167 php-src/ext/date/php_date.c:1.168 --- php-src/ext/date/php_date.c:1.167 Mon Feb 25 22:32:26 2008 +++ php-src/ext/date/php_date.c Wed Feb 27 09:47:23 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.167 2008/02/25 22:32:26 derick Exp $ */ +/* $Id: php_date.c,v 1.168 2008/02/27 09:47:23 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1625,18 +1625,19 @@ } /* }}} */ -#define PHP_DATE_TIMEZONE_GROUP_AMERICA0x0001 -#define PHP_DATE_TIMEZONE_GROUP_ANTARCTICA 0x0002 -#define PHP_DATE_TIMEZONE_GROUP_ARCTIC 0x0004 -#define PHP_DATE_TIMEZONE_GROUP_ASIA 0x0008 -#define PHP_DATE_TIMEZONE_GROUP_ATLANTIC 0x0010 -#define PHP_DATE_TIMEZONE_GROUP_AUSTRALIA 0x0020 -#define PHP_DATE_TIMEZONE_GROUP_EUROPE 0x0040 -#define PHP_DATE_TIMEZONE_GROUP_INDIAN 0x0080 -#define PHP_DATE_TIMEZONE_GROUP_PACIFIC0x0100 -#define PHP_DATE_TIMEZONE_GROUP_UTC0x0200 -#define PHP_DATE_TIMEZONE_GROUP_ALL0x03FF -#define PHP_DATE_TIMEZONE_GROUP_ALL_W_BC 0x07FF +#define PHP_DATE_TIMEZONE_GROUP_AFRICA 0x0001 +#define PHP_DATE_TIMEZONE_GROUP_AMERICA0x0002 +#define PHP_DATE_TIMEZONE_GROUP_ANTARCTICA 0x0004 +#define PHP_DATE_TIMEZONE_GROUP_ARCTIC 0x0008 +#define PHP_DATE_TIMEZONE_GROUP_ASIA 0x0010 +#define PHP_DATE_TIMEZONE_GROUP_ATLANTIC 0x0020 +#define PHP_DATE_TIMEZONE_GROUP_AUSTRALIA 0x0040 +#define PHP_DATE_TIMEZONE_GROUP_EUROPE 0x0080 +#define PHP_DATE_TIMEZONE_GROUP_INDIAN 0x0100 +#define PHP_DATE_TIMEZONE_GROUP_PACIFIC0x0200 +#define PHP_DATE_TIMEZONE_GROUP_UTC0x0400 +#define PHP_DATE_TIMEZONE_GROUP_ALL0x07FF +#define PHP_DATE_TIMEZONE_GROUP_ALL_W_BC 0x0FFF static void date_register_classes(TSRMLS_D) { @@ -1674,6 +1675,7 @@ #define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \ zend_declare_class_constant_long(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC); + REGISTER_TIMEZONE_CLASS_CONST_STRING("AFRICA", PHP_DATE_TIMEZONE_GROUP_AFRICA); REGISTER_TIMEZONE_CLASS_CONST_STRING("AMERICA", PHP_DATE_TIMEZONE_GROUP_AMERICA); REGISTER_TIMEZONE_CLASS_CONST_STRING("ANTARCTICA", PHP_DATE_TIMEZONE_GROUP_ANTARCTICA); REGISTER_TIMEZONE_CLASS_CONST_STRING("ARCTIC", PHP_DATE_TIMEZONE_GROUP_ARCTIC); @@ -2668,6 +2670,7 @@ static int check_id_allowed(char *id, long what) { + if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1; if (what & PHP_DATE_TIMEZONE_GROUP_AMERICA&& strncasecmp(id, "America/", 8) == 0) return 1; if (what & PHP_DATE_TIMEZONE_GROUP_ANTARCTICA && strncasecmp(id, "Antarctica/", 11) == 0) return 1; if (what & PHP_DATE_TIMEZONE_GROUP_ARCTIC && strncasecmp(id, "Arctic/", 7) == 0) return 1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests bug41523-64bit.phpt bug41523.phpt mktime-3-64bit.phpt mktime-3.phpt strtotime-mysql-64bit.phpt strtotime-mysql.phpt strtotime3-64bit.phpt s
derick Mon Feb 25 22:32:26 2008 UTC Added files: /php-src/ext/wddx/tests 001-64bit.phpt /php-src/ext/date/tests bug41523-64bit.phpt mktime-3-64bit.phpt strtotime-mysql-64bit.phpt strtotime3-64bit.phpt Modified files: /php-src/ext/wddx/tests 001.phpt /php-src/ext/date php_date.c /php-src/ext/date/tests bug41523.phpt mktime-3.phpt strtotime-mysql.phpt strtotime3.phpt Log: - Fixed tests on 64bit platform. http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/tests/001.phpt?r1=1.9&r2=1.10&diff_format=u Index: php-src/ext/wddx/tests/001.phpt diff -u php-src/ext/wddx/tests/001.phpt:1.9 php-src/ext/wddx/tests/001.phpt:1.10 --- php-src/ext/wddx/tests/001.phpt:1.9 Fri May 18 11:29:40 2007 +++ php-src/ext/wddx/tests/001.phpt Mon Feb 25 22:32:25 2008 @@ -1,7 +1,8 @@ --TEST-- -wddx unserialization test +wddx unserialization test (32-bit) --SKIPIF-- + --INI-- precision=14 --FILE-- http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.166&r2=1.167&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.166 php-src/ext/date/php_date.c:1.167 --- php-src/ext/date/php_date.c:1.166 Sat Feb 23 17:03:53 2008 +++ php-src/ext/date/php_date.c Mon Feb 25 22:32:26 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.166 2008/02/23 17:03:53 helly Exp $ */ +/* $Id: php_date.c,v 1.167 2008/02/25 22:32:26 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1193,7 +1193,7 @@ ret = php_idate(format[0], ts, 0); if (ret == -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token"); RETURN_FALSE; } RETURN_LONG(ret); http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug41523.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/date/tests/bug41523.phpt diff -u php-src/ext/date/tests/bug41523.phpt:1.2 php-src/ext/date/tests/bug41523.phpt:1.3 --- php-src/ext/date/tests/bug41523.phpt:1.2Fri Jul 13 15:22:34 2007 +++ php-src/ext/date/tests/bug41523.phptMon Feb 25 22:32:26 2008 @@ -1,5 +1,7 @@ --TEST-- -Bug #41523 (strtotime('-00-00 00:00:00') is parsed as 1999-11-30) +Bug #41523 (strtotime('-00-00 00:00:00') is parsed as 1999-11-30) (32 bit) +--SKIPIF-- + --FILE-- http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/mktime-3.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/date/tests/mktime-3.phpt diff -u php-src/ext/date/tests/mktime-3.phpt:1.4 php-src/ext/date/tests/mktime-3.phpt:1.5 --- php-src/ext/date/tests/mktime-3.phpt:1.4Mon Dec 19 12:57:49 2005 +++ php-src/ext/date/tests/mktime-3.phptMon Feb 25 22:32:26 2008 @@ -1,5 +1,7 @@ --TEST-- -mktime() [3] +mktime() [3] (32-bit) +--SKIPIF-- + --INI-- error_reporting=2047 --FILE-- http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/strtotime-mysql.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/date/tests/strtotime-mysql.phpt diff -u php-src/ext/date/tests/strtotime-mysql.phpt:1.3 php-src/ext/date/tests/strtotime-mysql.phpt:1.4 --- php-src/ext/date/tests/strtotime-mysql.phpt:1.3 Sat Jun 17 12:48:20 2006 +++ php-src/ext/date/tests/strtotime-mysql.phpt Mon Feb 25 22:32:26 2008 @@ -1,5 +1,7 @@ --TEST-- -strtotime() and mysql timestamps +strtotime() and mysql timestamps (32 bit) +--SKIPIF-- + --FILE-- http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/strtotime3.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/date/tests/strtotime3.phpt diff -u php-src/ext/date/tests/strtotime3.phpt:1.4 php-src/ext/date/tests/strtotime3.phpt:1.5 --- php-src/ext/date/tests/strtotime3.phpt:1.4 Sat Jun 17 12:48:20 2006 +++ php-src/ext/date/tests/strtotime3.phpt Mon Feb 25 22:32:26 2008 @@ -1,5 +1,7 @@ --TEST-- -strtotime() function +strtotime() function (32 bit) +--SKIPIF-- + --FILE-- http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/tests/001-64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/wddx/tests/001-64bit.phpt +++ php-src/ext/wddx/tests/001-64bit.phpt --TEST-- wddx deserialization test (64-bit) --SKIPIF-- --INI-- precision=14 --FILE-- --EXPECT-- array(11) { ["aNull"]=> NULL ["aString"]=> string(8) "a string" ["aNumber"]=> float(-12.456) ["aDateTime"]=> int(897625932) ["aDateTime2"]=> int(329632332) ["aDateTime3"]=> int(2223088332) ["aBoolean"]=> bool(true) ["anArray"]=> array(2) { [0]=> int(10) [1]=> string(14) "second element" } ["aBinary"]=> string(11) "binary data" ["anObject"]=> array(2) { ["s"]=> string(8) "a string" ["n"]=> float(-12.456) } ["aRecordset"]=> array(2) { ["NAME"]=> array(2) { [0]=> string(8) "John Doe" [1
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/mysql php_mysql.c /ext/standard dl.c file.c string.c /ext/standard/tests/serialize bug31402.phpt /main main.c /tests/classes new_001.phpt /tests/
helly Sat Feb 23 17:03:53 2008 UTC Modified files: /ZendEngine2zend.c zend_builtin_functions.c zend_compile.c zend_constants.c zend_errors.h zend_execute_API.c zend_language_parser.y zend_vm_def.h zend_vm_execute.h /ZendEngine2/tests bug33771.phpt error_reporting01.phpt error_reporting02.phpt error_reporting03.phpt error_reporting04.phpt error_reporting05.phpt error_reporting06.phpt error_reporting07.phpt error_reporting08.phpt error_reporting09.phpt error_reporting10.phpt is_a.phpt /php-src/ext/date php_date.c /php-src/ext/mysql php_mysql.c /php-src/ext/standard dl.c file.c string.c /php-src/ext/standard/tests/serialize bug31402.phpt /php-src/main main.c /php-src/tests/classes new_001.phpt /php-src/tests/lang bug20175.phpt bug22231.phpt bug22510.phpt Log: - Add E_DEPRECATED (Lars Strojny, Felipe Pena, Marcus) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.c?r1=1.406&r2=1.407&diff_format=u Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.406 ZendEngine2/zend.c:1.407 --- ZendEngine2/zend.c:1.406Mon Jan 28 20:33:50 2008 +++ ZendEngine2/zend.c Sat Feb 23 17:03:51 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend.c,v 1.406 2008/01/28 20:33:50 derick Exp $ */ +/* $Id: zend.c,v 1.407 2008/02/23 17:03:51 helly Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -74,7 +74,7 @@ static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ { if (!new_value) { - EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT; + EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED; } else { EG(error_reporting) = atoi(new_value); } @@ -1481,6 +1481,7 @@ case E_ERROR: case E_NOTICE: case E_STRICT: + case E_DEPRECATED: case E_WARNING: case E_USER_ERROR: case E_USER_WARNING: http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.366&r2=1.367&diff_format=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.366 ZendEngine2/zend_builtin_functions.c:1.367 --- ZendEngine2/zend_builtin_functions.c:1.366 Thu Feb 21 15:14:38 2008 +++ ZendEngine2/zend_builtin_functions.cSat Feb 23 17:03:51 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_builtin_functions.c,v 1.366 2008/02/21 15:14:38 dmitry Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.367 2008/02/23 17:03:51 helly Exp $ */ #include "zend.h" #include "zend_API.h" @@ -124,7 +124,7 @@ ZEND_FE(get_included_files, NULL) ZEND_FALIAS(get_required_files, get_included_files, NULL) ZEND_FE(is_subclass_of, NULL) - ZEND_FE(is_a, NULL) + ZEND_DEP_FE(is_a, NULL) ZEND_FE(get_class_vars, NULL) ZEND_FE(get_object_vars,NULL) ZEND_FE(get_class_methods, NULL) @@ -740,7 +740,6 @@ Returns true if the object is of this class or has this class as one of its parents */ ZEND_FUNCTION(is_a) { - zend_error(E_STRICT, "is_a(): Deprecated. Please use the instanceof operator"); is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.802&r2=1.803&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.802 ZendEngine2/zend_compile.c:1.803 --- ZendEngine2/zend_compile.c:1.802Wed Feb 20 12:06:28 2008 +++ ZendEngine2/zend_compile.c Sat Feb 23 17:03:51 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_compile.c,v 1.802 2008/02/20 12:06:28 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.803 2008/02/23 17:03:51 helly Exp $ */ #include #include "zend.h" @@ -2032,13 +2032,13 @@ function_ptr->common.function_name.v && function_ptr->common.type == ZEND_USER_FUNCTION && !ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) { - zend_error(E_STRICT, + zend_error(E_DEPRECATED, "Call-time pass-by-reference has been deprecated; " "if you would like to pass argument by reference, modify the declaration of %R().", UG(unicode)?IS_UNICODE:IS_STRING, function_ptr->common.function_name.v); } else{ - zend_error(E_STRICT, +
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Wed Feb 13 21:53:01 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Add some missing elements from the return value. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.164&r2=1.165&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.164 php-src/ext/date/php_date.c:1.165 --- php-src/ext/date/php_date.c:1.164 Sat Feb 2 17:25:40 2008 +++ php-src/ext/date/php_date.c Wed Feb 13 21:53:01 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.164 2008/02/02 17:25:40 derick Exp $ */ +/* $Id: php_date.c,v 1.165 2008/02/13 21:53:01 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2098,7 +2098,7 @@ break; } } - if (parsed_time->have_relative || parsed_time->have_weekday_relative) { + if (parsed_time->have_relative || parsed_time->have_weekday_relative || parsed_time->have_special_relative || parsed_time->relative.first_last_day_of) { MAKE_STD_ZVAL(element); array_init(element); } @@ -2113,7 +2113,13 @@ if (parsed_time->have_weekday_relative) { add_ascii_assoc_long(element, "weekday", parsed_time->relative.weekday); } - if (parsed_time->have_relative || parsed_time->have_weekday_relative) { + if (parsed_time->have_special_relative && (parsed_time->special.type == TIMELIB_SPECIAL_WEEKDAY)) { + add_ascii_assoc_long(element, "weekdays", parsed_time->special.amount); + } + if (parsed_time->relative.first_last_day_of) { + add_ascii_assoc_bool(element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1); + } + if (parsed_time->have_relative || parsed_time->have_weekday_relative || parsed_time->have_special_relative || parsed_time->relative.first_last_day_of) { add_ascii_assoc_zval(return_value, "relative", element); } timelib_time_dtor(parsed_time); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Sat Feb 2 17:25:40 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Make timezone_open() work again. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.163&r2=1.164&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.163 php-src/ext/date/php_date.c:1.164 --- php-src/ext/date/php_date.c:1.163 Tue Jan 29 20:12:23 2008 +++ php-src/ext/date/php_date.c Sat Feb 2 17:25:40 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.163 2008/01/29 20:12:23 derick Exp $ */ +/* $Id: php_date.c,v 1.164 2008/02/02 17:25:40 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2489,6 +2489,7 @@ tzobj = zend_object_store_get_object(date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC); tzobj->type = TIMELIB_ZONETYPE_ID; tzobj->tzi.tz = tzi; + tzobj->initialized = 1; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Tue Jan 29 20:12:23 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Make whitespace the same as in 5.3. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.162&r2=1.163&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.162 php-src/ext/date/php_date.c:1.163 --- php-src/ext/date/php_date.c:1.162 Mon Jan 28 21:12:24 2008 +++ php-src/ext/date/php_date.c Tue Jan 29 20:12:23 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.162 2008/01/28 21:12:24 derick Exp $ */ +/* $Id: php_date.c,v 1.163 2008/01/29 20:12:23 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -205,7 +205,6 @@ {NULL, NULL, NULL} }; - const zend_function_entry date_funcs_date[] = { PHP_ME(DateTime,__construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) PHP_ME_MAPPING(createFromFormat, date_create_from_format, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) @@ -233,8 +232,8 @@ {NULL, NULL, NULL} }; -static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC); static void date_register_classes(TSRMLS_D); +static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC); /* }}} */ ZEND_DECLARE_MODULE_GLOBALS(date) @@ -494,9 +493,7 @@ PHP_MINIT_FUNCTION(date) { REGISTER_INI_ENTRIES(); - date_register_classes(TSRMLS_C); - /* * RFC4287, Section 3.3: http://www.ietf.org/rfc/rfc4287.txt * A Date construct is an element whose content MUST conform to the @@ -1196,7 +1193,7 @@ ret = php_idate(format[0], ts, 0); if (ret == -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token."); RETURN_FALSE; } RETURN_LONG(ret); @@ -1291,7 +1288,7 @@ timelib_tzinfo_dtor(t->tz_info); } - timelib_time_dtor(now); + timelib_time_dtor(now); timelib_time_dtor(t); if (error1 || error2) { @@ -1514,7 +1511,6 @@ } else { RETURN_STRINGL(buf, real_len, 0); } - } efree(buf); RETURN_FALSE; @@ -1945,7 +1941,7 @@ dateobj->time->have_weekday_relative = dateobj->time->have_relative = 0; - if (type == TIMELIB_ZONETYPE_ID && now->tz_info != tzi) { + if (type == TIMELIB_ZONETYPE_ID && now->tz_info != tzi) { timelib_tzinfo_dtor(now->tz_info); } if (free_tzi) { @@ -2074,7 +2070,7 @@ add_ascii_assoc_double(return_value, "fraction", parsed_time->f); } - zval_from_error_container(return_value, error); + zval_from_error_container(return_value, error); timelib_error_container_dtor(error); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Mon Jan 28 21:12:24 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Added two optional parameters to timezone_transitions_get() / DateTimeZone::getTranstions() to limit the range of transitions being returned. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.161&r2=1.162&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.161 php-src/ext/date/php_date.c:1.162 --- php-src/ext/date/php_date.c:1.161 Mon Jan 28 20:36:04 2008 +++ php-src/ext/date/php_date.c Mon Jan 28 21:12:24 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.161 2008/01/28 20:36:04 derick Exp $ */ +/* $Id: php_date.c,v 1.162 2008/01/28 21:12:24 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2606,16 +2606,17 @@ } /* }}} */ -/* {{{ proto array timezone_transitions_get(DateTimeZone object) - Returns numeracilly indexed array containing associative array for all transitions for the timezone. +/* {{{ proto array timezone_transitions_get(DateTimeZone object [, long timestamp_begin [, long timestamp_end ]]) + Returns numerically indexed array containing associative array for all transitions in the specified range for the timezone. */ PHP_FUNCTION(timezone_transitions_get) { zval*object, *element; php_timezone_obj*tzobj; - int i; + int i, first = 1; + long timestamp_begin = LONG_MIN, timestamp_end = LONG_MAX; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_timezone) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ll", &object, date_ce_timezone, ×tamp_begin, ×tamp_end) == FAILURE) { RETURN_FALSE; } tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC); @@ -2626,19 +2627,38 @@ array_init(return_value); for (i = 0; i < tzobj->tzi.tz->timecnt; ++i) { - MAKE_STD_ZVAL(element); - array_init(element); - add_ascii_assoc_long(element, "ts", tzobj->tzi.tz->trans[i]); - if (UG(unicode)) { - add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tzi.tz->trans[i], 0 TSRMLS_CC), 0); - } else { - add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tzi.tz->trans[i], 0 TSRMLS_CC), 0); - } - add_ascii_assoc_long(element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); - add_ascii_assoc_bool(element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); - add_ascii_assoc_ascii_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1); + if (tzobj->tzi.tz->trans[i] >= timestamp_begin && tzobj->tzi.tz->trans[i] < timestamp_end) { + if (first && timestamp_begin != LONG_MIN && i > 0 && timestamp_begin != tzobj->tzi.tz->trans[i]) + { + MAKE_STD_ZVAL(element); + array_init(element); + add_ascii_assoc_long(element, "ts", timestamp_begin); + if (UG(unicode)) { + add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); + } else { + add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); + } + add_ascii_assoc_long(element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i-1]].offset); + add_ascii_assoc_bool(element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i-1]].isdst); + add_ascii_assoc_ascii_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i-1]].abbr_idx], 1); + + add_next_index_zval(return_value, element); + } + MAKE_STD_ZVAL(element); + array_init(element); + add_ascii_assoc_long(element, "ts", tzobj->tzi.tz->trans[i]); + if (UG(unicode)) { + add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tzi.tz->trans[i], 0 TSRMLS_CC), 0); + } else { + add_assoc_str
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Mon Jan 28 20:36:04 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - MF53: Added missing folding tags. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.160&r2=1.161&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.160 php-src/ext/date/php_date.c:1.161 --- php-src/ext/date/php_date.c:1.160 Mon Jan 28 20:29:40 2008 +++ php-src/ext/date/php_date.c Mon Jan 28 20:36:04 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.160 2008/01/28 20:29:40 derick Exp $ */ +/* $Id: php_date.c,v 1.161 2008/01/28 20:36:04 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2159,6 +2159,7 @@ parsed_time = timelib_parse_from_format(format, date, date_len, &error, DATE_TIMEZONEDB); php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAM_PASSTHRU, parsed_time, error); } +/* }}} */ /* {{{ proto string date_format(DateTime object, string format) Returns date formatted according to given format -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h
derick Mon Jan 28 20:29:40 2008 UTC Modified files: /php-src/ext/date php_date.c php_date.h Log: - Added DateTime::getTimestamp() / date_timestamp_get(). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.159&r2=1.160&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.159 php-src/ext/date/php_date.c:1.160 --- php-src/ext/date/php_date.c:1.159 Sun Jan 27 17:44:16 2008 +++ php-src/ext/date/php_date.c Mon Jan 28 20:29:40 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.159 2008/01/27 17:44:16 derick Exp $ */ +/* $Id: php_date.c,v 1.160 2008/01/28 20:29:40 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -184,6 +184,7 @@ PHP_FE(date_date_set, NULL) PHP_FE(date_isodate_set, NULL) PHP_FE(date_timestamp_set, NULL) + PHP_FE(date_timestamp_get, NULL) PHP_FE(timezone_open, NULL) PHP_FE(timezone_name_get, NULL) @@ -218,6 +219,7 @@ PHP_ME_MAPPING(setDate, date_date_set, NULL, 0) PHP_ME_MAPPING(setISODate, date_isodate_set, NULL, 0) PHP_ME_MAPPING(setTimestamp,date_timestamp_set, NULL, 0) + PHP_ME_MAPPING(getTimestamp,date_timestamp_get, NULL, 0) {NULL, NULL, NULL} }; @@ -2425,6 +2427,32 @@ } /* }}} */ +/* {{{ proto long date_timestamp_get(DateTime object) + Gets the Unix timestamp. +*/ +PHP_FUNCTION(date_timestamp_get) +{ + zval *object; + php_date_obj *dateobj; + long timestamp; + int error; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_date) == FAILURE) { + RETURN_FALSE; + } + dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); + DATE_CHECK_INITIALIZED(dateobj->time, DateTime); + timelib_update_ts(dateobj->time, NULL); + + timestamp = timelib_date_to_int(dateobj->time, &error); + if (error) { + RETURN_FALSE; + } else { + RETVAL_LONG(timestamp); + } +} +/* }}} */ + static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz TSRMLS_DC) { char *tzid; http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.h?r1=1.35&r2=1.36&diff_format=u Index: php-src/ext/date/php_date.h diff -u php-src/ext/date/php_date.h:1.35 php-src/ext/date/php_date.h:1.36 --- php-src/ext/date/php_date.h:1.35Sun Jan 13 15:16:47 2008 +++ php-src/ext/date/php_date.h Mon Jan 28 20:29:40 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.h,v 1.35 2008/01/13 15:16:47 derick Exp $ */ +/* $Id: php_date.h,v 1.36 2008/01/28 20:29:40 derick Exp $ */ #ifndef PHP_DATE_H #define PHP_DATE_H @@ -64,6 +64,7 @@ PHP_FUNCTION(date_date_set); PHP_FUNCTION(date_isodate_set); PHP_FUNCTION(date_timestamp_set); +PHP_FUNCTION(date_timestamp_get); PHP_METHOD(DateTimeZone, __construct); PHP_FUNCTION(timezone_open); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Sun Jan 27 17:44:16 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Update proto. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.158&r2=1.159&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.158 php-src/ext/date/php_date.c:1.159 --- php-src/ext/date/php_date.c:1.158 Sun Jan 27 17:28:57 2008 +++ php-src/ext/date/php_date.c Sun Jan 27 17:44:16 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.158 2008/01/27 17:28:57 derick Exp $ */ +/* $Id: php_date.c,v 1.159 2008/01/27 17:44:16 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2629,7 +2629,7 @@ return 0; } -/* {{{ proto array timezone_identifiers_list() +/* {{{ proto array timezone_identifiers_list([long what]) Returns numerically index array with all timezone identifiers. */ PHP_FUNCTION(timezone_identifiers_list) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests timezones-list.phpt
derick Sun Jan 27 17:28:58 2008 UTC Added files: /php-src/ext/date/tests timezones-list.phpt Modified files: /php-src/ext/date php_date.c Log: - Added support for selectively listing timezone identifiers through timezone_identifiers_list() / DateTimezone::listIdentifiers(). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.157&r2=1.158&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.157 php-src/ext/date/php_date.c:1.158 --- php-src/ext/date/php_date.c:1.157 Wed Jan 23 15:14:18 2008 +++ php-src/ext/date/php_date.c Sun Jan 27 17:28:57 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.157 2008/01/23 15:14:18 tony2001 Exp $ */ +/* $Id: php_date.c,v 1.158 2008/01/27 17:28:57 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1627,6 +1627,19 @@ } /* }}} */ +#define PHP_DATE_TIMEZONE_GROUP_AMERICA0x0001 +#define PHP_DATE_TIMEZONE_GROUP_ANTARCTICA 0x0002 +#define PHP_DATE_TIMEZONE_GROUP_ARCTIC 0x0004 +#define PHP_DATE_TIMEZONE_GROUP_ASIA 0x0008 +#define PHP_DATE_TIMEZONE_GROUP_ATLANTIC 0x0010 +#define PHP_DATE_TIMEZONE_GROUP_AUSTRALIA 0x0020 +#define PHP_DATE_TIMEZONE_GROUP_EUROPE 0x0040 +#define PHP_DATE_TIMEZONE_GROUP_INDIAN 0x0080 +#define PHP_DATE_TIMEZONE_GROUP_PACIFIC0x0100 +#define PHP_DATE_TIMEZONE_GROUP_UTC0x0200 +#define PHP_DATE_TIMEZONE_GROUP_ALL0x03FF +#define PHP_DATE_TIMEZONE_GROUP_ALL_W_BC 0x07FF + static void date_register_classes(TSRMLS_D) { zend_class_entry ce_date, ce_timezone; @@ -1659,6 +1672,22 @@ date_ce_timezone = zend_register_internal_class_ex(&ce_timezone, NULL, NULL TSRMLS_CC); memcpy(&date_object_handlers_timezone, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); date_object_handlers_timezone.clone_obj = date_object_clone_timezone; + +#define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \ + zend_declare_class_constant_long(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC); + + REGISTER_TIMEZONE_CLASS_CONST_STRING("AMERICA", PHP_DATE_TIMEZONE_GROUP_AMERICA); + REGISTER_TIMEZONE_CLASS_CONST_STRING("ANTARCTICA", PHP_DATE_TIMEZONE_GROUP_ANTARCTICA); + REGISTER_TIMEZONE_CLASS_CONST_STRING("ARCTIC", PHP_DATE_TIMEZONE_GROUP_ARCTIC); + REGISTER_TIMEZONE_CLASS_CONST_STRING("ASIA", PHP_DATE_TIMEZONE_GROUP_ASIA); + REGISTER_TIMEZONE_CLASS_CONST_STRING("ATLANTIC", PHP_DATE_TIMEZONE_GROUP_ATLANTIC); + REGISTER_TIMEZONE_CLASS_CONST_STRING("AUSTRALIA", PHP_DATE_TIMEZONE_GROUP_AUSTRALIA); + REGISTER_TIMEZONE_CLASS_CONST_STRING("EUROPE", PHP_DATE_TIMEZONE_GROUP_EUROPE); + REGISTER_TIMEZONE_CLASS_CONST_STRING("INDIAN", PHP_DATE_TIMEZONE_GROUP_INDIAN); + REGISTER_TIMEZONE_CLASS_CONST_STRING("PACIFIC", PHP_DATE_TIMEZONE_GROUP_PACIFIC); + REGISTER_TIMEZONE_CLASS_CONST_STRING("UTC", PHP_DATE_TIMEZONE_GROUP_UTC); + REGISTER_TIMEZONE_CLASS_CONST_STRING("ALL", PHP_DATE_TIMEZONE_GROUP_ALL); + REGISTER_TIMEZONE_CLASS_CONST_STRING("ALL_WITH_BC", PHP_DATE_TIMEZONE_GROUP_ALL_W_BC); } static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_type, php_date_obj **ptr TSRMLS_DC) @@ -2585,6 +2614,21 @@ } /* }}} */ +static int check_id_allowed(char *id, long what) +{ + if (what & PHP_DATE_TIMEZONE_GROUP_AMERICA&& strncasecmp(id, "America/", 8) == 0) return 1; + if (what & PHP_DATE_TIMEZONE_GROUP_ANTARCTICA && strncasecmp(id, "Antarctica/", 11) == 0) return 1; + if (what & PHP_DATE_TIMEZONE_GROUP_ARCTIC && strncasecmp(id, "Arctic/", 7) == 0) return 1; + if (what & PHP_DATE_TIMEZONE_GROUP_ASIA && strncasecmp(id, "Asia/",5) == 0) return 1; + if (what & PHP_DATE_TIMEZONE_GROUP_ATLANTIC && strncasecmp(id, "Atlantic/",9) == 0) return 1; + if (what & PHP_DATE_TIMEZONE_GROUP_AUSTRALIA && strncasecmp(id, "Australia/", 10) == 0) return 1; + if (what & PHP_DATE_TIMEZONE_GROUP_EUROPE && strncasecmp(id, "Europe/", 7) == 0) return 1; + if (what & PHP_DATE_TIMEZONE_GROUP_INDIAN && strncasecmp(id, "Indian/", 7) == 0) return 1; + if (what & PHP_DATE_TIMEZONE_GROUP_PACIFIC&& strncasecmp(id, "Pacific/", 8) == 0) return 1; + if (what & PHP_DATE_TIMEZONE_GROUP_UTC&& strncasecmp(id, "UTC", 3) == 0) return 1; + return 0; +} + /* {{{ proto array timezone_identifiers_list() Returns numerically index array with all timezone identifiers. */ @@ -2593,6 +2637,11 @@ const timelib_tzdb *tzdb; const timelib_tzdb_index_entry *table; int i, item_count; + longwhat = PHP_DATE_
[PHP-CVS] cvs: php-src /ext/date php_date.c
tony2001Wed Jan 23 15:14:18 2008 UTC Modified files: /php-src/ext/date php_date.c Log: add missing TSRMLS_CC and fix segfaults in ZTS mode http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.156&r2=1.157&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.156 php-src/ext/date/php_date.c:1.157 --- php-src/ext/date/php_date.c:1.156 Thu Jan 17 20:34:17 2008 +++ php-src/ext/date/php_date.c Wed Jan 23 15:14:18 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.156 2008/01/17 20:34:17 derick Exp $ */ +/* $Id: php_date.c,v 1.157 2008/01/23 15:14:18 tony2001 Exp $ */ #include "php.h" #include "php_streams.h" @@ -940,17 +940,17 @@ break; case 'T': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s", localtime ? offset->abbr : "GMT"); break; case 'e': if (!localtime) { - length = date_spprintf(&buffer, 32, "%s", "UTC"); + length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s", "UTC"); } else { switch (t->zone_type) { case TIMELIB_ZONETYPE_ID: - length = date_spprintf(&buffer, 32, "%s", t->tz_info->name); + length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s", t->tz_info->name); break; case TIMELIB_ZONETYPE_ABBR: - length = date_spprintf(&buffer, 32, "%s", offset->abbr); + length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s", offset->abbr); break; case TIMELIB_ZONETYPE_OFFSET: - length = date_spprintf(&buffer, 32, "%c%02d:%02d", + length = date_spprintf(&buffer, 32 TSRMLS_CC, "%c%02d:%02d", ((offset->offset < 0) ? '-' : '+'), abs(offset->offset / 3600), abs((offset->offset % 3600) / 60) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests bug43808.phpt
derick Thu Jan 17 20:34:17 2008 UTC Added files: /php-src/ext/date/tests bug43808.phpt Modified files: /php-src/ext/date php_date.c Log: - Fixed bug #43808 (date_create never fails (even when it should)). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.155&r2=1.156&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.155 php-src/ext/date/php_date.c:1.156 --- php-src/ext/date/php_date.c:1.155 Thu Jan 17 19:58:24 2008 +++ php-src/ext/date/php_date.c Thu Jan 17 20:34:17 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.155 2008/01/17 19:58:24 derick Exp $ */ +/* $Id: php_date.c,v 1.156 2008/01/17 20:34:17 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1832,7 +1832,7 @@ DATEG(last_errors) = last_errors; } -static void date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object TSRMLS_DC) +static int date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC) { timelib_time *now; timelib_tzinfo *tzi; @@ -1856,6 +1856,16 @@ // update last errors and warnings update_errors_warnings(err TSRMLS_CC); + + if (ctor && err && err->error_count) { + /* spit out the first library error message, at least */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse time string (%s) at position %d (%c): %s", time_str, + err->error_messages[0].position, err->error_messages[0].character, err->error_messages[0].message); + } + if (err && err->error_count) { + return 0; + } + if (timezone_object) { php_timezone_obj *tzobj; @@ -1910,7 +1920,9 @@ if (free_tzi) { timelib_tzinfo_dtor(tzi); } - timelib_time_dtor(now); + timelib_time_dtor(now); + + return 1; } /* {{{ proto DateTime date_create([string time[, DateTimeZone object]]) @@ -1927,7 +1939,9 @@ } date_instantiate(date_ce_date, return_value TSRMLS_CC); - date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, NULL, timezone_object TSRMLS_CC); + if (!date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) { + RETURN_FALSE; + } } /* }}} */ @@ -1945,7 +1959,9 @@ } date_instantiate(date_ce_date, return_value TSRMLS_CC); - date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, format_str, timezone_object TSRMLS_CC); + if (!date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) { + RETURN_FALSE; + } } /* }}} */ @@ -1960,7 +1976,7 @@ php_set_error_handling(EH_THROW, NULL TSRMLS_CC); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { - date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object TSRMLS_CC); + date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); } php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug43808.phpt?view=markup&rev=1.1 Index: php-src/ext/date/tests/bug43808.phpt +++ php-src/ext/date/tests/bug43808.phpt --TEST-- Bug #43808 (date_create never fails (even when it should)) --FILE-- --EXPECT-- bool(false) array(4) { ["warning_count"]=> int(1) ["warnings"]=> array(1) { [6]=> string(29) "Double timezone specification" } ["error_count"]=> int(1) ["errors"]=> array(1) { [0]=> string(47) "The timezone could not be found in the database" } } array(4) { ["warning_count"]=> int(1) ["warnings"]=> array(1) { [6]=> string(29) "Double timezone specification" } ["error_count"]=> int(1) ["errors"]=> array(1) { [0]=> string(47) "The timezone could not be found in the database" } } --UEXPECT-- bool(false) array(4) { [u"warning_count"]=> int(1) [u"warnings"]=> array(1) { [6]=> string(29) "Double timezone specification" } [u"error_count"]=> int(1) [u"errors"]=> array(1) { [0]=> string(47) "The timezone could not be found in the database" } } array(4) { [u"warning_count"]=> int(1) [u"warnings"]=> array(1) { [6]=> string(29) "Double timezone specification" } [u"error_count"]=> int(1) [u"errors"]=> ar
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests bug43003.phpt
derick Thu Jan 17 19:58:24 2008 UTC Added files: /php-src/ext/date/tests bug43003.phpt Modified files: /php-src/ext/date php_date.c Log: - Fixed bug #43003 (Invalid timezone reported for DateTime objects constructed using a timestamp). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.154&r2=1.155&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.154 php-src/ext/date/php_date.c:1.155 --- php-src/ext/date/php_date.c:1.154 Thu Jan 17 18:48:43 2008 +++ php-src/ext/date/php_date.c Thu Jan 17 19:58:24 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.154 2008/01/17 18:48:43 derick Exp $ */ +/* $Id: php_date.c,v 1.155 2008/01/17 19:58:24 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -276,6 +276,7 @@ struct _php_timezone_obj { zend_object std; + int initialized; int type; union { timelib_tzinfo *tz; // TIMELIB_ZONETYPE_ID; @@ -1762,6 +1763,7 @@ zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC); new_obj->type = old_obj->type; + new_obj->initialized = 1; switch (new_obj->type) { case TIMELIB_ZONETYPE_ID: new_obj->tzi.tz = old_obj->tzi.tz; @@ -2210,6 +2212,7 @@ if (dateobj->time->is_localtime/* && dateobj->time->tz_info*/) { date_instantiate(date_ce_timezone, return_value TSRMLS_CC); tzobj = (php_timezone_obj *) zend_object_store_get_object(return_value TSRMLS_CC); + tzobj->initialized = 1; tzobj->type = dateobj->time->zone_type; switch (dateobj->time->zone_type) { case TIMELIB_ZONETYPE_ID: @@ -2435,6 +2438,7 @@ tzobj = zend_object_store_get_object(getThis() TSRMLS_CC); tzobj->type = TIMELIB_ZONETYPE_ID; tzobj->tzi.tz = tzi; + tzobj->initialized = 1; } else { ZVAL_NULL(getThis()); } @@ -2455,7 +2459,7 @@ RETURN_FALSE; } tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC); - DATE_CHECK_INITIALIZED(tzobj->tzi.tz, DateTimeZone); + DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone); switch (tzobj->type) { case TIMELIB_ZONETYPE_ID: @@ -2518,7 +2522,7 @@ RETURN_FALSE; } tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC); - DATE_CHECK_INITIALIZED(tzobj->tzi.tz, DateTimeZone); + DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone); dateobj = (php_date_obj *) zend_object_store_get_object(dateobject TSRMLS_CC); DATE_CHECK_INITIALIZED(dateobj->time, DateTime); @@ -2541,7 +2545,7 @@ RETURN_FALSE; } tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC); - DATE_CHECK_INITIALIZED(tzobj->tzi.tz, DateTimeZone); + DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone); if (tzobj->type != TIMELIB_ZONETYPE_ID) { RETURN_FALSE; } http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug43003.phpt?view=markup&rev=1.1 Index: php-src/ext/date/tests/bug43003.phpt +++ php-src/ext/date/tests/bug43003.phpt --TEST-- Bug #43003 (Invalid timezone reported for DateTime objects constructed using a timestamp) --FILE-- getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n"; $oDateTest->setTimezone(new DateTimeZone("UTC")); echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n"; $oDateTest->setTimezone(new DateTimeZone(date_default_timezone_get())); echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n"; $oDateTest = new DateTime("@0"); echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n"; $oDateTest->setTimezone( new DateTimeZone(date_default_timezone_get())); echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n"; ?> --EXPECT-- +00:00: 1970-01-01 00:00:00 UTC: 1970-01-01 00:00:00 Europe/Oslo: 1970-01-01 01:00:00 +00:00: 1970-01-01 00:00:00 Europe/Oslo: 1970-01-01 01:00:00 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests bug40743.phpt bug42910.phpt bug43527.phpt
derick Thu Jan 17 18:48:44 2008 UTC Added files: /php-src/ext/date/tests bug40743.phpt bug42910.phpt bug43527.phpt Modified files: /php-src/ext/date php_date.c Log: - Added support for abbreviation and offset based timezone specifiers for DateTime::getOffset() and DateTime::getName(). - Fixed bug #43527 (DateTime created from a timestamp reports environment timezone). - Fixed bug #42190 (Constructing DateTime with TimeZone Indicator invalidates DateTimeZone). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.153&r2=1.154&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.153 php-src/ext/date/php_date.c:1.154 --- php-src/ext/date/php_date.c:1.153 Sun Jan 13 18:42:51 2008 +++ php-src/ext/date/php_date.c Thu Jan 17 18:48:43 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.153 2008/01/13 18:42:51 derick Exp $ */ +/* $Id: php_date.c,v 1.154 2008/01/17 18:48:43 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -276,7 +276,17 @@ struct _php_timezone_obj { zend_object std; - timelib_tzinfo *tz; + int type; + union { + timelib_tzinfo *tz; // TIMELIB_ZONETYPE_ID; + timelib_sll utc_offset; // TIMELIB_ZONETYPE_OFFSET + struct // TIMELIB_ZONETYPE_ABBR + { + timelib_sll utc_offset; + char*abbr; + int dst; + } z; + } tzi; }; #define DATE_SET_CONTEXT \ @@ -928,7 +938,26 @@ ); break; case 'T': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s", localtime ? offset->abbr : "GMT"); break; - case 'e': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%s", localtime ? t->tz_info->name : "UTC"); break; + case 'e': if (!localtime) { + length = date_spprintf(&buffer, 32, "%s", "UTC"); + } else { + switch (t->zone_type) { + case TIMELIB_ZONETYPE_ID: + length = date_spprintf(&buffer, 32, "%s", t->tz_info->name); + break; + case TIMELIB_ZONETYPE_ABBR: + length = date_spprintf(&buffer, 32, "%s", offset->abbr); + break; + case TIMELIB_ZONETYPE_OFFSET: + length = date_spprintf(&buffer, 32, "%c%02d:%02d", + ((offset->offset < 0) ? '-' : '+'), + abs(offset->offset / 3600), + abs((offset->offset % 3600) / 60) + ); + break; + } + } + break; case 'Z': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%d", localtime ? offset->offset : 0); break; /* full date/time */ @@ -1221,7 +1250,7 @@ now = timelib_time_ctor(); initial_ts = emalloc(25); - snprintf(initial_ts, 24, "@%ld", preset_ts); + snprintf(initial_ts, 24, "@%ld UTC", preset_ts); t = timelib_strtotime(initial_ts, strlen(initial_ts), NULL, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */ timelib_update_ts(t, tzi); now->tz_info = tzi; @@ -1732,7 +1761,20 @@ zend_object_value new_ov = date_object_new_timezone_ex(old_obj->std.ce, &new_obj TSRMLS_CC); zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC); - new_obj->tz = old_obj->tz; + new_obj->type = old_obj->type; + switch (new_obj->type) { + case TIMELIB_ZONETYPE_ID: + new_obj->tzi.tz = old_obj->tzi.tz; + break; +
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Sun Jan 13 18:42:51 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed TSRM builds. #- Thanks for the hint Steph. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.152&r2=1.153&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.152 php-src/ext/date/php_date.c:1.153 --- php-src/ext/date/php_date.c:1.152 Sun Jan 13 15:16:47 2008 +++ php-src/ext/date/php_date.c Sun Jan 13 18:42:51 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.152 2008/01/13 15:16:47 derick Exp $ */ +/* $Id: php_date.c,v 1.153 2008/01/13 18:42:51 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -1776,7 +1776,7 @@ /* Helper function used to store the latest found warnings and errors while * parsing, from either strtotime or parse_from_format. */ -static void update_errors_warnings(timelib_error_container *last_errors) +static void update_errors_warnings(timelib_error_container *last_errors TSRMLS_DC) { if (DATEG(last_errors)) { timelib_error_container_dtor(DATEG(last_errors)); @@ -1805,7 +1805,7 @@ } // update last errors and warnings - update_errors_warnings(err); + update_errors_warnings(err TSRMLS_CC); if (timezone_object) { php_timezone_obj *tzobj; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h /ext/date/lib parse_date.c parse_date.re timelib.h
derick Sun Jan 13 15:16:48 2008 UTC Modified files: /php-src/ext/date php_date.c php_date.h /php-src/ext/date/lib parse_date.c parse_date.re timelib.h Log: - MF53: Added new date/time functionality: * date_parse_from_format(): Parse date/time strings according to a format. * date_create_from_format()/DateTime::createFromFormat(): Create a date/time object by parsing a date/time string according to a given format. * date_get_last_errors()/DateTime::getLastErrors(): Return a list of warnings and errors that were found while parsing a date/time string through: - strtotime() / new DateTime - date_create_from_format() / DateTime::createFromFormat() - date_parse_from_format() http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.151&r2=1.152&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.151 php-src/ext/date/php_date.c:1.152 --- php-src/ext/date/php_date.c:1.151 Mon Dec 31 07:12:08 2007 +++ php-src/ext/date/php_date.c Sun Jan 13 15:16:47 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.151 2007/12/31 07:12:08 sebastian Exp $ */ +/* $Id: php_date.c,v 1.152 2008/01/13 15:16:47 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -169,7 +169,10 @@ /* Advanced Interface */ PHP_FE(date_create, NULL) + PHP_FE(date_create_from_format, NULL) PHP_FE(date_parse, NULL) + PHP_FE(date_parse_from_format, NULL) + PHP_FE(date_get_last_errors, NULL) PHP_FE(date_format, NULL) PHP_FE(date_format_locale, NULL) PHP_FE(date_modify, NULL) @@ -204,6 +207,8 @@ const zend_function_entry date_funcs_date[] = { PHP_ME(DateTime,__construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createFromFormat, date_create_from_format, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME_MAPPING(getLastErrors, date_get_last_errors, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(format, date_format, NULL, 0) PHP_ME_MAPPING(modify, date_modify, NULL, 0) PHP_ME_MAPPING(getTimezone, date_timezone_get, NULL, 0) @@ -515,7 +520,8 @@ php_date_global_timezone_db = NULL; php_date_global_timezone_db_enabled = 0; - + + DATEG(last_errors) = NULL; return SUCCESS; } /* }}} */ @@ -525,6 +531,10 @@ { UNREGISTER_INI_ENTRIES(); + if (DATEG(last_errors)) { + timelib_error_container_dtor(DATEG(last_errors)); + } + return SUCCESS; } /* }}} */ @@ -1764,7 +1774,18 @@ return object; } -static void date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, zval *timezone_object TSRMLS_DC) +/* Helper function used to store the latest found warnings and errors while + * parsing, from either strtotime or parse_from_format. */ +static void update_errors_warnings(timelib_error_container *last_errors) +{ + if (DATEG(last_errors)) { + timelib_error_container_dtor(DATEG(last_errors)); + DATEG(last_errors) = NULL; + } + DATEG(last_errors) = last_errors; +} + +static void date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object TSRMLS_DC) { timelib_time *now; timelib_tzinfo *tzi; @@ -1777,16 +1798,15 @@ } timelib_time_dtor(dateobj->time); } - dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, &err, DATE_TIMEZONEDB); - if (err) { - if (err->error_count) { - /* spit out the first library error message, at least */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse time string (%s) at position %d (%c): %s", time_str, - err->error_messages[0].position, err->error_messages[0].character, err->error_messages[0].message); - } - timelib_error_container_dtor(err); + if (format) { + dateobj->time = timelib_parse_from_format(format, time_str_len ? time_str : "", time_str_len ? time_str_len : 0, &err, DATE_TIMEZONEDB); + } else { + dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, &err, DATE_TIMEZONEDB); } + // update last errors and warnings + update_errors_warnings(err); + if (timezone_object) { php_timezone_obj *tzobj; @@ -1832,7 +1852,25 @@ } date_instantiate(date_ce_date, return_value TSRMLS_CC); - date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_l
[PHP-CVS] cvs: php-src /ext/date php_date.c
scottmacFri Dec 14 14:52:38 2007 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: Change createFromTimestamp to setTimestamp http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.149&r2=1.150&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.149 php-src/ext/date/php_date.c:1.150 --- php-src/ext/date/php_date.c:1.149 Fri Dec 14 14:27:18 2007 +++ php-src/ext/date/php_date.c Fri Dec 14 14:52:38 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.149 2007/12/14 14:27:18 scottmac Exp $ */ +/* $Id: php_date.c,v 1.150 2007/12/14 14:52:38 scottmac Exp $ */ #include "php.h" #include "php_streams.h" @@ -212,7 +212,7 @@ PHP_ME_MAPPING(setTime, date_time_set, NULL, 0) PHP_ME_MAPPING(setDate, date_date_set, NULL, 0) PHP_ME_MAPPING(setISODate, date_isodate_set, NULL, 0) - PHP_ME_MAPPING(createFromTimestamp, date_timestamp_set, NULL, 0) + PHP_ME_MAPPING(setTimestamp,date_timestamp_set, NULL, 0) {NULL, NULL, NULL} }; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h
scottmacFri Dec 14 14:27:18 2007 UTC Modified files: /php-src/ext/date php_date.c php_date.h Log: - Add Datetime::createFromTimestamp to allow setting of a unix timestamp without invoking the date parser. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.148&r2=1.149&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.148 php-src/ext/date/php_date.c:1.149 --- php-src/ext/date/php_date.c:1.148 Fri Nov 23 00:15:37 2007 +++ php-src/ext/date/php_date.c Fri Dec 14 14:27:18 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.148 2007/11/23 00:15:37 iliaa Exp $ */ +/* $Id: php_date.c,v 1.149 2007/12/14 14:27:18 scottmac Exp $ */ #include "php.h" #include "php_streams.h" @@ -180,6 +180,7 @@ PHP_FE(date_time_set, NULL) PHP_FE(date_date_set, NULL) PHP_FE(date_isodate_set, NULL) + PHP_FE(date_timestamp_set, NULL) PHP_FE(timezone_open, NULL) PHP_FE(timezone_name_get, NULL) @@ -211,6 +212,7 @@ PHP_ME_MAPPING(setTime, date_time_set, NULL, 0) PHP_ME_MAPPING(setDate, date_date_set, NULL, 0) PHP_ME_MAPPING(setISODate, date_isodate_set, NULL, 0) + PHP_ME_MAPPING(createFromTimestamp, date_timestamp_set, NULL, 0) {NULL, NULL, NULL} }; @@ -2171,6 +2173,25 @@ } /* }}} */ +/* {{{ proto void date_timestamp_set(DateTime object, long unixTimestamp) + Sets the date and time based on an Unix timestamp. +*/ +PHP_FUNCTION(date_timestamp_set) +{ + zval *object; + php_date_obj *dateobj; + long timestamp; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_date, ×tamp) == FAILURE) { + RETURN_FALSE; + } + dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); + DATE_CHECK_INITIALIZED(dateobj->time, DateTime); + timelib_unixtime2gmt(dateobj->time, (timelib_sll)timestamp); + timelib_update_ts(dateobj->time, NULL); +} +/* }}} */ + static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz TSRMLS_DC) { char *tzid; http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.h?r1=1.32&r2=1.33&diff_format=u Index: php-src/ext/date/php_date.h diff -u php-src/ext/date/php_date.h:1.32 php-src/ext/date/php_date.h:1.33 --- php-src/ext/date/php_date.h:1.32Mon Jan 1 09:29:22 2007 +++ php-src/ext/date/php_date.h Fri Dec 14 14:27:18 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.h,v 1.32 2007/01/01 09:29:22 sebastian Exp $ */ +/* $Id: php_date.h,v 1.33 2007/12/14 14:27:18 scottmac Exp $ */ #ifndef PHP_DATE_H #define PHP_DATE_H @@ -60,6 +60,7 @@ PHP_FUNCTION(date_time_set); PHP_FUNCTION(date_date_set); PHP_FUNCTION(date_isodate_set); +PHP_FUNCTION(date_timestamp_set); PHP_METHOD(DateTimeZone, __construct); PHP_FUNCTION(timezone_open); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c
There is still a problem because if you had an exception handler you'd have the same problem. if the constructor fails it should destroy the created object. On 23-Nov-07, at 5:01 AM, Hannes Magnusson wrote: On Nov 23, 2007 1:15 AM, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote: iliaa Fri Nov 23 00:15:37 2007 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: Fixed bug #43377 (PHP crashes with invalid argument for DateTimeZone) You are misreading the bug report. It doesn't really have anything to do with the date extension. The problem is that exceptions thrown via zend_parse_parameters() are caught by a user defined error handler (which should obviously not catch exceptions). -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Ilia Alshanetsky -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/date php_date.c
On Nov 23, 2007 1:15 AM, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote: > iliaa Fri Nov 23 00:15:37 2007 UTC > > Modified files: > /php-src/ext/date php_date.c > Log: > MFB: Fixed bug #43377 (PHP crashes with invalid argument for DateTimeZone) You are misreading the bug report. It doesn't really have anything to do with the date extension. The problem is that exceptions thrown via zend_parse_parameters() are caught by a user defined error handler (which should obviously not catch exceptions). -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
iliaa Fri Nov 23 00:15:37 2007 UTC Modified files: /php-src/ext/date php_date.c Log: MFB: Fixed bug #43377 (PHP crashes with invalid argument for DateTimeZone) http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.147&r2=1.148&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.147 php-src/ext/date/php_date.c:1.148 --- php-src/ext/date/php_date.c:1.147 Sun Oct 7 05:15:03 2007 +++ php-src/ext/date/php_date.c Fri Nov 23 00:15:37 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.147 2007/10/07 05:15:03 davidw Exp $ */ +/* $Id: php_date.c,v 1.148 2007/11/23 00:15:37 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -2223,6 +2223,8 @@ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) { if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) { ((php_timezone_obj *) zend_object_store_get_object(getThis() TSRMLS_CC))->tz = tzi; + } else { + ZVAL_NULL(getThis()); } } php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Mon Sep 3 12:12:51 2007 UTC Modified files: /php-src/ext/date php_date.c Log: - Ugh, fix this properly. http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.144&r2=1.145&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.144 php-src/ext/date/php_date.c:1.145 --- php-src/ext/date/php_date.c:1.144 Mon Sep 3 12:03:46 2007 +++ php-src/ext/date/php_date.c Mon Sep 3 12:12:51 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.144 2007/09/03 12:03:46 derick Exp $ */ +/* $Id: php_date.c,v 1.145 2007/09/03 12:12:51 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2316,7 +2316,7 @@ array_init(element); add_ascii_assoc_long(element, "ts", tzobj->tz->trans[i]); if (UG(unicode)) { - add_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0); + add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0); } else { add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c
derick Mon Sep 3 12:03:46 2007 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed DateTimeZone::getTransitions(). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.143&r2=1.144&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.143 php-src/ext/date/php_date.c:1.144 --- php-src/ext/date/php_date.c:1.143 Fri Jul 13 15:22:34 2007 +++ php-src/ext/date/php_date.c Mon Sep 3 12:03:46 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.143 2007/07/13 15:22:34 dmitry Exp $ */ +/* $Id: php_date.c,v 1.144 2007/09/03 12:03:46 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2315,7 +2315,11 @@ MAKE_STD_ZVAL(element); array_init(element); add_ascii_assoc_long(element, "ts", tzobj->tz->trans[i]); - add_ascii_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0); + if (UG(unicode)) { + add_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0); + } else { + add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0); + } add_ascii_assoc_long(element, "offset", tzobj->tz->type[tzobj->tz->trans_idx[i]].offset); add_ascii_assoc_bool(element, "isdst", tzobj->tz->type[tzobj->tz->trans_idx[i]].isdst); add_ascii_assoc_ascii_string(element, "abbr", &tzobj->tz->timezone_abbr[tzobj->tz->type[tzobj->tz->trans_idx[i]].abbr_idx], 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/date/tests 010.phpt bug35499.phpt bug41523.phpt bug41964.phpt
dmitry Fri Jul 13 15:22:34 2007 UTC Modified files: /php-src/ext/date php_date.c /php-src/ext/date/tests 010.phpt bug35499.phpt bug41523.phpt bug41964.phpt Log: Unicode support http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.142&r2=1.143&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.142 php-src/ext/date/php_date.c:1.143 --- php-src/ext/date/php_date.c:1.142 Thu Jul 12 18:58:48 2007 +++ php-src/ext/date/php_date.c Fri Jul 13 15:22:34 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_date.c,v 1.142 2007/07/12 18:58:48 derick Exp $ */ +/* $Id: php_date.c,v 1.143 2007/07/13 15:22:34 dmitry Exp $ */ #include "php.h" #include "php_streams.h" @@ -1915,16 +1915,16 @@ break; case TIMELIB_ZONETYPE_ID: if (parsed_time->tz_abbr) { - add_ascii_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1); + add_ascii_assoc_ascii_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1); } if (parsed_time->tz_info) { - add_ascii_assoc_string(return_value, "tz_id", parsed_time->tz_info->name, 1); + add_ascii_assoc_ascii_string(return_value, "tz_id", parsed_time->tz_info->name, 1); } break; case TIMELIB_ZONETYPE_ABBR: PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone, z); add_ascii_assoc_bool(return_value, "is_dst", parsed_time->dst); - add_ascii_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1); + add_ascii_assoc_ascii_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1); break; } } @@ -2318,7 +2318,7 @@ add_ascii_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0); add_ascii_assoc_long(element, "offset", tzobj->tz->type[tzobj->tz->trans_idx[i]].offset); add_ascii_assoc_bool(element, "isdst", tzobj->tz->type[tzobj->tz->trans_idx[i]].isdst); - add_ascii_assoc_string(element, "abbr", &tzobj->tz->timezone_abbr[tzobj->tz->type[tzobj->tz->trans_idx[i]].abbr_idx], 1); + add_ascii_assoc_ascii_string(element, "abbr", &tzobj->tz->timezone_abbr[tzobj->tz->type[tzobj->tz->trans_idx[i]].abbr_idx], 1); add_next_index_zval(return_value, element); } @@ -2364,7 +2364,7 @@ add_ascii_assoc_bool(element, "dst", entry->type); add_ascii_assoc_long(element, "offset", entry->gmtoffset); if (entry->full_tz_name) { - add_ascii_assoc_string(element, "timezone_id", entry->full_tz_name, 1); + add_ascii_assoc_ascii_string(element, "timezone_id", entry->full_tz_name, 1); } else { add_ascii_assoc_null(element, "timezone_id"); } http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/010.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/date/tests/010.phpt diff -u php-src/ext/date/tests/010.phpt:1.2 php-src/ext/date/tests/010.phpt:1.3 --- php-src/ext/date/tests/010.phpt:1.2 Fri Apr 20 20:57:57 2007 +++ php-src/ext/date/tests/010.phpt Fri Jul 13 15:22:34 2007 @@ -660,7 +660,7 @@ [u"offset"]=> int(-18000) [u"timezone_id"]=> -string(16) "America/New_York" +unicode(16) "America/New_York" } [1]=> array(3) { @@ -669,7 +669,7 @@ [u"offset"]=> int(-18000) [u"timezone_id"]=> -string(15) "America/Antigua" +unicode(15) "America/Antigua" } [2]=> array(3) { @@ -678,7 +678,7 @@ [u"offset"]=> int(-18000) [u"timezone_id"]=> -string(16) "America/Atikokan" +unicode(16) "America/Atikokan" } [3]=> array(3) { @@ -687,7 +687,7 @@ [u"offset"]=> int(-18000) [u"timezone_id"]=> -string(21) "America/Cambridge_Bay" +unicode(21) "America/Cambridge_Bay" } [4]=> array(3) { @@ -696,7 +696,7 @@ [u"offset"]=> int(-18000) [u"timezone_id"]=> -string(14) "America/Cancun" +unicode(14) "America/Cancun" } [5]=> array(3) { @@ -705,7 +705,7 @@ [u"offset"]=> int(-18000) [u"timezone_id"]=> -string(14) "America/Cayman" +unicode(14) "America/Cayman" } [6]=> array(3) { @@ -714,7 +714,7 @@ [u"offset"]=> int(-18000) [u"timezone_id"]=> -string(15) "America/Chicago" +unicode(15) "America/