[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c /ext/date/tests bug48678.phpt

2009-06-25 Thread Johannes Schlüter
johannesThu Jun 25 15:07:36 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/date/tests bug48678.phpt 

  Modified files:  
/php-src/ext/date   php_date.c 
  Log:
  MFH: Fixed bug #48678 (DateInterval segfaults when unserialising (Ilia)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.83r2=1.43.2.45.2.51.2.84diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.83 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.84
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.83 Mon Jun 22 14:24:27 2009
+++ php-src/ext/date/php_date.c Thu Jun 25 15:07:36 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.83 2009/06/22 14:24:27 iliaa Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.84 2009/06/25 15:07:36 johannes Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2213,6 +2213,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); \

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug48678.phpt?view=markuprev=1.1
Index: php-src/ext/date/tests/bug48678.phpt
+++ php-src/ext/date/tests/bug48678.phpt
--TEST--
Bug #48678 DateInterval segfaults when unserialising
--FILE--
?php
$x = new dateinterval(P3Y6M4DT12H30M5S);
print_r($x);
$y = unserialize(serialize($x));
print_r($y);
--EXPECT--
DateInterval Object
(
[y] = 3
[m] = 6
[d] = 4
[h] = 12
[i] = 30
[s] = 5
[invert] = 0
[days] = 0
)
DateInterval Object
(
[y] = 3
[m] = 6
[d] = 4
[h] = 12
[i] = 30
[s] = 5
[invert] = 0
[days] = 0
)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2009-06-22 Thread Ilia Alshanetsky
iliaa   Mon Jun 22 13:43:14 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/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.43.2.45.2.51.2.81r2=1.43.2.45.2.51.2.82diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.81 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.82
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.81 Sun Jun 21 22:19:11 2009
+++ php-src/ext/date/php_date.c Mon Jun 22 13:43:14 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.81 2009/06/21 22:19:11 scottmac Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.82 2009/06/22 13:43:14 iliaa Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -39,6 +39,10 @@
 static __inline __int64_t llabs( __int64_t i ) { return i = 0 ? i : -i; }
 #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)
@@ -2406,7 +2410,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(PHP_5_3) /ext/date php_date.c

2009-06-22 Thread Ilia Alshanetsky
iliaa   Mon Jun 22 14:24:27 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  Revert unrelated bits to the previous commit
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.82r2=1.43.2.45.2.51.2.83diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.82 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.83
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.82 Mon Jun 22 13:43:14 2009
+++ php-src/ext/date/php_date.c Mon Jun 22 14:24:27 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.82 2009/06/22 13:43:14 iliaa Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.83 2009/06/22 14:24:27 iliaa Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2410,7 +2410,7 @@
}
timelib_unixtime2local(now, (timelib_sll) time(NULL));
 
-   timelib_fill_holes(dateobj-time, now, TIMELIB_NO_CLONE);
+   timelib_fill_holes(dateobj-time, now, 0);
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(PHP_5_3) /ext/date php_date.c

2009-06-21 Thread Hannes Magnusson
bjori   Sun Jun 21 20:40:54 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  Fix proto and arginfo
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.79r2=1.43.2.45.2.51.2.80diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.79 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.80
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.79 Wed Jun 17 17:56:17 2009
+++ php-src/ext/date/php_date.c Sun Jun 21 20:40:53 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.79 2009/06/17 17:56:17 bjori Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.80 2009/06/21 20:40:53 bjori Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -331,6 +331,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)
@@ -3737,7 +3738,7 @@
return 0;
 }
 
-/* {{{ proto array timezone_identifiers_list([long what])
+/* {{{ proto array timezone_identifiers_list([long what[, string country]])
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(PHP_5_3) /ext/date php_date.c

2009-06-21 Thread Scott MacVicar
scottmacSun Jun 21 22:19:12 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  MFH 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.43.2.45.2.51.2.80r2=1.43.2.45.2.51.2.81diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.80 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.81
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.80 Sun Jun 21 20:40:53 2009
+++ php-src/ext/date/php_date.c Sun Jun 21 22:19:11 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.80 2009/06/21 20:40:53 bjori Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.81 2009/06/21 22:19:11 scottmac Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1051,7 +1051,7 @@
/* year */
case 'L': length = slprintf(buffer, 32, %d, 
timelib_is_leap((int) t-y)); break;
case 'y': length = slprintf(buffer, 32, %02d, (int) 
t-y % 100); break;
-   case 'Y': length = slprintf(buffer, 32, %s%04ld, t-y 
 0 ? - : , llabs((timelib_sll) t-y)); break;
+   case 'Y': length = slprintf(buffer, 32, %s%04lld, 
t-y  0 ? - : , llabs((timelib_sll) t-y)); break;
 
/* time */
case 'a': length = slprintf(buffer, 32, %s, t-h = 
12 ? pm : am); break;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2009-06-17 Thread Hannes Magnusson
bjori   Wed Jun 17 17:56:17 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  MFB5.2: Make this happy on gcc2
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.78r2=1.43.2.45.2.51.2.79diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.78 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.79
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.78 Sun May 31 21:28:38 2009
+++ php-src/ext/date/php_date.c Wed Jun 17 17:56:17 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.78 2009/05/31 21:28:38 stas Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.79 2009/06/17 17:56:17 bjori Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -35,6 +35,10 @@
 # include win32/php_stdint.h
 #endif
 
+#if defined(__GNUC__)  __GNUC__  3
+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(PHP_5_3) /ext/date php_date.c php_date.h

2009-05-31 Thread Stanislav Malyshev
stasSun May 31 21:28:38 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/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.43.2.45.2.51.2.77r2=1.43.2.45.2.51.2.78diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.77 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.78
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.77 Tue May 19 19:23:33 2009
+++ php-src/ext/date/php_date.c Sun May 31 21:28:38 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.77 2009/05/19 19:23:33 bjori Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.78 2009/05/31 21:28:38 stas Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -590,6 +590,7 @@
 {
date_globals-default_timezone = NULL;
date_globals-timezone = NULL;
+   date_globals-tzcache = NULL;
 }
 /* }}} */
 
@@ -608,7 +609,7 @@
efree(DATEG(timezone));
}
DATEG(timezone) = NULL;
-   zend_hash_init(DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0);
+   DATEG(tzcache) = NULL;
 
return SUCCESS;
 }
@@ -621,8 +622,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;
 }
 /* }}} */
@@ -804,13 +808,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.17.2.11.2.3.2.12r2=1.17.2.11.2.3.2.13diff_format=u
Index: php-src/ext/date/php_date.h
diff -u php-src/ext/date/php_date.h:1.17.2.11.2.3.2.12 
php-src/ext/date/php_date.h:1.17.2.11.2.3.2.13
--- php-src/ext/date/php_date.h:1.17.2.11.2.3.2.12  Sun May  3 19:58:49 2009
+++ php-src/ext/date/php_date.h Sun May 31 21:28:38 2009
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_date.h,v 1.17.2.11.2.3.2.12 2009/05/03 19:58:49 derick Exp $ */
+/* $Id: php_date.h,v 1.17.2.11.2.3.2.13 2009/05/31 21:28:38 stas Exp $ */
 
 #ifndef PHP_DATE_H
 #define PHP_DATE_H
@@ -149,7 +149,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] cvs: php-src(PHP_5_3) /ext/date php_date.c

2009-05-19 Thread Jani Taskinen
janiTue May 19 15:38:07 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/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.43.2.45.2.51.2.75r2=1.43.2.45.2.51.2.76diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.75 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.76
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.75 Wed May 13 18:48:20 2009
+++ php-src/ext/date/php_date.c Tue May 19 15:38:07 2009
@@ -16,9 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.75 2009/05/13 18:48:20 jani Exp $ */
-
-#define _ISOC9X_SOURCE
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.76 2009/05/19 15:38:07 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(PHP_5_3) /ext/date php_date.c

2009-05-19 Thread Hannes Magnusson
bjori   Tue May 19 19:23:33 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  MFH: Partial fix for bug#48333
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.76r2=1.43.2.45.2.51.2.77diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.76 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.77
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.76 Tue May 19 15:38:07 2009
+++ php-src/ext/date/php_date.c Tue May 19 19:23:33 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.76 2009/05/19 15:38:07 jani Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.77 2009/05/19 19:23:33 bjori Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -339,11 +339,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)
@@ -3570,7 +3572,7 @@
 }
 /* }}} */
 
-/* {{{ proto string date_interval_format(DateInterval object)
+/* {{{ proto string date_interval_format(DateInterval object, string format)
Formats the interval.
 */
 PHP_FUNCTION(date_interval_format)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2009-05-05 Thread Ilia Alshanetsky
iliaa   Tue May  5 12:33:40 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  Fixed compiler warning due to llabs() function
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.73r2=1.43.2.45.2.51.2.74diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.73 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.74
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.73 Mon May  4 17:11:22 2009
+++ php-src/ext/date/php_date.c Tue May  5 12:33:39 2009
@@ -16,7 +16,9 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.73 2009/05/04 17:11:22 pajoye Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.74 2009/05/05 12:33:39 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(PHP_5_3) /ext/date php_date.c

2009-05-04 Thread Pierre-Alain Joye
pajoye  Mon May  4 16:28:50 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/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.43.2.45.2.51.2.71r2=1.43.2.45.2.51.2.72diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.71 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.72
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.71 Sun May  3 19:58:49 2009
+++ php-src/ext/date/php_date.c Mon May  4 16:28:50 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.71 2009/05/03 19:58:49 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.72 2009/05/04 16:28:50 pajoye Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -31,6 +31,11 @@
 #include lib/timelib.h
 #include time.h
 
+#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(PHP_5_3) /ext/date php_date.c

2009-05-04 Thread Pierre-Alain Joye
pajoye  Mon May  4 17:11:23 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/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.43.2.45.2.51.2.72r2=1.43.2.45.2.51.2.73diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.72 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.73
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.72 Mon May  4 16:28:50 2009
+++ php-src/ext/date/php_date.c Mon May  4 17:11:22 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.72 2009/05/04 16:28:50 pajoye Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.73 2009/05/04 17:11:22 pajoye Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -33,7 +33,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(PHP_5_3) /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

2009-05-03 Thread Derick Rethans
derick  Sun May  3 18:22:41 2009 UTC

  Added files: (Branch: PHP_5_3)
/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:
  - MFH: Fixed bug #48058 (Year formatter goes wrong with out-of-int range). 
  - MFH: 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.43.2.45.2.51.2.68r2=1.43.2.45.2.51.2.69diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.68 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.69
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.68 Mon Apr 27 14:22:15 2009
+++ php-src/ext/date/php_date.c Sun May  3 18:22:40 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.68 2009/04/27 14:22:15 kalle Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.69 2009/05/03 18:22:40 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1032,7 +1032,7 @@
/* year */
case 'L': length = slprintf(buffer, 32, %d, 
timelib_is_leap((int) t-y)); break;
case 'y': length = slprintf(buffer, 32, %02d, (int) 
t-y % 100); break;
-   case 'Y': length = slprintf(buffer, 32, %s%04d, t-y 
 0 ? - : , abs((int) t-y)); break;
+   case 'Y': length = slprintf(buffer, 32, %s%04ld, t-y 
 0 ? - : , llabs((timelib_sll) t-y)); break;
 
/* time */
case 'a': length = slprintf(buffer, 32, %s, t-h = 
12 ? pm : am); break;
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/timelib_structs.h?r1=1.13.2.6.2.3.2.8r2=1.13.2.6.2.3.2.9diff_format=u
Index: php-src/ext/date/lib/timelib_structs.h
diff -u php-src/ext/date/lib/timelib_structs.h:1.13.2.6.2.3.2.8 
php-src/ext/date/lib/timelib_structs.h:1.13.2.6.2.3.2.9
--- php-src/ext/date/lib/timelib_structs.h:1.13.2.6.2.3.2.8 Wed Dec 31 
11:15:35 2008
+++ php-src/ext/date/lib/timelib_structs.h  Sun May  3 18:22:40 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: timelib_structs.h,v 1.13.2.6.2.3.2.8 2008/12/31 11:15:35 sebastian Exp 
$ */
+/* $Id: timelib_structs.h,v 1.13.2.6.2.3.2.9 2009/05/03 18:22:40 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.13.2.3.2.2.2.12r2=1.13.2.3.2.2.2.13diff_format=u
Index: php-src/ext/date/lib/tm2unixtime.c
diff -u php-src/ext/date/lib/tm2unixtime.c:1.13.2.3.2.2.2.12 
php-src/ext/date/lib/tm2unixtime.c:1.13.2.3.2.2.2.13
--- php-src/ext/date/lib/tm2unixtime.c:1.13.2.3.2.2.2.12Wed Dec 31 
11:15:35 2008
+++ php-src/ext/date/lib/tm2unixtime.c  Sun May  3 18:22:40 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: tm2unixtime.c,v 1.13.2.3.2.2.2.12 2008/12/31 11:15:35 sebastian Exp $ 
*/
+/* $Id: tm2unixtime.c,v 1.13.2.3.2.2.2.13 2009/05/03 18:22:40 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=markuprev=1.1
Index: 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2009-04-27 Thread Kalle Sommer Nielsen
kalle   Mon Apr 27 14:22:15 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  MFH: 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.43.2.45.2.51.2.67r2=1.43.2.45.2.51.2.68diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.67 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.68
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.67 Tue Apr  7 20:05:50 2009
+++ php-src/ext/date/php_date.c Mon Apr 27 14:22:15 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.67 2009/04/07 20:05:50 felipe Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.68 2009/04/27 14:22:15 kalle Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -428,7 +428,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(PHP_5_3) /ext/date php_date.c

2009-03-27 Thread Hannes Magnusson
bjori   Fri Mar 27 19:22:30 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  MFH: Fix protos
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.65r2=1.43.2.45.2.51.2.66diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.65 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.66
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.65 Tue Jan 27 13:48:10 2009
+++ php-src/ext/date/php_date.c Fri Mar 27 19:22:29 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.65 2009/01/27 13:48:10 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.66 2009/03/27 19:22:29 bjori Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2680,7 +2680,7 @@
 }
 /* }}} */
 
-/* {{{ proto void date_modify(DateTime object, string modify)
+/* {{{ proto DateTime date_modify(DateTime object, string modify)
Alters the timestamp.
 */
 PHP_FUNCTION(date_modify)
