Commit 1a549d9a authored by Bo Yang's avatar Bo Yang

Avoid using php_date_get_date_ce() in case date extension is not

available.
parent fffe8d39
......@@ -1123,8 +1123,21 @@ PHP_METHOD(Timestamp, fromDateTime) {
zval* datetime;
zval member;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetime,
php_date_get_date_ce()) == FAILURE) {
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "z", &datetime) == FAILURE) {
return;
}
zend_class_entry* ce = Z_OBJCE_P(datetime);
PHP_PROTO_CE_DECLARE datetime_ce;
if (php_proto_zend_lookup_class("\\Datetime", 9, &datetime_ce) ==
FAILURE) {
zend_error(E_ERROR, "Make sure date extension is enabled.");
return;
}
if (!instanceof_function(PHP_PROTO_CE_UNREF(datetime_ce), ce TSRMLS_CC)) {
zend_error(E_USER_ERROR, "Expect Datetime.");
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment