summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2005-06-14 21:32:29 +0000
committerDerick Rethans <derick@php.net>2005-06-14 21:32:29 +0000
commit4fb4cac65c735a9253d7b77f17468a5768a7de13 (patch)
tree86df7acf34af73d482f2d6a84fc511c332f8586e /ext/standard
parentf14292df21e9f1a94c63435ff58faaba4901f8c8 (diff)
downloadphp-git-4fb4cac65c735a9253d7b77f17468a5768a7de13.tar.gz
- Add my new timelib and ext/date. For now only strtotime() makes use of this.
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c1
-rw-r--r--ext/standard/datetime.c29
-rw-r--r--ext/standard/datetime.h1
-rw-r--r--ext/standard/tests/time/002.phpt6
-rw-r--r--ext/standard/type.c14
5 files changed, 13 insertions, 38 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 2483a74b3d..c1c49ed1a8 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -179,7 +179,6 @@ function_entry basic_functions[] = {
PHP_FE(gmstrftime, NULL)
#endif
- PHP_FE(strtotime, NULL)
PHP_FE(date, NULL)
PHP_FE(idate, NULL)
PHP_FE(gmdate, NULL)
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index 774e6947b3..fa6afb4ce6 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -1069,35 +1069,6 @@ PHP_FUNCTION(gmstrftime)
#endif
-/* {{{ proto int strtotime(string time, int now)
- Convert string representation of date and time to a timestamp */
-PHP_FUNCTION(strtotime)
-{
- zval **z_time, **z_now;
- int argc;
- time_t now;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &z_time, &z_now)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(z_time);
- if (!Z_STRLEN_PP(z_time)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Called with an empty time parameter.");
- RETURN_LONG(-1);
- }
- if (argc == 2) {
- convert_to_long_ex(z_now);
- now = Z_LVAL_PP(z_now);
- RETURN_LONG(php_parse_date(Z_STRVAL_PP(z_time), &now));
- } else {
- RETURN_LONG(php_parse_date(Z_STRVAL_PP(z_time), NULL));
- }
-}
-/* }}} */
-
#if HAVE_STRPTIME
/* {{{ proto string strptime(string timestamp, string format)
Parse a time/date generated with strftime() */
diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h
index 5a4b7c3d75..f0d3d4ecd7 100644
--- a/ext/standard/datetime.h
+++ b/ext/standard/datetime.h
@@ -38,7 +38,6 @@ PHP_FUNCTION(strptime);
PHP_FUNCTION(strftime);
PHP_FUNCTION(gmstrftime);
#endif
-PHP_FUNCTION(strtotime);
PHPAPI int php_idate(char format, int timestamp, int gm);
PHPAPI char *php_std_date(time_t t TSRMLS_DC);
diff --git a/ext/standard/tests/time/002.phpt b/ext/standard/tests/time/002.phpt
index 78cfad9fbc..787b89c6eb 100644
--- a/ext/standard/tests/time/002.phpt
+++ b/ext/standard/tests/time/002.phpt
@@ -51,7 +51,7 @@ if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
echo date ("Y-m-d H:i:s\n", strtotime ($date));
}
?>
---EXPECT--
+--EXPECTF--
*** GMT0
1999-10-13 00:00:00
1999-10-13 00:00:00
@@ -61,7 +61,7 @@ if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
2001-12-21 00:00:00
2001-12-21 12:16:00
2001-12-21 12:16:00
-1969-12-31 23:59:59
+%d-12-21 12:16:00
2001-10-22 21:19:58
2001-10-22 23:19:58
2001-10-22 23:32:58
@@ -82,7 +82,7 @@ if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
2001-12-21 00:00:00
2001-12-21 12:16:00
2001-12-21 12:16:00
-1969-12-31 18:59:59
+%d-12-21 12:16:00
2001-10-22 21:19:58
2001-10-22 19:19:58
2001-10-22 19:32:58
diff --git a/ext/standard/type.c b/ext/standard/type.c
index 2cda025a03..4b6d723d6a 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -44,10 +44,6 @@ PHP_FUNCTION(gettype)
RETVAL_STRING("integer", 1);
break;
- case IS_RESOURCE:
- RETVAL_STRING("resource", 1);
- break;
-
case IS_DOUBLE:
RETVAL_STRING("double", 1);
break;
@@ -75,6 +71,16 @@ PHP_FUNCTION(gettype)
*/
break;
+ case IS_RESOURCE:
+ {
+ char *type_name;
+ type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(arg) TSRMLS_CC);
+ if (type_name) {
+ RETVAL_STRING("resource", 1);
+ break;
+ }
+ }
+
default:
RETVAL_STRING("unknown type", 1);
}