@@ -2711,7 +2711,7 @@
 }
 /* }}} */
 
-/* {{{ proto void date_add(DateTime object, DateInterval interval)
+/* {{{ proto DateTime date_add(DateTime object, DateInterval interval)
Adds an interval to the current date in object.
 */
 PHP_FUNCTION(date_add)
@@ -2756,7 +2756,7 @@
 }
 /* }}} */
 
-/* {{{ proto void date_sub(DateTime object, DateInterval interval)
+/* {{{ proto DateTime date_sub(DateTime object, DateInterval interval)
Subtracts an interval to the current date in object.
 */
 PHP_FUNCTION(date_sub)
@@ -2834,7 +2834,7 @@
 }
 /* }}} */
 
-/* {{{ proto void date_timezone_set(DateTime object, DateTimeZone object)
+/* {{{ proto DateTime date_timezone_set(DateTime object, DateTimeZone object)
Sets the timezone for the DateTime object.
 */
 PHP_FUNCTION(date_timezone_set)
@@ -2896,7 +2896,7 @@
 }
 /* }}} */
 
-/* {{{ proto void date_time_set(DateTime object, long hour, long minute[, long 
second])
+/* {{{ proto DateTime date_time_set(DateTime object, long hour, long minute[, 
long second])
Sets the time.
 */
 PHP_FUNCTION(date_time_set)
@@ -2919,7 +2919,7 @@
 }
 /* }}} */
 
-/* {{{ proto void date_date_set(DateTime object, long year, long month, long 
day)
+/* {{{ proto DateTime date_date_set(DateTime object, long year, long month, 
long day)
Sets the date.
 */
 PHP_FUNCTION(date_date_set)
@@ -2942,7 +2942,7 @@
 }
 /* }}} */
 
-/* {{{ proto void date_isodate_set(DateTime object, long year, long week[, 
long day])
+/* {{{ proto DateTime date_isodate_set(DateTime object, long year, long week[, 
long day])
Sets the ISO date.
 */
 PHP_FUNCTION(date_isodate_set)
@@ -2968,7 +2968,7 @@
 }
 /* }}} */
 
-/* {{{ proto void date_timestamp_set(DateTime object, long unixTimestamp)
+/* {{{ proto DateTime date_timestamp_set(DateTime object, long unixTimestamp)
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(PHP_5_3) /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 timestamp-in-dst.phpt

2009-01-27 Thread Derick Rethans
derick  Tue Jan 27 13:48:10 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/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 
timestamp-in-dst.phpt 
  Log:
  - MFH: Elevate no-tz set warning from E_STRICT to E_WARNING. 
  #- [DOC] 
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.64r2=1.43.2.45.2.51.2.65diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.64 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.65
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.64 Wed Dec 31 11:15:35 2008
+++ php-src/ext/date/php_date.c Tue Jan 27 13:48:10 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.64 2008/12/31 11:15:35 sebastian Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.65 2009/01/27 13:48:10 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -707,8 +707,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. 
@@ -845,7 +845,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
@@ -864,7 +864,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 */
@@ -878,7 +878,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.2.2.6r2=1.2.2.6.4.1diff_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.2.2.6 
php-src/ext/date/tests/date_default_timezone_get-1.phpt:1.2.2.6.4.1
--- php-src/ext/date/tests/date_default_timezone_get-1.phpt:1.2.2.6 Tue Dec 
20 19:54:10 2005
+++ php-src/ext/date/tests/date_default_timezone_get-1.phpt Tue Jan 27 
13:48:10 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 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c /ext/date/lib parse_date.c parse_date.re timelib.h

2008-12-18 Thread Derick Rethans
derick  Thu Dec 18 14:55:53 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
/php-src/ext/date/lib   parse_date.c parse_date.re timelib.h 
  Log:
  - MFH: Fixed bug #46889: Memory leak in strtotime().
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.61r2=1.43.2.45.2.51.2.62diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.61 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.62
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.61 Tue Dec  2 18:02:16 2008
+++ php-src/ext/date/php_date.c Thu Dec 18 14:55:13 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.61 2008/12/02 18:02:16 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.62 2008/12/18 14:55:13 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1388,7 +1388,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.29.2.30.2.14.2.28r2=1.29.2.30.2.14.2.29diff_format=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.28 
php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.29
--- php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.28   Thu Nov  6 
09:45:58 2008
+++ php-src/ext/date/lib/parse_date.c   Thu Dec 18 14:55:14 2008
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Wed Nov  5 11:44:09 2008 */
+/* Generated by re2c 0.13.5 on Thu Dec 18 14:58:43 2008 */
 #line 1 ext/date/lib/parse_date.re
 /*
+--+
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: parse_date.c,v 1.29.2.30.2.14.2.28 2008/11/06 09:45:58 derick Exp $ */
+/* $Id: parse_date.c,v 1.29.2.30.2.14.2.29 2008/12/18 14:55:14 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.26.2.27.2.12.2.25r2=1.26.2.27.2.12.2.26diff_format=u
Index: php-src/ext/date/lib/parse_date.re
diff -u php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.25 
php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.26
--- php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.25  Wed Nov  5 
10:42:42 2008
+++ php-src/ext/date/lib/parse_date.re  Thu Dec 18 14:55:36 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: parse_date.re,v 1.26.2.27.2.12.2.25 2008/11/05 10:42:42 derick Exp $ */
+/* $Id: parse_date.re,v 1.26.2.27.2.12.2.26 2008/12/18 14:55:36 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.10.2.11.2.3.2.8r2=1.10.2.11.2.3.2.9diff_format=u
Index: php-src/ext/date/lib/timelib.h
diff -u php-src/ext/date/lib/timelib.h:1.10.2.11.2.3.2.8 
php-src/ext/date/lib/timelib.h:1.10.2.11.2.3.2.9
--- 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c /ext/date/tests mktime-3-64bit.phpt

2008-12-02 Thread Derick Rethans
derick  Tue Dec  2 18:02:16 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
/php-src/ext/date/tests mktime-3-64bit.phpt 
  Log:
  - MFH: Fixed bug #46732 (mktime.year description is wrong).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.60r2=1.43.2.45.2.51.2.61diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.60 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.61
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.60 Wed Nov 19 02:00:53 2008
+++ php-src/ext/date/php_date.c Tue Dec  2 18:02:16 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.60 2008/11/19 02:00:53 colder Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.61 2008/12/02 18:02:16 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1433,7 +1433,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.2.2r2=1.1.2.3diff_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.2.2 
php-src/ext/date/tests/mktime-3-64bit.phpt:1.1.2.3
--- php-src/ext/date/tests/mktime-3-64bit.phpt:1.1.2.2  Mon Feb 25 22:32:59 2008
+++ php-src/ext/date/tests/mktime-3-64bit.phpt  Tue Dec  2 18:02:16 2008
@@ -7,7 +7,7 @@
 --FILE--
 ?php
 $tzs = array(America/Toronto, Europe/Oslo);
-$years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 
2001);
+$years = array(0, 69, 70, 71, 99, 100, 101, 105, 110, 1900, 1901, 1902, 1999, 
2000, 2001);
 
 foreach ($tzs as $tz) {
echo $tz, \n;
@@ -32,7 +32,9 @@
 Y:   71 - January 1971-01-01T01:01:01-0500
 Y:   99 - January 1999-01-01T01:01:01-0500
 Y:  100 - January 2000-01-01T01:01:01-0500
-Y:  105 - January 2005-01-01T01:01:01-0500
+Y:  101 - January 0101-01-01T01:01:01-0500
+Y:  105 - January 0105-01-01T01:01:01-0500
+Y:  110 - January 0110-01-01T01:01:01-0500
 Y: 1900 - January 1900-01-01T01:01:01-0500
 Y: 1901 - January 1901-01-01T01:01:01-0500
 Y: 1902 - January 1902-01-01T01:01:01-0500
@@ -47,7 +49,9 @@
 Y:   71 - January 1971-01-01T01:01:01+0100
 Y:   99 - January 1999-01-01T01:01:01+0100
 Y:  100 - January 2000-01-01T01:01:01+0100
-Y:  105 - January 2005-01-01T01:01:01+0100
+Y:  101 - January 0101-01-01T01:01:01+0100
+Y:  105 - January 0105-01-01T01:01:01+0100
+Y:  110 - January 0110-01-01T01:01:01+0100
 Y: 1900 - January 1900-01-01T01:01:01+0100
 Y: 1901 - January 1901-01-01T01:01:01+0100
 Y: 1902 - January 1902-01-01T01:01:01+0100



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c php_date.h /ext/date/lib parse_date.c

2008-11-06 Thread Derick Rethans
derick  Thu Nov  6 09:46:36 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c php_date.h 
/php-src/ext/date/lib   parse_date.c 
  Log:
  - MFH: 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.43.2.45.2.51.2.57r2=1.43.2.45.2.51.2.58diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.57 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.58
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.57 Sun Nov  2 21:19:30 2008
+++ php-src/ext/date/php_date.c Thu Nov  6 09:45:58 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.57 2008/11/02 21:19:30 felipe Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.58 2008/11/06 09:45:58 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -556,55 +556,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(); \
@@ -2609,7 +2576,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.17.2.11.2.3.2.9r2=1.17.2.11.2.3.2.10diff_format=u
Index: php-src/ext/date/php_date.h
diff -u php-src/ext/date/php_date.h:1.17.2.11.2.3.2.9 
php-src/ext/date/php_date.h:1.17.2.11.2.3.2.10
--- php-src/ext/date/php_date.h:1.17.2.11.2.3.2.9   Fri Jul 18 14:33:53 2008
+++ php-src/ext/date/php_date.h Thu Nov  6 09:45:58 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_date.h,v 1.17.2.11.2.3.2.9 2008/07/18 14:33:53 derick Exp $ */
+/* $Id: php_date.h,v 1.17.2.11.2.3.2.10 2008/11/06 09:45:58 derick Exp $ */
 
 #ifndef PHP_DATE_H
 #define PHP_DATE_H
