Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/BSON/UTCDateTime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-document-toCanonicalJSON-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
$tests = [
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
[ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ],
[ 'code' => new MongoDB\BSON\Javascript('function() { return 1; }') ],
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-document-toRelaxedJSON-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
$tests = [
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
[ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ],
[ 'code' => new MongoDB\BSON\Javascript('function() { return 1; }') ],
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-packedarray-toCanonicalJSON-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
$tests = [
[new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[new MongoDB\BSON\UTCDateTime(1445990400000) ],
[new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
[new MongoDB\BSON\Timestamp(1234, 5678) ],
[new MongoDB\BSON\Regex('pattern', 'i') ],
[new MongoDB\BSON\Javascript('function() { return 1; }') ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
$tests = [
[ new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[ new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[ new MongoDB\BSON\UTCDateTime(1445990400000) ],
[ new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
[ new MongoDB\BSON\Timestamp(1234, 5678) ],
[ new MongoDB\BSON\Regex('pattern', 'i') ],
[ new MongoDB\BSON\Javascript('function() { return 1; }') ],
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-toCanonicalJSON-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
$tests = [
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
[ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ],
[ 'code' => new MongoDB\BSON\Javascript('function() { return 1; }') ],
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-toJSON-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
$tests = [
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
[ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ],
[ 'code' => new MongoDB\BSON\Javascript('function() { return 1; }') ],
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-toRelaxedJSON-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
$tests = [
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
[ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ],
[ 'code' => new MongoDB\BSON\Javascript('function() { return 1; }') ],
Expand Down
5 changes: 5 additions & 0 deletions tests/bson/bson-utcdatetime-007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ foreach ($tests as $test) {
===DONE===
<?php exit(0); ?>
--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"
Expand Down