Skip to content

Commit dad830a

Browse files
committed
Merge pull request #260
2 parents 67fdba0 + 3bb5cd8 commit dad830a

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/BSON/ObjectID.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ PHP_METHOD(ObjectID, __construct)
6767
zend_restore_error_handling(&error_handling TSRMLS_CC);
6868

6969
if (id) {
70+
zend_str_tolower(id, id_len);
7071
if (bson_oid_is_valid(id, id_len)) {
7172
bson_oid_t oid;
7273

tests/bson/bson-objectid-003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
BSON BSON\ObjectID #001 construction with string argument
2+
BSON BSON\ObjectID #003 construction with string argument
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"?>
55
--FILE--

tests/bson/bson-objectid-004.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
BSON BSON\ObjectID #004 Constructor supports uppercase hexadecimal strings
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"?>
5+
--FILE--
6+
<?php
7+
require_once __DIR__ . "/../utils/basic.inc";
8+
9+
use MongoDB\BSON as BSON;
10+
11+
var_dump(new BSON\ObjectID('56925B7330616224D0000001'));
12+
13+
?>
14+
===DONE===
15+
<?php exit(0); ?>
16+
--EXPECTF--
17+
object(MongoDB\BSON\ObjectID)#%d (%d) {
18+
["oid"]=>
19+
string(24) "56925b7330616224d0000001"
20+
}
21+
===DONE===

0 commit comments

Comments
 (0)