@@ -101,6 +101,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 

[PHP-CVS] cvs: php-src(PHP_5_3) /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/my

2008-08-08 Thread Etienne Kneuss
colder  Fri Aug  8 22:07:08 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/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:
  MFH: Fix error_handling usage in various extensions
  http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite/sqlite.c?r1=1.166.2.13.2.9.2.10r2=1.166.2.13.2.9.2.11diff_format=u
Index: php-src/ext/sqlite/sqlite.c
diff -u php-src/ext/sqlite/sqlite.c:1.166.2.13.2.9.2.10 
php-src/ext/sqlite/sqlite.c:1.166.2.13.2.9.2.11
--- php-src/ext/sqlite/sqlite.c:1.166.2.13.2.9.2.10 Sat Aug  2 04:46:06 2008
+++ php-src/ext/sqlite/sqlite.c Fri Aug  8 22:07:06 2008
@@ -17,7 +17,7 @@
|  Marcus Boerger [EMAIL PROTECTED]  |
+--+
 
-   $Id: sqlite.c,v 1.166.2.13.2.9.2.10 2008/08/02 04:46:06 felipe Exp $
+   $Id: sqlite.c,v 1.166.2.13.2.9.2.11 2008/08/08 22:07:06 colder Exp $
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1520,7 +1520,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.166.2.13.2.9.2.10 2008/08/02 
04:46:06 felipe Exp $);
+   php_info_print_table_row(2, PECL Module version, 
PHP_SQLITE_MODULE_VERSION  $Id: sqlite.c,v 1.166.2.13.2.9.2.11 2008/08/08 
22:07:06 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();
@@ -1687,10 +1687,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, s|lz/,
filename, filename_len, mode, errmsg)) {
-   php_std_error_handling();
return;
}
if (errmsg) {
@@ -1701,7 +1700,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 {
@@ -1711,7 +1709,6 @@
 
if ((PG(safe_mode)  (!php_checkuid(fullpath, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) ||
php_check_open_basedir(fullpath TSRMLS_CC)) {
-   php_std_error_handling();
efree(fullpath);
if (object) {
RETURN_NULL();
@@ -1726,7 +1723,6 @@
if (fullpath) {
efree(fullpath);
}
-   php_std_error_handling();
 }
 /* }}} */
 
@@ -1739,10 +1735,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, s|lz/,
filename, filename_len, mode, errmsg)) {
-   php_std_error_handling();
RETURN_NULL();
}
if (errmsg) {
@@ -1753,14 +1748,12 @@
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 ((PG(safe_mode)  (!php_checkuid(fullpath, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) ||
php_check_open_basedir(fullpath TSRMLS_CC)) {
efree(fullpath);
-   php_std_error_handling();
RETURN_NULL();
}
}
@@ -1769,7 +1762,6 @@
if (fullpath) {
efree(fullpath);
}
-   php_std_error_handling();
 }
 /* }}} */
 
@@ -2425,11 +2417,11 @@
zend_fcall_info_cache fcc;
zval *retval_ptr;
zval *ctor_params = NULL;
+   zend_error_handling error_handling;
 

[PHP-CVS] cvs: php-src(PHP_5_3) /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

2008-07-30 Thread Derick Rethans
derick  Wed Jul 30 18:00:58 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/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:
  - MFH: Fixed a bug with the -MM format not resetting the day correctly.
  - MFH: Fixed a bug in the DateTime-modify() methods, it would not use the
advanced relative time strings.
  - MFH: 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.43.2.45.2.51.2.51r2=1.43.2.45.2.51.2.52diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.51 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.52
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.51 Wed Jul 30 08:18:05 2008
+++ php-src/ext/date/php_date.c Wed Jul 30 18:00:22 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.51 2008/07/30 08:18:05 jani Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.52 2008/07/30 18:00:22 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2795,20 +2795,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);
 }
 /* }}} */
 
@@ -2948,6 +2943,8 @@
}
timelib_set_timezone(dateobj-time, tzobj-tzi.tz);
timelib_unixtime2local(dateobj-time, dateobj-time-sse);
+
+   RETURN_ZVAL(object, 1, 0);
 }
 /* }}} */
 
@@ -3004,6 +3001,8 @@
dateobj-time-i = i;
dateobj-time-s = s;
timelib_update_ts(dateobj-time, NULL);
+
+   RETURN_ZVAL(object, 1, 0);
 }
 /* }}} */
 
@@ -3025,6 +3024,8 @@
dateobj-time-m = m;
dateobj-time-d = d;
timelib_update_ts(dateobj-time, NULL);
+
+   RETURN_ZVAL(object, 1, 0);
 }
 /* }}} */
 
@@ -3049,6 +3050,8 @@
dateobj-time-have_relative = 1;

timelib_update_ts(dateobj-time, NULL);
+
+   RETURN_ZVAL(object, 1, 0);
 }
 /* }}} */
 
@@ -3068,6 +3071,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.29.2.30.2.14.2.24r2=1.29.2.30.2.14.2.25diff_format=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.24 
php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.25
--- php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.24   Wed Jul 23 
19:53:20 2008
+++ php-src/ext/date/lib/parse_date.c   Wed Jul 30 18:00:23 2008
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Wed Jul 23 21:45:26 2008 */
+/* Generated by re2c 0.13.5 on Wed Jul 30 13:39:05 2008 */
 #line 1 ext/date/lib/parse_date.re
 /*
+--+
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: parse_date.c,v 1.29.2.30.2.14.2.24 2008/07/23 19:53:20 derick Exp $ */
+/* $Id: parse_date.c,v 1.29.2.30.2.14.2.25 2008/07/30 18:00:23 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 @@
  

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2008-07-29 Thread Dmitry Stogov
dmitry  Tue Jul 29 12:56:52 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/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.43.2.45.2.51.2.49r2=1.43.2.45.2.51.2.50diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.49 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.50
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.49 Sun Jul 27 19:10:22 2008
+++ php-src/ext/date/php_date.c Tue Jul 29 12:56:52 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.49 2008/07/27 19:10:22 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.50 2008/07/29 12:56:52 dmitry Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1842,6 +1842,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;
@@ -1867,6 +1868,8 @@
 
date_period_it_invalidate_current(iter TSRMLS_CC);
 
+   zval_ptr_dtor(iterator-date_period_zval);
+
efree(iterator);
 }
 /* }}} */
@@ -1980,7 +1983,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(PHP_5_3) /ext/date php_date.c /ext/date/tests bug44562.phpt

2008-07-20 Thread Derick Rethans
derick  Sun Jul 20 20:58:51 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/date/tests bug44562.phpt 

  Modified files:  
/php-src/ext/date   php_date.c 
  Log:
  - MFH: Fixed bug #45562 (Creating instance of DatePeriod crashes).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.47r2=1.43.2.45.2.51.2.48diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.47 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.48
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.47 Sat Jul 19 17:38:29 2008
+++ php-src/ext/date/php_date.c Sun Jul 20 20:58:51 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.47 2008/07/19 17:38:29 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.48 2008/07/20 20:58:51 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -3555,6 +3555,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);
 }
@@ -3671,7 +3672,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);
@@ -3698,7 +3699,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);
}

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug44562.phpt?view=markuprev=1.1
Index: php-src/ext/date/tests/bug44562.phpt
+++ php-src/ext/date/tests/bug44562.phpt



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2008-07-19 Thread Derick Rethans
derick  Sat Jul 19 17:38:29 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - MFH: Country codes are ISO 3166.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.46r2=1.43.2.45.2.51.2.47diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.46 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.47
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.46 Fri Jul 18 14:33:53 2008
+++ php-src/ext/date/php_date.c Sat Jul 19 17:38:29 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.46 2008/07/18 14:33:53 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.47 2008/07/19 17:38:29 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -3781,7 +3781,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(PHP_5_3) /ext/date php_date.c

2008-07-16 Thread Derick Rethans
derick  Wed Jul 16 12:35:11 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - Fixed a segfault - simply a forgotten return;
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.44r2=1.43.2.45.2.51.2.45diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.44 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.45
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.44 Mon Jul 14 17:38:33 2008
+++ php-src/ext/date/php_date.c Wed Jul 16 12:35:11 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.44 2008/07/14 17:38:33 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.45 2008/07/16 12:35:11 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2928,6 +2928,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(PHP_5_3) /ext/date php_date.c /ext/date/lib dow.c parse_date.c parse_date.re timelib.h

