Skip to content

Commit 33b55c5

Browse files
Merge v1.x into v2.x (#1698)
2 parents b659afb + bbffd2d commit 33b55c5

6 files changed

+11
-4
lines changed

src/BSON/UTCDateTime.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ static PHP_METHOD(MongoDB_BSON_UTCDateTime, __construct)
216216
return;
217217

218218
case IS_DOUBLE:
219+
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));
220+
219221
php_phongo_utcdatetime_init_from_double(intern, Z_DVAL_P(milliseconds));
220222
return;
221223
}

tests/bson/bson-document-toCanonicalJSON-002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
88
$tests = [
99
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
1010
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
11-
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
11+
[ 'date' => new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
1212
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
1313
[ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ],
1414
[ 'code' => new MongoDB\BSON\Javascript('function() { return 1; }') ],

tests/bson/bson-document-toRelaxedJSON-002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
88
$tests = [
99
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
1010
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
11-
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
11+
[ 'date' => new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
1212
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
1313
[ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ],
1414
[ 'code' => new MongoDB\BSON\Javascript('function() { return 1; }') ],

tests/bson/bson-packedarray-toCanonicalJSON-002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
88
$tests = [
99
[new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
1010
[new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
11-
[new MongoDB\BSON\UTCDateTime(1445990400000) ],
11+
[new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
1212
[new MongoDB\BSON\Timestamp(1234, 5678) ],
1313
[new MongoDB\BSON\Regex('pattern', 'i') ],
1414
[new MongoDB\BSON\Javascript('function() { return 1; }') ],

tests/bson/bson-packedarray-toRelaxedExtendedJSON-002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require_once __DIR__ . '/../utils/basic.inc';
88
$tests = [
99
[ new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
1010
[ new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
11-
[ new MongoDB\BSON\UTCDateTime(1445990400000) ],
11+
[ new MongoDB\BSON\UTCDateTime(new MongoDB\BSON\Int64('1445990400000')) ],
1212
[ new MongoDB\BSON\Timestamp(1234, 5678) ],
1313
[ new MongoDB\BSON\Regex('pattern', 'i') ],
1414
[ new MongoDB\BSON\Javascript('function() { return 1; }') ],

tests/bson/bson-utcdatetime-007.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ foreach ($tests as $test) {
1717
===DONE===
1818
<?php exit(0); ?>
1919
--EXPECTF--
20+
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
21+
22+
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
23+
24+
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
2025
object(MongoDB\BSON\UTCDateTime)#%d (%d) {
2126
["milliseconds"]=>
2227
string(13) "1416445411987"

0 commit comments

Comments
 (0)