summaryrefslogtreecommitdiff
path: root/ext/date/php_date.h
diff options
context:
space:
mode:
authorStanley Sufficool <ssufficool@php.net>2014-10-20 21:33:32 -0700
committerStanley Sufficool <ssufficool@php.net>2014-10-20 21:33:32 -0700
commit8defcb855ab01d9c8ab4759cb793d80149b55a8c (patch)
treeed51eb30a2cbc92b102557498fb3e4113da1bb07 /ext/date/php_date.h
parent9c7dbb0487f5991fde03873ea8f5e66d6688415f (diff)
parentbaddb1c73a170ef1d2c31bd54cddbc6e1ab596b9 (diff)
downloadphp-git-8defcb855ab01d9c8ab4759cb793d80149b55a8c.tar.gz
Merge branch 'master' of https://git.php.net/push/php-src
* 'master' of https://git.php.net/push/php-src: (6215 commits) Extra comma Moved proxy object support in ASSIGN_ADD (and family) from VM to slow paths of corresponding operators Simplification zend_get_property_info_quick() cleanup and optimization initialize lineno before calling compile file file in phar Use ADDREF instead of DUP, it must be enough. Removed old irrelevant comment fixed compilation error Fix bug #68262: Broken reference across cloned objects export functions needed for phpdbg Fixed compilation Optimized property access handlers. Removed EG(std_property_info). Fixed bug #68199 (PDO::pgsqlGetNotify doesn't support NOTIFY payloads) Don't make difference between undefined and unaccessible properies when call __get() and family Don't make useless CSE array_pop/array_shift optimization check for zlib headers as well as lib for mysqlnd a realpath cache key can be int or float, catching this News entry for new curl constants News entry for new curl constants ...
Diffstat (limited to 'ext/date/php_date.h')
-rw-r--r--ext/date/php_date.h54
1 files changed, 37 insertions, 17 deletions
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index 536629a25f..aa46aa1b6c 100644
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.h
@@ -1,8 +1,8 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -82,6 +82,7 @@ PHP_METHOD(DateTimeImmutable, setTime);
PHP_METHOD(DateTimeImmutable, setDate);
PHP_METHOD(DateTimeImmutable, setISODate);
PHP_METHOD(DateTimeImmutable, setTimestamp);
+PHP_METHOD(DateTimeImmutable, createFromMutable);
PHP_METHOD(DateTimeZone, __construct);
PHP_METHOD(DateTimeZone, __wakeup);
@@ -127,37 +128,49 @@ 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;
+ zend_object std;
};
+static inline php_date_obj *php_date_obj_from_obj(zend_object *obj) {
+ return (php_date_obj*)((char*)(obj) - XtOffsetOf(php_date_obj, std));
+}
+
+#define Z_PHPDATE_P(zv) php_date_obj_from_obj(Z_OBJ_P((zv)))
+
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;
+ timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID */
+ timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
+ timelib_abbr_info z; /* TIMELIB_ZONETYPE_ABBR */
} tzi;
HashTable *props;
+ zend_object std;
};
+static inline php_timezone_obj *php_timezone_obj_from_obj(zend_object *obj) {
+ return (php_timezone_obj*)((char*)(obj) - XtOffsetOf(php_timezone_obj, std));
+}
+
+#define Z_PHPTIMEZONE_P(zv) php_timezone_obj_from_obj(Z_OBJ_P((zv)))
+
struct _php_interval_obj {
- zend_object std;
timelib_rel_time *diff;
HashTable *props;
int initialized;
+ zend_object std;
};
+static inline php_interval_obj *php_interval_obj_from_obj(zend_object *obj) {
+ return (php_interval_obj*)((char*)(obj) - XtOffsetOf(php_interval_obj, std));
+}
+
+#define Z_PHPINTERVAL_P(zv) php_interval_obj_from_obj(Z_OBJ_P((zv)))
+
struct _php_period_obj {
- zend_object std;
timelib_time *start;
zend_class_entry *start_ce;
timelib_time *current;
@@ -166,8 +179,15 @@ struct _php_period_obj {
int recurrences;
int initialized;
int include_start_date;
+ zend_object std;
};
+static inline php_period_obj *php_period_obj_from_obj(zend_object *obj) {
+ return (php_period_obj*)((char*)(obj) - XtOffsetOf(php_period_obj, std));
+}
+
+#define Z_PHPPERIOD_P(zv) php_period_obj_from_obj(Z_OBJ_P((zv)))
+
ZEND_BEGIN_MODULE_GLOBALS(date)
char *default_timezone;
char *timezone;
@@ -183,14 +203,14 @@ ZEND_END_MODULE_GLOBALS(date)
#endif
/* Backwards compatibility wrapper */
-PHPAPI signed long php_parse_date(char *string, signed long *now);
+PHPAPI zend_long php_parse_date(char *string, zend_long *now);
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
#if HAVE_STRFTIME
#define _php_strftime php_strftime
PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
#endif
-PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC);
+PHPAPI zend_string *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC);
/* Mechanism to set new TZ database */
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb);
@@ -202,7 +222,7 @@ PHPAPI zend_class_entry *php_date_get_timezone_ce(void);
/* Functions for creating DateTime objects, and initializing them from a string */
PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC);
-PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC);
+PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, size_t time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC);
#endif /* PHP_DATE_H */