2008-07-14 Thread Derick Rethans
derick  Mon Jul 14 17:36:27 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
/php-src/ext/date/lib   dow.c parse_date.c parse_date.re timelib.h 
  Log:
  - MFH: 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.43.2.45.2.51.2.42r2=1.43.2.45.2.51.2.43diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.42 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.43
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.42 Wed Jul  9 12:50:57 2008
+++ php-src/ext/date/php_date.c Mon Jul 14 17:35:52 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.42 2008/07/09 12:50:57 felipe Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.43 2008/07/14 17:35:52 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1610,7 +1610,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.8.2.3.2.3.2.2r2=1.8.2.3.2.3.2.3diff_format=u
Index: php-src/ext/date/lib/dow.c
diff -u php-src/ext/date/lib/dow.c:1.8.2.3.2.3.2.2 
php-src/ext/date/lib/dow.c:1.8.2.3.2.3.2.3
--- php-src/ext/date/lib/dow.c:1.8.2.3.2.3.2.2  Fri Feb 22 17:48:46 2008
+++ php-src/ext/date/lib/dow.c  Mon Jul 14 17:35:52 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: dow.c,v 1.8.2.3.2.3.2.2 2008/02/22 17:48:46 derick Exp $ */
+/* $Id: dow.c,v 1.8.2.3.2.3.2.3 2008/07/14 17:35:52 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.29.2.30.2.14.2.19r2=1.29.2.30.2.14.2.20diff_format=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.19 
php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.20
--- php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.19   Fri Jul 11 
08:42:35 2008
+++ php-src/ext/date/lib/parse_date.c   Mon Jul 14 17:35:52 2008
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Fri Jul 11 10:39:11 2008 */
+/* Generated by re2c 0.13.5 on Mon Jul 14 19:34:39 2008 */
 #line 1 ext/date/lib/parse_date.re
 /*
+--+
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: parse_date.c,v 1.29.2.30.2.14.2.19 2008/07/11 08:42:35 derick Exp $ */
+/* $Id: parse_date.c,v 1.29.2.30.2.14.2.20 2008/07/14 17:35:52 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.26.2.27.2.12.2.17r2=1.26.2.27.2.12.2.18diff_format=u
Index: php-src/ext/date/lib/parse_date.re
diff -u php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.17 
php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.18
--- php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.17  Fri Jul 11 
08:42:54 2008
+++ php-src/ext/date/lib/parse_date.re  Mon Jul 14 17:36:12 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: parse_date.re,v 1.26.2.27.2.12.2.17 2008/07/11 08:42:54 derick Exp $ */
+/* $Id: parse_date.re,v 1.26.2.27.2.12.2.18 2008/07/14 17:36:12 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, 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2008-07-14 Thread Derick Rethans
derick  Mon Jul 14 17:38:33 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - MFH: Fixed reversed logic.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.43r2=1.43.2.45.2.51.2.44diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.43 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.44
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.43 Mon Jul 14 17:35:52 2008
+++ php-src/ext/date/php_date.c Mon Jul 14 17:38:33 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.43 2008/07/14 17:35:52 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.44 2008/07/14 17:38:33 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1610,7 +1610,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(PHP_5_3) /ext/date php_date.c

2008-07-09 Thread Felipe Pena
felipe  Wed Jul  9 12:50:57 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - Added arginfo
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.41r2=1.43.2.45.2.51.2.42diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.41 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.42
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.41 Tue Jul  8 19:29:18 2008
+++ php-src/ext/date/php_date.c Wed Jul  9 12:50:57 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.41 2008/07/08 19:29:18 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.42 2008/07/09 12:50:57 felipe Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -146,6 +146,264 @@
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)

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c /ext/date/lib parse_date.c parse_date.re parse_iso_intervals.c tm2unixtime.c

2008-07-08 Thread Derick Rethans
derick  Tue Jul  8 17:56:14 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/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.43.2.45.2.51.2.39r2=1.43.2.45.2.51.2.40diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.39 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.40
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.39 Tue Jul  8 17:41:51 2008
+++ php-src/ext/date/php_date.c Tue Jul  8 17:55:40 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.39 2008/07/08 17:41:51 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.40 2008/07/08 17:55:40 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -308,9 +308,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;
@@ -1874,12 +1874,12 @@
return props;
}
 
-   // first we add the date and time in ISO format
+   /* first we add the date and time in ISO format */
MAKE_STD_ZVAL(zv);
ZVAL_STRING(zv, date_format(Y-m-d H:i:s, 12, dateobj-time, 1), 0);
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);
@@ -2132,7 +2132,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.29.2.30.2.14.2.15r2=1.29.2.30.2.14.2.16diff_format=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.15 
php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.16
--- php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.15   Sun May  4 
20:52:37 2008
+++ php-src/ext/date/lib/parse_date.c   Tue Jul  8 17:55:40 2008
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.4 on Sun May  4 22:48:22 2008 */
+/* Generated by re2c 0.13.4 on Tue Jul  8 19:53:07 2008 */
 #line 1 ext/date/lib/parse_date.re
 /*
+--+
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: parse_date.c,v 1.29.2.30.2.14.2.15 2008/05/04 20:52:37 derick Exp $ */
+/* $Id: parse_date.c,v 1.29.2.30.2.14.2.16 2008/07/08 17:55:40 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) */

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2008-07-08 Thread Derick Rethans
derick  Tue Jul  8 19:29:19 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - MFH: Fixed a memleak (Original patch by Hannes Magnusson).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.40r2=1.43.2.45.2.51.2.41diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.40 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.41
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.40 Tue Jul  8 17:55:40 2008
+++ php-src/ext/date/php_date.c Tue Jul  8 19:29:18 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.40 2008/07/08 17:55:40 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.41 2008/07/08 19:29:18 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -3148,11 +3148,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) {
@@ -3168,6 +3170,7 @@
 {
php_interval_obj *obj;
zval tmp_member, tmp_value;
+   int found = 0;
 
if (member-type != IS_STRING) {
tmp_member = *member;
@@ -3185,6 +3188,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);  \
@@ -3199,7 +3203,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(PHP_5_3) /ext/date php_date.c

2008-05-07 Thread Ilia Alshanetsky
iliaa   Wed May  7 23:45:28 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  Kill unused vars
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.37r2=1.43.2.45.2.51.2.38diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.37 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.38
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.37 Sun May  4 10:00:01 2008
+++ php-src/ext/date/php_date.c Wed May  7 23:45:28 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.37 2008/05/04 10:00:01 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.38 2008/05/07 23:45:28 iliaa Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1602,7 +1602,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);
 
@@ -1666,7 +1665,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;
 }
@@ -1677,7 +1675,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);
@@ -1689,7 +1686,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(PHP_5_3) /ext/date php_date.c /ext/date/lib parse_iso_intervals.c parse_iso_intervals.re

2008-05-04 Thread Derick Rethans
derick  Sun May  4 10:00:01 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
/php-src/ext/date/lib   parse_iso_intervals.c parse_iso_intervals.re 
  Log:
  - MFH: Added support for using ISO 8601 time intervals to define a DatePeriod
iterator.
  #- @doc
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.36r2=1.43.2.45.2.51.2.37diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.36 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.37
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.36 Sat May  3 10:59:36 2008
+++ php-src/ext/date/php_date.c Sun May  4 10:00:01 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.36 2008/05/03 10:59:36 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.37 2008/05/04 10:00:01 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -3370,6 +3370,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.
 */
@@ -3380,38 +3404,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);
+   

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c php_date.h /ext/date/lib tm2unixtime.c

2008-05-02 Thread Derick Rethans
derick  Fri May  2 12:49:16 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c php_date.h 
/php-src/ext/date/lib   tm2unixtime.c 
  Log:
  - MFH: Added DateInterval::createFromDateString() that creates an interval
from the relative parts of a date/time string.
  - MFH: Fixed an issue where special relative bits were not applied.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.33r2=1.43.2.45.2.51.2.34diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.33 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.34
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.33 Thu May  1 16:15:26 2008
+++ php-src/ext/date/php_date.c Fri May  2 12:49:16 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.33 2008/05/01 16:15:26 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.34 2008/05/02 12:49:16 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -196,6 +196,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 */
@@ -244,6 +245,7 @@
 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}
 };
 
@@ -1629,6 +1631,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;
@@ -1636,7 +1639,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);
@@ -2246,8 +2251,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)
 {
@@ -3254,7 +3259,7 @@
timelib_rel_time *reltime;

php_set_error_handling(EH_THROW, NULL TSRMLS_CC);
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, 
interval_string, interval_string_length) == SUCCESS) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
interval_string, interval_string_length) == SUCCESS) {
if (date_interval_initialize(reltime, interval_string, 
interval_string_length TSRMLS_CC) == SUCCESS) {
diobj = zend_object_store_get_object(getThis() 
TSRMLS_CC);
diobj-diff = reltime;
@@ -3267,6 +3272,31 @@
 }
 /* }}} */
 
+/* {{{ proto DateInterval date_interval_create_from_date_string(string time)
+   Uses the normal date parsers and sets up a DateInterval from the relative 
parts of the parsed string
+*/
+PHP_FUNCTION(date_interval_create_from_date_string)
+{
+   char   *time_str = NULL;
+   int time_str_len = 0;
+   timelib_time   *time;
+   timelib_error_container *err = NULL;
+   php_interval_obj *diobj;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, time_str, 
time_str_len) == FAILURE) {
+   RETURN_FALSE;
+   }
+
+   date_instantiate(date_ce_interval, return_value TSRMLS_CC);
+
+   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);
+   timelib_time_dtor(time);
+   timelib_error_container_dtor(err);
+}
+/* }}} */
+
 /* {{{ date_interval_format -  */
 static char *date_interval_format(char *format, int format_len, 
timelib_rel_time *t)
 {

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2008-05-01 Thread Derick Rethans
derick  Thu May  1 13:31:22 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - MFH: 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.43.2.45.2.51.2.31r2=1.43.2.45.2.51.2.32diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.31 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.32
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.31 Thu May  1 00:12:24 2008
+++ php-src/ext/date/php_date.c Thu May  1 13:31:22 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.31 2008/05/01 00:12:24 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.32 2008/05/01 13:31:22 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -331,6 +331,7 @@
timelib_rel_time *interval;
int   recurrences;
int   initialized;
+   int   include_start_date;
 };
 
 #define DATE_SET_CONTEXT \
