diff --git a/src/BSON/UTCDateTime.c b/src/BSON/UTCDateTime.c index 4bdc45b93..a33f78334 100644 --- a/src/BSON/UTCDateTime.c +++ b/src/BSON/UTCDateTime.c @@ -218,6 +218,8 @@ static PHP_METHOD(MongoDB_BSON_UTCDateTime, __construct) return; case IS_DOUBLE: + php_error_docref(NULL, E_DEPRECATED, "Creating a %s instance with a float is deprecated and will be removed in ext-mongodb 2.0", ZSTR_VAL(php_phongo_utcdatetime_ce->name)); + php_phongo_utcdatetime_init_from_double(intern, Z_DVAL_P(milliseconds)); return; diff --git a/tests/bson/bson-utcdatetime-007.phpt b/tests/bson/bson-utcdatetime-007.phpt index ec6e53789..9b4cbcd1c 100644 --- a/tests/bson/bson-utcdatetime-007.phpt +++ b/tests/bson/bson-utcdatetime-007.phpt @@ -17,6 +17,11 @@ foreach ($tests as $test) { ===DONE=== --EXPECTF-- +Deprecated: MongoDB\BSON\UTCDateTime::__construct(): Creating a MongoDB\BSON\UTCDateTime instance with a float is deprecated and will be removed in ext-mongodb 2.0 in %s on line %d + +Deprecated: MongoDB\BSON\UTCDateTime::__construct(): Creating a MongoDB\BSON\UTCDateTime instance with a float is deprecated and will be removed in ext-mongodb 2.0 in %s on line %d + +Deprecated: MongoDB\BSON\UTCDateTime::__construct(): Creating a MongoDB\BSON\UTCDateTime instance with a float is deprecated and will be removed in ext-mongodb 2.0 in %s on line %d object(MongoDB\BSON\UTCDateTime)#%d (%d) { ["milliseconds"]=> string(13) "1416445411987"