@@ -1570,6 +1571,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 {
@@ -1624,18 +1627,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);
@@ -1789,6 +1794,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)
@@ -3346,11 +3356,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;
}
 
@@ -3369,8 +3379,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(PHP_5_3) /ext/date php_date.c /ext/date/lib parse_date.c parse_date.re timelib.c timelib_structs.h tm2unixtime.c

2008-05-01 Thread Derick Rethans
derick  Thu May  1 16:15:58 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/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:
  - MFH: 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.43.2.45.2.51.2.32r2=1.43.2.45.2.51.2.33diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.32 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.33
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.32 Thu May  1 13:31:22 2008
+++ php-src/ext/date/php_date.c Thu May  1 16:15:26 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.32 2008/05/01 13:31:22 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.33 2008/05/01 16:15:26 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2213,7 +2213,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);
@@ -2453,28 +2453,24 @@
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_assoc_long(element, year,   parsed_time-relative.y);
add_assoc_long(element, month,  parsed_time-relative.m);
add_assoc_long(element, day,parsed_time-relative.d);
add_assoc_long(element, hour,   parsed_time-relative.h);
add_assoc_long(element, minute, parsed_time-relative.i);
add_assoc_long(element, second, parsed_time-relative.s);
-   }
-   if (parsed_time-have_weekday_relative) {
-   add_assoc_long(element, weekday, 
parsed_time-relative.weekday);
-   }
-   if (parsed_time-have_special_relative  (parsed_time-special.type == 
TIMELIB_SPECIAL_WEEKDAY)) {
-   add_assoc_long(element, weekdays, 
parsed_time-special.amount);
-   }
-   if (parsed_time-relative.first_last_day_of) {
-   add_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-relative.have_weekday_relative) {
+   add_assoc_long(element, weekday, 
parsed_time-relative.weekday);
+   }
+   if (parsed_time-relative.have_special_relative  
(parsed_time-relative.special.type == TIMELIB_SPECIAL_WEEKDAY)) {
+   add_assoc_long(element, weekdays, 
parsed_time-relative.special.amount);
+   }
+   if (parsed_time-relative.first_last_day_of) {
+   add_assoc_bool(element, 
parsed_time-relative.first_last_day_of == 1 ? first_day_of_month : 
last_day_of_month, 1);
+   }
add_assoc_zval(return_value, relative, element);
}
timelib_time_dtor(parsed_time);
@@ -2563,7 +2559,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);
 
@@ -2600,9 +2596,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);
@@ -2638,9 +2634,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;
-   

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c /ext/date/tests timestamp-in-dst.phpt

2008-03-31 Thread Derick Rethans
derick  Mon Mar 31 09:11:30 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/date/tests timestamp-in-dst.phpt 

  Modified files:  
/php-src/ext/date   php_date.c 
  Log:
  - MFH: 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.43.2.45.2.51.2.28r2=1.43.2.45.2.51.2.29diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.28 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.29
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.28 Thu Mar 20 19:43:36 2008
+++ php-src/ext/date/php_date.c Mon Mar 31 09:11:30 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.28 2008/03/20 19:43:36 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.29 2008/03/31 09:11:30 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -765,9 +765,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=markuprev=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--
?php
error_reporting(E_ALL  ~E_STRICT); // hide e_strict warning about timezones
var_dump( date_create( '@1202996091' )-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(PHP_5_3) /ext/date php_date.c

2008-03-20 Thread Derick Rethans
derick  Thu Mar 20 19:43:36 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - MFH: Fix the DateTimeZone::getTransitions() algorithm.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.27r2=1.43.2.45.2.51.2.28diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.27 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.28
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.27 Sun Mar 16 15:15:21 2008
+++ php-src/ext/date/php_date.c Thu Mar 20 19:43:36 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.27 2008/03/16 15:15:21 iliaa Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.28 2008/03/20 19:43:36 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2604,7 +2604,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, timestamp_begin, timestamp_end) == 
FAILURE) {
@@ -2616,31 +2616,64 @@
RETURN_FALSE;
}
 
+#define add_nominal() \
+   MAKE_STD_ZVAL(element); \
+   array_init(element); \
+   add_assoc_long(element, ts, timestamp_begin); \
+   add_assoc_string(element, time, 
php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); \
+   add_assoc_long(element, offset, 
tzobj-tzi.tz-type[0].offset); \
+   add_assoc_bool(element, isdst,  
tzobj-tzi.tz-type[0].isdst); \
+   add_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_assoc_long(element, ts, ts); \
+   add_assoc_string(element, time, 
php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC), 0); \
+   add_assoc_long(element, offset, 
tzobj-tzi.tz-type[tzobj-tzi.tz-trans_idx[i]].offset); \
+   add_assoc_bool(element, isdst,  
tzobj-tzi.tz-type[tzobj-tzi.tz-trans_idx[i]].isdst); \
+   add_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_assoc_long(element, ts, 
timestamp_begin);
-   add_assoc_string(element, time, 
php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0);
-   add_assoc_long(element, offset, 
tzobj-tzi.tz-type[tzobj-tzi.tz-trans_idx[i-1]].offset);
-   add_assoc_bool(element, isdst,  
tzobj-tzi.tz-type[tzobj-tzi.tz-trans_idx[i-1]].isdst);
-   add_assoc_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_assoc_long(element, ts, 
tzobj-tzi.tz-trans[i]);
-   add_assoc_string(element, time, 
php_format_date(DATE_FORMAT_ISO8601, 13, tzobj-tzi.tz-trans[i], 0 TSRMLS_CC), 
0);
-   add_assoc_long(element, offset, 
tzobj-tzi.tz-type[tzobj-tzi.tz-trans_idx[i]].offset);
-   add_assoc_bool(element, isdst,  
tzobj-tzi.tz-type[tzobj-tzi.tz-trans_idx[i]].isdst);
-   add_assoc_string(element, abbr, 
tzobj-tzi.tz-timezone_abbr[tzobj-tzi.tz-type[tzobj-tzi.tz-trans_idx[i]].abbr_idx],
 1);
+   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) {
+

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c

2008-03-16 Thread Ilia Alshanetsky
iliaa   Sun Mar 16 15:15:21 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  Remove unused variable
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.26r2=1.43.2.45.2.51.2.27diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.26 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.27
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.26 Fri Mar 14 17:56:52 2008
+++ php-src/ext/date/php_date.c Sun Mar 16 15:15:21 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.26 2008/03/14 17:56:52 felipe Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.27 2008/03/16 15:15:21 iliaa Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1993,7 +1993,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(PHP_5_3) /ext/date php_date.c

2008-03-14 Thread Felipe Pena
felipe  Fri Mar 14 17:56:52 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/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.43.2.45.2.51.2.25r2=1.43.2.45.2.51.2.26diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.25 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.26
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.25 Fri Mar 14 16:19:52 2008
+++ php-src/ext/date/php_date.c Fri Mar 14 17:56:52 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.25 2008/03/14 16:19:52 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.26 2008/03/14 17:56:52 felipe Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1944,7 +1944,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;
@@ -2006,7 +2006,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);
 }
 /* }}} */
 
@@ -2022,7 +2022,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(PHP_5_3) /ext/date php_date.c

2008-03-09 Thread Ilia Alshanetsky
iliaa   Sun Mar  9 18:09:53 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  
  Initialize ts only after successful argument parsing
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.22r2=1.43.2.45.2.51.2.23diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.22 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.23
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.22 Fri Mar  7 02:04:40 2008
+++ php-src/ext/date/php_date.c Sun Mar  9 18:09:53 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.22 2008/03/07 02:04:40 iliaa Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.23 2008/03/09 18:09:53 iliaa Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -899,12 +899,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(PHP_5_3) /ext/date php_date.c

2008-03-06 Thread Ilia Alshanetsky
iliaa   Fri Mar  7 02:04:40 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  
  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.43.2.45.2.51.2.21r2=1.43.2.45.2.51.2.22diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.21 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.22
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.21 Wed Feb 27 09:47:35 2008
+++ php-src/ext/date/php_date.c Fri Mar  7 02:04:40 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.21 2008/02/27 09:47:35 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.22 2008/03/07 02:04:40 iliaa Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1914,8 +1914,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(PHP_5_3) /ext/date php_date.c

2008-02-27 Thread Derick Rethans
derick  Wed Feb 27 09:47:35 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - MFH: Fixed bug #44260 (African timezones missing).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.20r2=1.43.2.45.2.51.2.21diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.20 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.21
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.20 Sat Feb 23 17:06:21 2008
+++ php-src/ext/date/php_date.c Wed Feb 27 09:47:35 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.20 2008/02/23 17:06:21 helly Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.21 2008/02/27 09:47:35 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1500,18 +1500,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)
 {
@@ -1549,6 +1550,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);
@@ -2507,6 +2509,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(PHP_5_3) /ext/date php_date.c

2008-02-13 Thread Derick Rethans
derick  Wed Feb 13 21:53:12 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - MFH: Add some missing elements from the return value.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.18r2=1.43.2.45.2.51.2.19diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.18 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.19
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.18 Sat Feb  2 17:25:54 2008
+++ php-src/ext/date/php_date.c Wed Feb 13 21:53:12 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.18 2008/02/02 17:25:54 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.19 2008/02/13 21:53:12 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1973,7 +1973,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);
}
@@ -1988,7 +1988,13 @@
if (parsed_time-have_weekday_relative) {
add_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_assoc_long(element, weekdays, 
parsed_time-special.amount);
+   }
+   if (parsed_time-relative.first_last_day_of) {
+   add_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_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(PHP_5_3) /ext/date php_date.c

2008-02-02 Thread Derick Rethans
derick  Sat Feb  2 17:25:54 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - MFH: Make timezone_open() work again.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.17r2=1.43.2.45.2.51.2.18diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.17 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.18
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.17 Tue Jan 29 20:12:53 2008
+++ php-src/ext/date/php_date.c Sat Feb  2 17:25:54 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.17 2008/01/29 20:12:53 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.18 2008/02/02 17:25:54 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2336,6 +2336,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(PHP_5_3) /ext/date php_date.c

2008-01-29 Thread Derick Rethans
derick  Tue Jan 29 20:12:53 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - Make whitespace the same as in HEAD.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.16r2=1.43.2.45.2.51.2.17diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.16 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.17
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.16 Mon Jan 28 21:12:41 2008
+++ php-src/ext/date/php_date.c Tue Jan 29 20:12:53 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.16 2008/01/28 21:12:41 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.17 2008/01/29 20:12:53 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -221,15 +221,16 @@
 };
 
 const zend_function_entry date_funcs_timezone[] = {
-   PHP_ME(DateTimeZone,__construct,
NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
-   PHP_ME_MAPPING(getName, timezone_name_get,  
NULL, 0)
-   PHP_ME_MAPPING(getOffset,   timezone_offset_get,
NULL, 0)
-   PHP_ME_MAPPING(getTransitions,  timezone_transitions_get,   
NULL, 0)
-   PHP_ME_MAPPING(listAbbreviations,   timezone_abbreviations_list, 
NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-   PHP_ME_MAPPING(listIdentifiers, timezone_identifiers_list,  
NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+   PHP_ME(DateTimeZone,  __construct, NULL, 
ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
+   PHP_ME_MAPPING(getName,   timezone_name_get,   NULL, 0)
+   PHP_ME_MAPPING(getOffset, timezone_offset_get, NULL, 0)
+   PHP_ME_MAPPING(getTransitions,timezone_transitions_get,NULL, 0)
+   PHP_ME_MAPPING(listAbbreviations, timezone_abbreviations_list, NULL, 
ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+   PHP_ME_MAPPING(listIdentifiers,   timezone_identifiers_list,   NULL, 
ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
{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);
 /* }}} */
@@ -1152,7 +1153,7 @@
timelib_time_dtor(now); 
RETURN_FALSE;
}
-   
+
t = timelib_strtotime(times, time_len, error, DATE_TIMEZONEDB);
error1 = error-error_count;
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(PHP_5_3) /ext/date php_date.c

2008-01-28 Thread Derick Rethans
derick  Mon Jan 28 20:35:17 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - Add missing folding tags.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.14r2=1.43.2.45.2.51.2.15diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.14 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.15
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.14 Mon Jan 28 20:30:50 2008
+++ php-src/ext/date/php_date.c Mon Jan 28 20:35:17 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.14 2008/01/28 20:30:50 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.15 2008/01/28 20:35:17 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2029,6 +2029,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(PHP_5_3) /ext/date php_date.c

2008-01-27 Thread Derick Rethans
derick  Sun Jan 27 17:44:29 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - MFH: Update proto
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.12r2=1.43.2.45.2.51.2.13diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.12 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.13
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.12 Sun Jan 27 17:29:14 2008
+++ php-src/ext/date/php_date.c Sun Jan 27 17:44:29 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.12 2008/01/27 17:29:14 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.13 2008/01/27 17:44:29 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2467,7 +2467,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(PHP_5_3) /ext/date php_date.c

2008-01-13 Thread Derick Rethans
derick  Sun Jan 13 18:42:19 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  - Fixed TSRM builds.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.7r2=1.43.2.45.2.51.2.8diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.7 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.8
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.7  Sun Jan 13 15:15:48 2008
+++ php-src/ext/date/php_date.c Sun Jan 13 18:42:19 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.7 2008/01/13 15:15:48 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.8 2008/01/13 18:42:19 derick Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -1646,7 +1646,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));
@@ -1675,7 +1675,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(PHP_5_3) /ext/date php_date.c

2007-11-22 Thread Ilia Alshanetsky
iliaa   Fri Nov 23 00:15:25 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/date   php_date.c 
  Log:
  
  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.43.2.45.2.51.2.2r2=1.43.2.45.2.51.2.3diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.2 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.3
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.2  Sun Oct  7 05:22:04 2007
+++ php-src/ext/date/php_date.c Fri Nov 23 00:15:24 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.2 2007/10/07 05:22:04 davidw Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.3 2007/11/23 00:15:24 iliaa Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -2066,6 +2066,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